Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Animation (https://simplymaya.com/forum/forumdisplay.php?f=14)
-   -   F Curve Question (https://simplymaya.com/forum/showthread.php?t=34328)

Jay 12-08-2010 10:10 AM

F Curve Question
 
Hi All

I have a small dilemma,
I have a car on a motion path but wish to duplicate it. At the moment the duplicate (with input connections) creates a second car but it shares the one fcurve so I can't offset the second car - does that makes sense? Is there a way of duplicating it but having control of its own fcurve. I could dupe the path but I have hundreds of cars and am looking for a clean solution.

cheers
J

bullet1968 13-08-2010 11:33 AM

I dont know enough about it Jay but cant you (maybe Maya doesnt have it) use 'array' to make multi copies of the paths really quick???

Jay 13-08-2010 12:33 PM

Not sure mate

we are looking at it here at work, we are just waiting for a TD to be hired but need a fast solution for some previz work we are currently doing

cheers
Jay

stwert 13-08-2010 04:43 PM

I've thought about the problem a bit, and I think the most efficient solution would be to write a script to handle it. But other than that, I can't really think of a simple solution (with relatively little experience in motion path animation). I've been trying to learn MEL/python, so maybe this would be a good chance to do some practice. I might give it a try after work today, but no guarantees I'll get anything to work :p

So you need ~100 cars on a single motion path, offset only in time?
That is, all the cars will follow the exact same line of motion, but at different times? Do they also need to vary in speed?

bullet1968 13-08-2010 09:59 PM

I know SFA stwert but I think thast what he needs. I thought along similar lines...a script that maybe has a random function in it. So car 1 = car 2 = etc etc and maybe another function as you say with different key frame points and frame speed if they need to be different speeds???

keep us posted?

cheers bullet

stwert 13-08-2010 10:38 PM

Sorry, what's SFA?

bullet1968 13-08-2010 11:43 PM

Sweet F*** All mate LOL

Xander-0 14-08-2010 05:21 AM

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);
Example:
if ((tread0Path.uValue) + (0) < 1) {
tread1Path.uValue = (tread0Path.uValue) + (0);

else:
subtract one from above
Example:
} else {
tread1Path.uValue = -1 + (tread0Path.uValue) + (0);
}

stwert 14-08-2010 05:51 AM

Alright, here's my script:

http://dl.dropbox.com/u/3447479/highwayMaker.py

It's python, and it may or may not work :)

Start with a car, and a path, but not connected to it.
Run the script (in the editor or whatever) which will give a simple UI. Input the number of cars and the number of frames within which all the cars should traverse the path.
Then select the car, select the path, and hit execute.

The cars will begin at the start of the path at the current frame (so watch at what frame you hit execute) and randomly start moving down the path. They all go at the same speed (which is the number of frames/number of cars, you can modify the script to go more dense, more sparse, more randomly).

You can also modify axes, path parameters, max values etc in the script if need be, pretty simple stuff.

I don't know if this fits the bill (I didn't get many parameters to start with :p) but I learned a ton with this exercise about scripting, so I don't really care if no one can use it.

bullet1968 14-08-2010 06:55 AM

Xander and stwert...well done. It doesnt matter stwert..you had a go at it. Both of you well done...I must learn Python one day.

bullet

Jay 14-08-2010 02:06 PM

dudes many thanks

I will have a look on monday at work.

cheers
Jay

stwert 14-08-2010 04:05 PM

K, apparently I had an error with the window creation, which didn't show up until I re-opened Maya this morning.

So small update:
http://dl.dropbox.com/u/3447479/highwayMaker.py


All times are GMT. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018