I found the tutorials in this forum of attaching weapons, it works, but there is a strange problem : The attached object seems like blinking...
The objects are exported to .x files from .3ds using Panda Exporter. And the joint, which is the dummy helper of the biped in 3ds max, is called "LHand".
The objects are here: alien.max, alien.x, Sword.x
Code: Select all
// Load the alien mesh
IAnimatedMesh* mesh = gl_data.smgr->getMesh("./media/char/alien.x");
IAnimatedMeshSceneNode* node = gl_data.smgr->addAnimatedMeshSceneNode( mesh );
if (node)
{
node->setMaterialFlag(EMF_LIGHTING, false);
node->setPosition(vector3df(-70,0,-90));
node->setMaterialTexture( 0, gl_data.driver->getTexture("./media/texture/alien.png") );
// Attach the weapon to the hand
ISceneNode* mPt = node->getXJointNode("LHand");
if (mPt)
{
IAnimatedMesh* mesh_w = gl_data.smgr->getMesh("./media/weapon/sword.x");
IAnimatedMeshSceneNode* node_w = gl_data.smgr->addAnimatedMeshSceneNode( mesh_w, mPt );
node_w->setMaterialFlag(EMF_LIGHTING, false);
}
}