PDA

View Full Version : circular dependency in script controller


Alex Morris
01-19-2007, 12:25 PM
Hi guys,

I'm exploring vehicle rigging and am having problems with a script controller for keeping the wheel (a cylinder) on the ground (a plane with noise applied). I've created 2 variables within the script controller dialogue : g and w and assigned them to the 2 object nodes.
The expression is:

r = ray w.pos [0,0,-1]
c = (intersectRay g r)
c.pos + [0,0,(w.radius)]

this throws a ray out straight down from the wheel, calculates the intersection position and then shifts the wheel to sit on the ground. The scripted version of the code works fine on a single frame, but i keep getting dependency errors with the expression and I'm not sure why.
Any ideas? (not used expressions before so assume I know nothing!)

Fabiomussarela
01-20-2007, 01:05 PM
Hi Alex :) which max version are you using?

I made this in max 9 and it worked fine. Just a Plane ($ground) and a Cylinder ($Cyl) simulanting a wheel.

this is the scripted code in the Z controller of the cylinder


xRay = ray $Cyl.pos [0,0,-1]

xNewPos = (IntersectRay $ground xRay).pos

xNewPos.z + $Cyl.radius


Here´s a little demo

http://usuarios.cmg.com.br/~hp-mussarlz/xWheel.rar (http://usuarios.cmg.com.br/%7Ehp-mussarlz/xWheel.rar)

hope it helps :)

Alex Morris
01-22-2007, 09:04 AM
Hi Fabio,

Thanks for your help. I had another look at it this weekend. I can get the script to work from the listener (mine not yours) when the wheel is an unattached object. In the position script I get a circular reference or if I create a hierarchy of dummies the transform of the wheel gets skewed. I think that this might be due to the coordinate space that the controller returns.

I should have added that the wheel is linked to a dummy (now 2 dummies) which has a path constraint applied.

I'm going to wade through the maxscript help for a bit and try to pin this down.

Alex

CGTalk Moderation
01-22-2007, 09:04 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.