How to attach a weapon into the hand

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
ttom
Posts: 43
Joined: Tue Aug 26, 2003 3:43 am
Location: Taiwan

How to attach a weapon into the hand

Post by ttom »

Hi folk:
I had two files of ms3d. one is the ninja another is gun. and I want
add the gun into the ninja's "Joint17". when i do this , nothing happen?
//below is code
IAnimatedMesh* meshms3dgun = smgr->getMesh("../media/gun.ms3d");
IAnimatedMeshSceneNode* node_ms3dgun2 = smgr->addAnimatedMeshSceneNode( meshms3dgun );
if(node_ms3dgun2)
{
node_ms3dgun2->setAnimationSpeed(400);
node_ms3dgun2->setPosition(vector3df(-200,-100,-100));
node_ms3dgun2->setScale(vector3df(10,10,10));
node_ms3dgun2->setMaterialFlag(EMF_LIGHTING, false);
//node_ms3d->setFrameLoop(1*40, 14*40);
node_ms3dgun2->setMaterialTexture( 0, driver->getTexture("../media/gun255.bmp") );
}
device->getFileSystem()->addZipFileArchive("../media/ninja.zip");
IAnimatedMesh* meshms3d = smgr->getMesh("ninja.ms3d");
IAnimatedMeshSceneNode* node_ms3d = smgr->addAnimatedMeshSceneNode( meshms3d );
if(node_ms3d)
{
node_ms3d->setAnimationSpeed(400);
node_ms3d->setPosition(vector3df(100,-100,-100));
node_ms3d->setScale(vector3df(30,30,30));
node_ms3d->setMaterialFlag(EMF_LIGHTING, false);
node_ms3d->setFrameLoop(1*40, 14*40);
node_ms3d->setMaterialTexture( 0, driver->getTexture("nskinrd.jpg") );
ISceneNode* hand = node_ms3d->getMS3DJointNode("Joint17");
hand->addChild(node_ms3dgun2);
}
//
sorry for my english
niko
Site Admin
Posts: 1759
Joined: Fri Aug 22, 2003 4:44 am
Location: Vienna, Austria
Contact:

Post by niko »

You could let the engine print out all joint names and check if you specified the right name, maybe it helps.
ttom
Posts: 43
Joined: Tue Aug 26, 2003 3:43 am
Location: Taiwan

Post by ttom »

Sorry I found the error. the gun need the seleton.
thanks niko
keep the good work
Post Reply