# Normal Vector of Velocity

2 replies to this topic

### #1Arthur

New Member

• Members
• 1 posts

Posted 04 February 2003 - 06:52 AM

hi all,
i'm very bad in maths and programming and i need some help... :blush:
i've made a rotation on an object as that because glRotate is fucking function (sorry for my language ;-) ):

draw_object(){
glRotatef(rot, .0, .0, cos(rotz));
glPushMatrix();
my_object();
glPopMatrix();
}

idle(){
rotz += 2*M_PI;
rot ++;
}

so Now my object turn over itself ( because it used to turn with the (0.0, 0.0, 0.0) axe of rotation without the cos() ) but i don't know how to do to translate it in its trajectory...the object doesn't mind about its trajectory....

i've heard about "Normal Vector of Velocity", or something like that...
if someone can explain it for me or if you've got an other solution for my problem....

I'm sorry my English is very bad...i hop you've understood my problem, if not let me know and i'll try be more understanding...

thanks very much for your suggestions....

### #2Yau

New Member

• Members
• 26 posts

Posted 04 February 2003 - 09:47 AM

I'm not sure what u r talking about.. But do u want to be able to translate ur object from it's current position to a new position based on it's current rotation and speed???

### #3Morgoth

New Member

• Members
• 9 posts

Posted 04 February 2003 - 11:25 AM

Not sure quite what you mean either, but I'll try :
If you keep the object's current position in the form of a 3D vector (x,y,z,) then, you can supply a velocity(speed) vector as well in the same form (speedx,speedy,speedz). So at every frame (or at intrvals) you add the speed vector to the position. Finally you glTranslate your object according to its new position, and there you have it.

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users