- Home /
How can I avoid position Lerping in Unity's animation tool?
I'm using Unity's animation tool to move sprites around. But sometimes I want to sprite to instantly appear in another position, some kind of teleportation, which means I want to avoid position lerping of that sprite.
How can I do that?
Thanks in advance.
Answer by Zodiarc · May 22, 2014 at 03:01 PM
I didn´t work with the unity anmiator till now, but i can tell you how it could work in blender. maybe you can transfer it.
Assume you´re on the animation frame 0 and want the teleport to occur on frame 10. You put a keyframe on frame 0 to lock the current position, then do the same at frame 9 without moving the object. On frame 10 you move the object to the desired position and set another keyframe. the object will now hop or "teleport" from one position to another.
Hope this helps.
Answer by Mr_Mendel · Nov 21, 2020 at 02:54 PM
Old but if it helps someone else then you highlight the keyed data for the bit you want to move instantly all the keys. Right Click and do both tangents constant.
Right, the same thing can be achieved by simply dragging the tangent straight up or down. At this point Unity will turn the keyframe into a constant key frame as an infinitely steep tangent is not possible.
Answer by kamgru123 · May 22, 2014 at 01:21 PM
Can't you just use
transform.position = new Vector3(x, y);
?
Hi there, I'm using the Animation's timeline to make the animation. $$anonymous$$aybe there is a way to do that in the Animation window?
Your answer
![](https://koobas.hobune.stream/wayback/20220613145636im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Animating the sortingOrder property of a Renderer 0 Answers
2D sprite character movement 3 Answers
Animation - Not Synced! 1 Answer
Why animation events do not change sprite position? 1 Answer