Page 1 of 1

Tilting an object

Posted: Tue Jan 29, 2008 10:53 am
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

Posted: Tue Jan 29, 2008 11:15 am
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.

Posted: Tue Jan 29, 2008 12:37 pm
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.