Skip to main content
Known Participant
June 24, 2023
Answered

property speed expression/script

  • June 24, 2023
  • 2 replies
  • 563 views

in the expressions the position property has speed attribute but not in the script. Is there a way to get the speed of a property in script? And can we get the avarage speed exactly?

This topic has been closed for replies.
Correct answer Dan Ebberts

You could have your script temporarily add an expression, and then harvest the speed value and delete the expression. Or, you could approximate it by using .valueAtTime() with your target time and again with the same time plus a tiny increment and do the math to calculate the difference divided by the time interval. Something like that. But no, you don't have those tools directly available in scripting.

2 replies

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
June 24, 2023

You could have your script temporarily add an expression, and then harvest the speed value and delete the expression. Or, you could approximate it by using .valueAtTime() with your target time and again with the same time plus a tiny increment and do the math to calculate the difference divided by the time interval. Something like that. But no, you don't have those tools directly available in scripting.

HrachMAuthor
Known Participant
June 26, 2023

Thank you very much, the temporary expression method seems the most sensible.

Community Expert
June 24, 2023

I am not sure what you are trying to accomplish. What "speed" attribute are you talking about and how are you trying to use it?

HrachMAuthor
Known Participant
June 26, 2023

just wanted to make a script where I needed it. in the expression type position.speed, you will see