ScriptSpot

Forum topic · General Scripting

scripting a uniformly accelerating object

By veloci · 2015-11-18

Description

Hi

I need some help scripting object motion.

I have values for ....

1. total distance travelled
2. travel direction
3. start speed
4. final speed
5. total time taken

.... and I need to position an object accordingly. The acceleration is uniform.

How would I go about this? How would I keep track of the current frame and velocity, increase it over time and relay it to object position until the final frame?

Thanks
Mark

Comments (2)

veloci · 2015-11-19

Thanks!

I have a test working with this ....

dir = normalize ($Point002.pos - $Point001.pos)
for f = 1 to 90 do
(
currentVelocity = pflowFloatVelocity * 100
with animate on
(
slidertime = f
$Sphere001.pos += dir * currentVelocity
)
)

I'm pulling pflowFloatVelocity from the animated float channel in PFlow. It works fine.

roosterMAP · 2015-11-19

Not 100% sure, but this should put you in the right direction...

a = ( v2 - v1 ) / t
a = acceleration
v2 = final speed
v1 = start speed
t = time

position on vector = v1 * t + ( a * t^2 ) / 2