When I try to compute the convex hull of an object in a child script, I notice that the original object and convex hull object do not align. I use the following code:
function sysCall_init()
h = sim.getObjectHandle('imported_part_0')
data = sim.getShapeViz(h,0)
local m=sim.getObjectMatrix(h,-1)
for i=1,#data.vertices/3,1 do
local v={data.vertices[3*(i-1)+1],data.vertices[3*(i-1)+2],data.vertices[3*(i-1)+3]}
v=sim.multiplyVector(m,v)
data.vertices[3*(i-1)+1]=v[1]
data.vertices[3*(i-1)+2]=v[2]
data.vertices[3*(i-1)+3]=v[3]
end
newVertices, newFaces=sim.getQHull(data.vertices) -- get convex hull
newMeshh=sim.createMeshShape(0, 0, newVertices, newFaces)
-- sim.setObjectPosition(newMeshh, h, {0,0,0})
-- sim.setObjectOrientation(newMeshh, h, {0,0,0})
end