Hi im having trouble tilting my plane in my game. EG when it moves left, it tilts on its side.
A bit like starfox if anyones played it.
Appreciate any help.
Thank you
Tilting an object
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Drunk again, eh, dlangdev?
VintigeUK, what you want to do is to roll your model around its 'long' axis. Which axis that is depends on how the model is oriented. I always use models that point towards positive Z, but your models may differ.
To roll the model, just set the node's rotation, using (wait for it) setRotation(). You specify the rotation around each axis, so if you want to roll a node 45 degrees anticlockwise around its Z axis...
Have a play with that and see if it looks like how you expect. Remember that if the model appears to be rotating the wrong way (i.e. pitching or yawing) then it's just down to how it's oriented.
VintigeUK, what you want to do is to roll your model around its 'long' axis. Which axis that is depends on how the model is oriented. I always use models that point towards positive Z, but your models may differ.
To roll the model, just set the node's rotation, using (wait for it) setRotation(). You specify the rotation around each axis, so if you want to roll a node 45 degrees anticlockwise around its Z axis...
Code: Select all
node->setRotation(vector3df(0.f, 0.f, -45.f));
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