Facing of a model

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
Jarlaxle
Posts: 10
Joined: Wed Jul 06, 2005 6:43 am

Facing of a model

Post by Jarlaxle »

Hi all,

I'm currently working on getting my keyboard IO set up. Basically I have a 3rd person view and want my character to go foward when the forward key is pressed (usually w).

My problem now is in determining the direction in which the model is facing. I use

Code: Select all

core::vector3df dir(sin(mesh->getRotation().Y * 3.14159/180.0f), 0, cos(mesh->getRotation().Y * 3.14159/180.0f) );
to get a vector, based on the rotation of the mesh. But the model I use for testing (sydney) is built to have 0 rotation on her left, so if baciylly rotated 90 degrees clockwise.

The question I'm thinking about is: Is there a way to balance this "offset" without having to remember it for each model? Or is there a built-in function to get the "forwad" direction of a model?

Thanks for your answers!
There are only 10 kinds of people - those that know binary and those that don't.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

see rhis thread, it has a MoveForward function.

http://irrlicht.sourceforge.net/phpBB2/ ... 554c59655d

may be it will help you somehow
Jarlaxle
Posts: 10
Joined: Wed Jul 06, 2005 6:43 am

Post by Jarlaxle »

Thanks for your answer! :)

That is muc hbetter than my solution and it works, very sweet! I still have a question though: Do all models face in the direction of (1, 0, 0)? Because that is what you are assuming with your solution, right?
There are only 10 kinds of people - those that know binary and those that don't.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

i am not sure,but by try and error,i found it works with all model that
loaded be Irrlicht
Post Reply