Unity 2D Keyframe Animation, Collider moves faster as frames

Hello everybody,

I use the keyframe functionality of the animator to move a 2D collider according to the animation frames (to detect if the pickaxe hits the stone :slight_smile: ). I placed the collider manualy at the keyframes:

113108-keyframe-frame-by-frame.gif

And the movement (lerp) of the collider between those frames does unity by itself. See animation:

113104-keyframe.gif

But I noticed that the collider moves faster as the associated frame (see second .gif).

It isn’t actually a problem but I’am curious if it is possible to change this somehow so that the collider is at the wanted position the same time the frame is shown (like in the first .gif)? Or is there a parameter to change the “velocity” of the collider?

I’am thankful for every answer or hint :).

Best regards,

Bredjo

3 Answers

3

In the animation window, select the animationclip, select the property you want to edit by clicking on the diamond in the row. Right click, select constant. This will turn off smoothing. (You may have to experiment first, I can not remember clearly).

This worked. I did right click on the property (movement and rotation of the collider) and choose Both Tangents -> Constant. When I play the animation now it looked like on the first .gif from my question above. There is now lerp and just the collider at the wanted position. Thank you :)

–

try this add 1 frame for animesion and changed the speed for animesion

Thank you for the reply :). Do you mean adding 1 extra frame to the animation? And what do you mean with speed? The number of samples? If you mean the samples, I tested different numbers of samples but the collider is faster every time. It seams like it should be like this!?

–

Thank you for the replay :).
You mean adding 1 extra frame to the animation?
And what do you mean with speed? The number of samples? If you mean the samples, I tested different numbers of samples but the collider is faster every time. It seams like it should be like this!?