0 votes

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

Godot version 3.3.2
in Engine by (37 points)

Ive figured out, sorry if anyone was already writing an answer

How did you solve the problem?

1 Answer

+1 vote

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:

AnimationPlayer Teleport
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.

Scene Tree Setup
More ideally you would want to animate the MeshInstance when you have a KinematicBody with this setup, but it was just an example.

Result:

End Result
Hope it helps someone!

by (992 points)
edited by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.