Notifications
Clear all

[Closed] Getting obj speed in realtime

I trying to get object speed in realtime. I want geet speed when I move my object not only when I play animation. I have object A which should read speed of object “B” , I found some scripts but these scripts operate
only in animation timeline fps and I need operate on ticks I guess. Best for me would be to keep and execute code inside position script controller. I can`t get this, do anybody can help please.

3 Replies

by not being able to use those other scripts, do you mean that sampling the position with “at time t-1” and getting the length of the vector isnt what youre looking for?

Thx, speed or velocity == distance/time, I used tick instead of time and many
different approaches but don`t work however I found workaround
by using spring linked to driving object and then taking distance between driving object and spring and use it as incrementing or decrementing value to for my
final controler. It work nice in ms:

global a=0
fn update_data_transform crabmaster =
(
a+=(distance $driver $distancepoint)
$Sphere001.pos.controller.Path_Constraint.controller.PERCENT =a

)
when transform $ changes do update_data_transform maw

So maybe is ugly way i did this but now stuck with next – final step.
Because of reasons I don`t want to bore you I dont explane why but
now I have to translate this to float controller and I stuck.
I used customatribute as float to store my value and in
$Sphere001.pos.controller.Path_Constraint.controller.PERCENT i added float script controller
which refer to node: driver and distancepoint as such variables and value – tracked to atributeholder under given location.
Expression is:value+=distance driver distancepoint;value

Hovewer in this case resoult is different, object movement is jerky and It seems like whole
mekanizm work in completly different way. I can`t translate this.

ah I see, sorry I thought you meant just generally in script.

have you tried exposing the position with an exposeTransform with a time offset? from there you could pipe it into a float script controller, and it would also react interactively I think.

although that might not be what youre looking for. I dont really understand some of the things youre doing, like this “crabmaster” parameter and why you add up the speed…