I have model with 2 objects.
How to get position of one of the objects in the sceene?
How to get object position?
Use a model type that supports bones and has a get[modeltype]Node("nodename") B3D example: getB3DJointNode
Then attach an invisible node using addChild(nodename) to the target bone and then use getAbsolutePositionon on the invisible node.
Code Example:
Then attach an invisible node using addChild(nodename) to the target bone and then use getAbsolutePositionon on the invisible node.
Code Example:
Code: Select all
//add b3d animated gremlin
scene::IAnimatedMeshSceneNode* anode = 0;
scene::IAnimatedMesh* mesh = 0;
mesh = smgr->getMesh("../media/gremlin.b3d");
anode = smgr->addAnimatedMeshSceneNode(mesh);
anode->setPosition(core::vector3df(50,5,-75));
anode->setAnimationSpeed(1000);
anode->setLoopMode(true);
anode->setScale(core::vector3df(1,1,1));
scene::ISceneNode* hand = 0;
hand = anode->getB3DJointNode("thumbR1");
scene::IAnimatedMeshSceneNode* smfairy = 0;
smfairy = smgr->addAnimatedMeshSceneNode(smgr->getMesh("../media//faerie.md2"));
smfairy->setMaterialTexture(0, driver->getTexture("../media/faerie2.bmp")); // set diffuse texture
smfairy->setScale(core::vector3df(0.5,0.5,0.5));//makes it small
smfairy->setMD2Animation(scene::EMAT_SALUTE);
if(hand != 0)
{
//put the little fairy in the gremlins hand
hand->addChild(smfairy);
//smfairy->getAbsolutePosition
}
Yes. I am download it from SVN.
But I have errors with compile IrrLicht
http://irrlicht.sourceforge.net/phpBB2/ ... 4709#94709
But I have errors with compile IrrLicht
http://irrlicht.sourceforge.net/phpBB2/ ... 4709#94709