View Full Version : road traffic simulator
11-09-2004, 10:31 PM
How can i make a small rectangle(car) follow a path(road) which is not straight,with curves..?
Please let me know about any animations possible using GLUT or basic OpenGl itself concerning the topic above
11-10-2004, 10:31 AM
1. This has nothing whatsoever to do with OpenGL. It's a drawing API. Animation is up to you.
2. Assuming you have a set of points for the road path which can be interpolated using splines or the like, add another point to represent the car's position and set it based on one or more samples from that path, with the sampling offset increasing over time. Feed the result into glTranslate. Find the tangent angle of the road path at the sample point and feed it into glRotate. Draw a rectangle.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.