Tilting an object

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
VintigeUK
Posts: 3
Joined: Thu Nov 08, 2007 9:31 pm

Tilting an object

Post by VintigeUK »

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
dlangdev
Posts: 1324
Joined: Tue Aug 07, 2007 7:28 pm
Location: Beaverton OR
Contact:

Post by dlangdev »

if your camera has axes u,v,n and the world x,y & z ...

you can easily figure this out.

you're basically throwing the wrong switch.

but i'm talking gibbberish again.

by the way, start with the camera code and move forward from there.

sorry.
Image
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Drunk again, eh, dlangdev? :P

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));
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.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Post Reply