# Waypoint and Rotation

This topic is 5045 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hi,l i like to move a Triangle from one waypoint to another, the triangle must allways 'face' in the direction they move.but my prog dont work :-(. here my code: CVector CalculateVelocity(CVector position, CVector next_waypoint) { CVector tmp; tmp=next_waypoint-position; tmp.Normalize(); direction = RAD2DEG(tmp.Angle(CVector(0,0,-1))); return tmp; } render: glPushMatrix(); glTranslatef(position.x, position.y, position.z); glRotatef(-direction, 0.0, 1.0, 0.0); glBegin(GL_TRIANGLES); glColor3f(0.0f, 1.0f, 0.0f);glVertex3f(-1.0f, 0.0f, 0.0f); glColor3f(1.0f, 0.0f, 0.0f);glVertex3f(0.0f, 0.0f, -1.0f); glColor3f(0.0f, 0.0f, 1.0f);glVertex3f(1.0f, 0.0f, 0.0f); glEnd(); glPopMatrix(); speed = 1.0f * timeElapsed; position+=velocity*speed; You can download the prog here prima-tech.de/tmp/way.zip

##### Share on other sites
see this post:
http://www.gamedev.net/community/forums/topic.asp?topic_id=282055&whichpage=1�

maybe there u could find what you need ^___^

PS:
next time, search on the forum before posting :P

1. 1
2. 2
3. 3
4. 4
Rutin
11
5. 5

• 12
• 19
• 10
• 14
• 10
• ### Forum Statistics

• Total Topics
632665
• Total Posts
3007711
• ### Who's Online (See full list)

There are no registered users currently online

×