"mesh.X" contains the mesh and bones
"anim.X" contains the bone animation
I tried to add 3 nodes with different animation speed.
here's my code:
Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("mesh.X");
((scene::ISkinnedMesh*)mesh)->useAnimationFrom((scene::ISkinnedMesh*)smgr->getMesh("anim.X"));
IAnimatedMeshSceneNode* node;
//---- node 1
node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(4800.0);
//---- node 2
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(1300.0);
node->setPosition(core::vector3df(1.0,0.0,0.0));
//---- node 3
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(2200.0);
node->setPosition(core::vector3df(2.0,0.0,0.0));
all the bounding box are incorrect.
Then, I tried to add 3 nodes with same animation speed, but different current frame.
here's my code:
Code: Select all
IAnimatedMesh* mesh = smgr->getMesh("mesh.X");
((scene::ISkinnedMesh*)mesh)->useAnimationFrom((scene::ISkinnedMesh*)smgr->getMesh("anim.X"));
IAnimatedMeshSceneNode* node;
//---- node 1
node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(4800.0);
//---- node 2
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(4800.0);
node->setCurrentFrame(30.0);
node->setPosition(core::vector3df(1.0,0.0,0.0));
//---- node 3
IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
node->setMaterialFlag(EMF_LIGHTING, false);
node->setDebugDataVisible( scene::EDS_BBOX |
scene::EDS_BBOX_BUFFERS |
scene::EDS_SKELETON);
node->setAnimationSpeed(4800.0);
node->setCurrentFrame(30.0*4800.0);
node->setPosition(core::vector3df(2.0,0.0,0.0));
how can i fix this problem?