Advertisement

Waypoint and Rotation

Started by December 03, 2004 10:38 AM
1 comment, last by wolf_10 19 years, 11 months ago
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
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
Advertisement
thanks for reply

This topic is closed to new replies.

Advertisement