• Advertisement
Sign in to follow this  

Waypoint and Rotation

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement