Sign in to follow this  
juglarx

3DSMax and camera export

Recommended Posts

hi guys! i try to export the camera animation (translate , scale and rotation) from 3dSMax60 , i use this code [CODE] void RecursiveNode(INode *node,FILE *fp ,TimeValue time){ if(node->Selected()) { ObjectState os = node->EvalWorldState(0); if (os.obj) { fprintf(fp,"%s", node->GetName()); if(IsNodeValid(node, LOOKAT_CAM_CLASS_ID)){ int count = 0; CameraObject *cam = (CameraObject*)node->EvalWorldState(time).obj; // convert vertex from 3dsmax format. Matrix3 tm = node->GetNodeTM(time); Point3 p3 = tm.GetTrans(); float yaw = 0.0f; float pitch = 0.0f; float roll = 0.0f; tm.GetYawPitchRoll(&yaw,&pitch,&roll); fprintf(fp,"TransalteX:%f\n",p3.x); fprintf(fp,"TransalteY:%f\n",p3.y); fprintf(fp,"TransalteZ:%f\n",p3.z); fprintf(fp,"Rotation Yaw:%f\n",yaw); fprintf(fp,"Rotation Pitch:%f\n",pitch); fprintf(fp,"Rotation Roll:%f\n",roll); } } } } [/CODE] so , when i see the file , the data are al the same , here is when i call the RecursiveNode(....) [Code] int tpf = GetTicksPerFrame(); int s = i->GetAnimRange().Start()/tpf, int e = i->GetAnimRange().End()/tpf; //for each frame for (int f = s; f <= e; f++) { fprintf(fp,"-----%d------\n",f); for (int idx=0; idx<numChildren; idx++) { if (i->GetCancel()) break; //RecursiveNode(i->GetRootNode()->GetChildNode(idx),fp ,i->GetTime()); RecursiveNode(i->GetRootNode()->GetChildNode(idx),fp ,f); } fprintf(fp,"-----------\n"); }// for frames [/Code] any one figure out why i can get the trasformation data for each frame ? ( i get all the same transformation value each frame:( )

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this