0 votes

I am working on a 3D game and I want my player character to respond to forces so I need to use a Rigidbody but I also want them to have snappy near-instantaneous horizontal movement, like a KinematicBody.

I'm really struggling to figure out how to have both of these simultaneously.

Ideally, player movement would be represented by a constant offset on the linear velocity of the Rigidbody but it seems this is not really possible from looking at the Rigidbody API.

I have attempted to cleverly apply impulses per physics frame (in _integrate_forces) in order to apply movement in a given direction (whilst simultaneously undoing the movement from the previous frame). But this has become very complex in circumstances where other forces and/or collision stop or redirect the velocity applied by that previous movement. I've also tried simply offsetting the position of the Rigidbody each frame depending on the intended movement direction but this leads to the physics engine not recognizing the change in linear velocity and issues with collision detection.

Is there a standard solution for this? It seems like it would be a common requirement for a lot of 3D games. Thanks.

in Projects by (16 points)

Please log in or register to answer this question.

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.

Categories