[Closed] How to calculate an object's speed?
Hi everyone!
I’ve animated an object and how could I get its speed at each frame?
Thanks!
speed or velocity == distance/time
so if it takes 30 frames to cover 1 meter, for 1 frame its travelling 3.333r centermeters or 3 centimeters a 30th of a second.
To get the exact speed you would need to find the vector for the first derivative of the transform slope for each axis.
That sounds like a lot of work.
Easier would be to just get the position at frame -1 ticks and frame +1 ticks and use the old (position2-position1)/time formula.
Thank you. I suppose this is a good, fast and easy method that could be precise enough for most circumstances.
Lemme try it!
This should do it. Very similar to the vector and transform slope answer, but I understand this one.
SpeedPerFrame = ((distance (at time (slidertime-1) $.position) ($.position))+(distance (at time (slidertime+1) $.position) ($.position)))/2
I suppose the result of changing 1f to 1tick is more precise.
And why you do that? What’s the principle?
Correct me if I am wrong but I think if you go on a frame/frame basis, you should see no difference. Ticks are not necessary here as the in-out happens on a frame/frame basis. So getting the speed between two consecutive frames will get you the result, or between two keyframes if you set the curves to linear. But then again I can easily be wrong:)
The resulting velocity between measuring the speed using frames Vs ticks could be very different. For example, if you were measuring the speed of frame 5 and there was a keyframe set on that frame that was non-liear, you’d get a different velocity result.
Yes, of course, but then if you do the calculation on a frame-by-frame basis, you are calculating the speed between each frame. So why bother with 4800 ticks when you can simply work with 30 frames? The curve will not affect the speed between two consecutive frames i.e. 0f and 1f. Why would I want to calculate each tick between that?
Yeah, frame is enough.
But what if the position of the object is like this:
at frame 1 : p1 = [0,50,0]
at frame 2 : p0 = [0,100,0]
at frame 3 : p2 = [0,50,0]
And in this case we wanna get the speed at frame 2, so which is right:
- v = ((distance p1 p0) + (distance p0 p2))/2
- v = (distance p2 p1)/2
Which is right?