Page 1 of 1

Facing of a model

Posted: Mon Jul 18, 2005 6:22 pm
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!

Posted: Mon Jul 18, 2005 7:52 pm
by Emil_halim
see rhis thread, it has a MoveForward function.

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

may be it will help you somehow

Posted: Mon Jul 18, 2005 9:17 pm
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?

Posted: Tue Jul 19, 2005 3:33 am
by Emil_halim
i am not sure,but by try and error,i found it works with all model that
loaded be Irrlicht