- Home /
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 :) ). I placed the collider manualy at the keyframes:
And the movement (lerp) of the collider between those frames does unity by itself. See animation:
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
Answer by haruna9x · Mar 17, 2018 at 05:34 PM
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 :)
Answer by watercat · Mar 16, 2018 at 02:39 PM
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!?
Please use the comment if you do not answer the question.