Jump to content
  • Advertisement
Sign in to follow this  
meghnath2005

how to make an oject move along a path?

This topic is 5030 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

please provide code to make an oject seem to be animated by making it follow a path.this will be used to make a car follow a road in 2D.Provide me ideas where i will be able to do some multithreading easily as there will be around 40000 cars whose traffic is to be simulated. thanks

Share this post


Link to post
Share on other sites
Advertisement
hello ..
ok let's say your path is line and you have an array for its vertexes positions like this array
float path[poins_size][2];
in the render function do this thing:

if (i==point_size)
i=0;
glTranslatef(path[0],path[1],0);
draw_object();
i++;



this will make the object move along the path.
i hope it works.
please tell me if this isn't the right way

bye !

[Edited by - ff8 on January 9, 2005 4:28:17 AM]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!