Hi, everyone, I've run into a problem when manipulating a rigged mesh model in Panda3D. I loaded a mesh model which has an armature modifier consisting of two adjoint bones( one for the palm, one for a collection of four fingers, namely index, middle, ring and little finger ), which looks like this original unchanged hand model; then I transform the latter bone ( joint ) to fold the four fingers inward, using actor's 'controlJoint' method. Codes here :
self.handActor = Actor( r'/d/3DModels/TestHand.egg' )
self.handJoint1 = self.handActor.controlJoint( None,
'modelRoot',
'Bone1'
)
self.handJoint2 = self.handActor.controlJoint( None,
'modelRoot',
'Bone2'
)
self.handJoint2.setP( 90 )
Then I accessed the vertex info of the the current transformed mesh, with code like this below :
geomNodeCollection = self.handActor.findAllMatches( '**/+GeomNode' )
geomNodePath = geomNodeCollection[ 0 ]
geomNode = geomNodePath.node()
geom = geomNode.getGeom( 0 )
vData = geom.getVertexData()
reader_vertex = GeomVertexReader( vData, 'vertex' )
reader_normal = GeomVertexReader( vData, 'normal' )
vertexList = list()
normalList = list()
for i in xrange( 2000 ) :
vertex = reader_vertex.getData3f()
normal = reader_normal.getData3f()
vertexList.append( vertex )
normalList.append( normal )
Then I marked each of these positions with an smiley sphere, expecting to see a cloud of these smileys positioned just fitting around the deformed hand. However, I got a point cloud of the original hand shape, which is flattened, like this :deformed hand model and vertices obtained shown a point cloud Any idea about how to obtain the vertices positions exactly matching the deformed hand mesh? Thanks!
I think you need to call animateVertices
on the GeomVertexData
, such as:
vData = geom.getVertexData().animateVertices(True, Thread.getCurrentThread())
Panda will automatically cache the animated GeomVertexData.