Cuneyt Ozdas Forum
Cuneyt Ozdas Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Save Password
Forgot your Password?

 All Forums
 English - General
 Software Support
 Script Controller Recursion/Storing Value
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 23/07/2005 :  18:18:57  Show Profile
hi all
i'm making a car rig for car motion on the xy plane, so far i've completed more than half the way to it
i have the wheels roll right , front wheels' steering angle influence the car orientation, car velocity influence the car position, the car position determines the wheels' orientation and the car acceleration generates the body's response suspension
i use script controllers for almost all the controllers of the car chasis and wheels

here are the car equations for car motion
theta = (v/l)tan(phi)

where x and y are cartesian coordinates of the middle point on the rear axle, is the orientation angle, v is the longitudinal velocity measured at that point, l is the distance of the two axles, and is the steering angle. is the reference to the equations

the equtions define changes in orintation and position of the wheels and chasis , which means they have to be incremented at every new frame to the value of the controller at the previous frame.

to avoid self reference i call a recursive function which calculates the controller value at the previous frame , i calculate the change in position or orientation according to the current frame and add it to the result of the recursive call. this is the way described in Cuneyt Ozdas roll tutorial
instead of storing the value of the controller at the previous frame, we force it to be calculated incrementely starting from frame 0n then we add to it the changes calculated for the current frame
so far so good
what i have now is
each wheel's rotation is calculated recursivley,
the car chasis orientation is calculated recursivley,so is its position AND its position depends on its orientation so for every recursive call calculating position, a recursive call to calculate orientation is made, that is Nested Recursion which is excuted every frame within the time range and makes timesliding impossible

is there a way other than recursion calls to store previous script controller value and use it for the current frame calculation avoiding self reference
please help!

Forum Admin

649 Posts

Posted - 19/08/2005 :  01:40:23  Show Profile  Visit Admin's Homepage
Sorry for the late reply. I'm not a Script expert, so I'm not very knowladgabe about the limitations and capabilities of max script.

One thing you may want to explore might be baking the animation instead of calculatng it on the fly. Another approach would be trying to store (cache) the already calculated values in a globally accesable and persistent place (e.g some kind of array). But I'm not sure if it's possible to store values in script controller and recall them in another call.

Sorry that I was not very helpful, max script is not an area I'm very good at.


Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
Cuneyt Ozdas Forum © 2000 - 2003 Cuneyt Ozdas Go To Top Of Page
This page was generated in 0.06 seconds. Snitz Forums 2000