ScriptSpot

Script

speedometer

By giant · Credited author: GiaNT · 2008-07-04

Version
0.1
Version requirement
I think all of Max
Date updated
2008-07-04
Votes
12
Description

So simple!
It tells you the speed of the selected object in [km/h] if your scene in meter unit.
You can easily modify to [mph] or [m/s].

If you would like, upgrade it and share for all of us! ;)
GiaNT

Attachments

Tags: Animation, useful, speed

Comments (6)

Anubis · 2009-09-11

Nice scripting Lutteral. I also beat my head some time ago on this issue. May seem easy at first sight, but calculating speed is much more complicated. 1st - if we check distance, we need to work with current and previous position, not interfere future position. Else, for example, if at frame 0 our object is not moving (there is our start), then the position distance between frame -1 and +1 will return some speed as it moved, and this will be wrong result, right? And second,- distance function is welcome for straight line moving calculations, so shortly, here needed to check length of the curve. Extract trajectory to spline and so on... Might be better someday I do write this script rather than post theory here.

lutteral · 2009-09-10

Here's another version of a speed-o-meter. Comments welcome.
Units must be centimeters. If different, change the first line of code: Konstant = 0.036 to the corresponding value, e.g. 3.6 for meters.

M

Attachments

Anubis · 2009-02-25

There is global variable FrameRate so change code to

v = (a*3.6*FrameRate)

-- and all done :)

defex · 2008-10-02

for 30 FPS change it to

v = (a*3.6*30)

and add

lbl3.text = (v as string)

right under it to see the speed in the script rollout instead of having to look at the listener.

very handy script thanks!

Insidious83 · 2008-08-18

Thank you for your script post! I am still trying to learn MAXScript.
I have one question: what does the 25 mean in v = (a*3.6*25) ?

a = change in distance position
3.6 = conversion of m/s to km/h
25 = ?

Thank you for your time.

giant · 2008-09-11

this is because of the 25 frame/second

thanks for your question !!!
at least one more people use my stuff

i will upload a newer version in a few minute :)

peace, Giant