+1 vote

all tutorials say just do velocity=rootmotion.origin/delta and apply it, but it's completely wrong:

delta is physics delta and animationtree is in process, so it has it's own delta. Animation is not related to physics at all, and root motion transform is single frame change, so using it in physics_process is wrong.

All these examples work great in their completely empty projects where FPS is higher than physics FPS, however if it is otherwise, you'll see that the lower your FPS, they higher wrongness of this logic is, at physics FPS at 120 (I have to use it for physics based game) and actual 40 render FPS, root motion kinematic body logic is 3 TIMES as wrong, single character step makes them fly forward and stuf

So is there anyone who can explain how to actually use rootmotion to move kinematic body?

in Engine by (132 points)

2 Answers

+1 vote

Indeed you are right. I think by dividing the delta, we do not want to 'annihilate' the Physics delta but the "Animation process time" delta.

For me this works with a higher physics step and lower FPS and vice-versa:

$AnimationTree.get_root_motion_transform().origin.z / self.get_process_delta_time()
by (38 points)

get_process_delta_time() is the key here. It returns the idle frame delta time, and you can still call it inside the physics process callback if you need to.

+1 vote

In addition to getting the idle process delta as FuLeZi said, you can set the process mode for the AnimationTree to physics. If you look at the first picture in the manual for AnimationTree, you can see that's what they've done for the demo (look in the inspector in the top right).

by (100 points)
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.