Hi, so I read the example of Quake3 explorer and search the way the gun is implemented like in FPS, old posts that I found suggested that we have to attach gun node to camera node, something like this:
Code: Select all
camera = smgr->addCameraSceneNodeFPS();
gunMesh = smgr->getMesh("gun.md2");
gunNode = smgr->addAnimatedMeshSceneNode(gunMesh , camera, -1);
gunNode ->setScale(core::vector3df(14,14,14));
gunNode ->setPosition(core::vector3df(15,-10,30));
gunNode ->setRotation(core::vector3df(180,0,180));
It works and the gun moves along with camera. However, I don't know the exact rotation/position of gun.md2 that is provided with Irrlicht SDK and the example code doesn't have that at all. So, does example implemented it in a different way? Also, I heard that position/rotation/scale isn't stored in mesh formats, so does that mean we have to always manually set them when we load them in irrlicht?
With that:
Code: Select all
gunNode->setScale(core::vector3df(4, 4, 4));
gunNode->setPosition(core::vector3df(15, -10, 30));
gunNode->setRotation(core::vector3df(100, -100, -100));
I somehow get close with original.
Thank you.