getHorizontalAngle question

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
NewImage
Posts: 8
Joined: Wed Feb 11, 2009 3:07 am

getHorizontalAngle question

Post by NewImage »

Hi

Im trying to set the rotation of a space ship model to that of my camera. Howerver when i try and use getHorizontalAngle and set my model rotation, it makes the wrong side of the model face my target.

Is there a way to change the vector that getHorizontalAngle rotates from (0,0,1) to another direction like (-1,0,0).
arras
Posts: 1622
Joined: Mon Apr 05, 2004 8:35 am
Location: Slovakia
Contact:

Post by arras »

getHorizontalAngle() assumes you are facing FRONT along Z axis. If your node face front along different axis you would get wrong results.

Also, getHorizontalAngle() calculate HORIZONTAL and VERTICAL angle between 2 points in 3D space (name is misleading a little bit). I don´t know if it can be used to adjust your node to rotation of camera (perhaps if you use camera position and target, you can ...but it still assumes that up vector of your camera face somewhere along Y axis).

What you can try is to get transformatin of your camera then use rotation part to rotate your node. This would be quit straightforward. But I was not testing it.

Bye the way, what is returned by camera->getRotation() function? I know setRotation() does not work but if getRotation() returns correct value than you can use it to rotate your node.
Post Reply