View Single Post
Old 14-08-2010, 05:21 AM   #8
Registered User
Xander-0's Avatar
Join Date: Feb 2005
Location: This Place
Posts: 220
Thanks: 0
Thanked 2 Times in 1 Post

Here's a script that will allow you to control an object's position on a path, based on some other object's position. This can be adapted to run objects at different speeds as well. Note - the objects will 'loop' around the ends of the curve (starting back at 0) once they reach the end of the curve (the curve is assumed to be in the range of 0->1)
I originally developed this to control tank treads. You should be able to dump it into the uValue parameter as an expression. I'm afraid you may be on your own for creating duplicate cars, though (never set that part up, I'm afraid).

//general form of equation:
When ((primary tread's path uValue) + (uValue moved from primary tread) less than 1):
(primary tread's uValue) + (uValue moved from primary tread);
if ((tread0Path.uValue) + (0) < 1) {
tread1Path.uValue = (tread0Path.uValue) + (0);

subtract one from above
} else {
tread1Path.uValue = -1 + (tread0Path.uValue) + (0);
Book Wise
Xander-0 is offline   Reply With Quote