Sign in to follow this  
wolf_10

Waypoint and Rotation

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this