Hi!
I've made an object (scenenode) and a animation to make him walk. I've made the animation above another node because I want to control the Y position manually, so that the object is always above the terrain.
The next step is to make him turn into the direction he is walking, but I don't know how to do this. I've tried several ways, but none was successful.
I have two informations that I think are enought to do this job, the actual position and the position he should be placed. So, the direction is the subtraction of those vectors. Now, how do I make him face this direction?
Thanks,
JP.
PS: I've made that with pyogre
How to make an object face a direction?
-
- Gnoblar
- Posts: 11
- Joined: Wed Dec 22, 2004 2:43 pm
- Location: Natal - RN - Brazil
-
- Gold Sponsor
- Posts: 446
- Joined: Fri May 02, 2003 10:05 am
- Location: UK
Just thought I'd say that I did something similar, and what I used was the code I found in the Fresnel Demo...I think its the part that makes the fish look in the direction of travel.
Basically it is using quaternions to set the orientation of the node (i.e. make the node point towards the new direction based on the new position). It does this by using the 'last' position of the node, which you need to record each time you update it. Check out the code, you'll see what I mean.
Basically it is using quaternions to set the orientation of the node (i.e. make the node point towards the new direction based on the new position). It does this by using the 'last' position of the node, which you need to record each time you update it. Check out the code, you'll see what I mean.
-
- Gnoblar
- Posts: 11
- Joined: Wed Dec 22, 2004 2:43 pm
- Location: Natal - RN - Brazil