Topic was automatically imported from the old Question2Answer platform.
Asked By
Arielrandal
Hello, im trying to make a simple “slime” enemy that jumps towards the player (in 3d), when ive managed to make him move, and now im making an animationplayer that plays when the slime moves to make it jump, ive tryed moving the Y translation and Y matrix, the animation works, but it teleports to 0,0,0 to jump, how can i make it play without teleporting there? thanks for any answer
Ive figured out, sorry if anyone was already writing an answer
For everyone else’s reference, this occurs because the animated properties are predetermined (by you) and as of Godot 3 (and so far 4) can’t be changed at runtime (as far as I know).
For example, as per the question title:
What’s happening is that even though the Node is being translated around, the AnimationPlayer is running an animation where the translation property changes from exactly(0, 0, 0) to (0, 2, 0), thus no matter where the Node’s translation might be at runtime, when the animation starts, it’s set to (0, 0, 0).
Note you can blend animations with AnimationTrees, but for transforms this is irrelevant.
##Solution for Transforms:
Make the Node you’re animating a child of another Spatial or Node2D (for 2D). Transform the parent properties for game movements and animate the child’s.
More ideally you would want to animate the MeshInstance when you have a KinematicBody with this setup, but it was just an example.