How to add weapon mesh to camera?
How to add weapon mesh to camera?
How to add weapon mesh to camera?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
set parent
You can set the camera as the weapons parent, I think the code works like this.
I'm pretty sure it's something like that, you might have to play around with it a little, cause I'm not as good at programming as modeling.
Code: Select all
node->setParent("another node");
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Posts: 1691
- Joined: Sun May 18, 2008 9:42 pm
try this
Try putting a colision response animator on the weapon like in the collision example.
That would be illogical captain...
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
-
- Competition winner
- Posts: 1123
- Joined: Sun Jun 10, 2007 11:14 pm
OHh, I use this code
And this is how my gun looks with it
Code: Select all
weaponMesh=smgr->getMesh("data/marine_rifle.3ds");
weaponNode = smgr->addAnimatedMeshSceneNode( weaponMesh, camera, -1 );
weaponNode->setScale(core::vector3df(6,6,6));
weaponNode->setMaterialTexture(0,driver->getTexture("data/marine_rifle.png"));
weaponNode->setMaterialFlag(EMF_LIGHTING,false);
weaponNode->setMaterialFlag(EMF_ZBUFFER,false);
weaponNode->setPosition(vector3df(30,-52,100));
weaponNode->setRotation(vector3df(0, 180,0));