0 votes

Hi...,

I've animated an KinematicBody with an AnimationPlayer translation property.

How to get the linear (and angular) velocity of the KinematicBody?

Thanks

Mike

P.S.: I need the velocity to move my player (a RigidBody) accordingly with my platform (KinematicBody) by code.

Godot version 3.3.2.stable
in Engine by (99 points)

1 Answer

0 votes

See an answer about changed position https://godotengine.org/qa/112705/detecting-linear_interpolation-movement
Basically velocity = (position - old_position) / delta

However you should not move RigidBody with velocity. You should use forces and impulses.

And typically, when a RigidBody rests on a moving KinematicBody it just moves together with platform: you don't have to do anything extra, like in real life.

by (1,438 points)

Hi sash,

thank you for the link and the basics, this could help.

My RigidBody is a Sphere, and doesn't rest on my moving KinematicBody. I have to glue it to the KinematicBody somehow, I think the best way is to copy velocities from the KinematicBody to the RigidBody, but KinematicBody has no velocity properties.

Cheers

Mike

P.S.: Yes, the Sphere should use real life physics, but not on moving platforms.

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.