• Advertisement
Sign in to follow this  

how to make an oject move along a path?

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