View Full Version : "Moving Forward"

03 March 2005, 09:17 PM
Very new to maxscript and I'm trying to write a script that turns a wheel accurately based on it's distance moved. All is working until the motion of the wheel 'reverses' and it continues to spin the wrong way.

So how can I give an object a 'forwards' direction or vector, so that I can detect when it's travelling 'backwards'.......E.g I thought I'd be able to say that the Y axis of a parent object was the forward direction of the attached wheel but I'm unable to detect anything useful along its axis of travel........

I'm looking at the -in coordsys local/parent- for clues but any help would be appeciated....

03 March 2005, 11:39 PM
If you're writing your own, check out the rollin script:

It may provide some insights.

03 March 2005, 10:24 AM
yeah thanks - seen it - but it didn't really help solve my problem as it doesn't work 100% of the time....

I have also been through the script before to understand how he's detecting a reverse direction but to no avail....

the script I'm looking at is a rotation script so works as you animate....and looks like this...

obj = $Cylinder01 --name of object
timeres = 1f

fn getrot t =(
if t<0f then return 0
t0 = t-timeres
t1 = t
rot0 = getrot(t0)
p0 = at time t0 obj.position
p1 = at time t1 obj.position
if p0 == p1 then return rot0

dif = (p1-p0)
len = Length(dif)
angle = 4*len/((myradius+myradius)*pi)
rot1 = rot0 + angle


CGTalk Moderation
03 March 2005, 10:24 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.