Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® MotionBuilder® / Python / help for MotionBuilder 2012
  RSS 2.0 ATOM  

help for MotionBuilder 2012
Rate this thread
 
61400
 
Permlink of this thread  
avatar
  • Total Posts: 3
  • Joined: 19 October 2006 03:17 PM

In MoBu2010, we had a code that returns the positions of a specific vertex, even if the node belongs to a deformed blendshape. In MoBu2012, we get the position of the vertex without the blendshape deformation.
Question : how can we get the position the vertex in the deformed blendshape ?

float getVertexPositionMoBu2010(char *modelName, int vertexID, int XYZ)
{
FBVector4d currentVertex;
FBVector4d result;
HFBModel lModelSource = FBFindModelByName( modelName );

if (!lModelSource)
return -FLT_MAX ;
HFBGeometry Geom = lModelSource->Geometry;
float* PositionArray = Geom->GetPositionArray();
FBMatrix mTransformationMatrix;
mTransformationMatrix.Set( Geom->GetTransformationMatrix() );
currentVertex[0] = PositionArray[4*vertexID + 0];
currentVertex[1] = PositionArray[4*vertexID + 1];
currentVertex[2] = PositionArray[4*vertexID + 2];
currentVertex[3] = 1.0;
FBVectorMatrixMult(result, mTransformationMatrix, currentVertex);
return result[XYZ];
}


float getVertexPositionMoBu2012(char *modelName, int vertexID, int XYZ)
{
FBVector4d currentVertex;
FBVector4d result;
HFBModel lModelSource = FBFindModelByLabelName( modelName );

if (!lModelSource)
return -FLT_MAX ;

//
HFBGeometry Geom = (HFBGeometry)lModelSource->Geometry;
FBVertex* PositionArray = Geom->GetVertexes();
currentVertex[0] = PositionArray[vertexID][0];
currentVertex[1] = PositionArray[vertexID][1];
currentVertex[2] = PositionArray[vertexID][2];
currentVertex[3] = 1.0;

// Gestion TRS du model :
FBMatrix mTransformationMatrix;
lModelSource->GetMatrix(mTransformationMatrix);
FBVectorMatrixMult(result, mTransformationMatrix, currentVertex);
return result[XYZ];
}



Replies: 0