0 votes


I have a 3D RigidBody with a locked Y-Rotation-Axis (Axis Lock Angular Y). All other linear and angular axes are unlocked.

I want to set the y-rotation by code myself. The translation and rotation of the unlocked axes should be calculated by the physics engine.

I can change rotation.y in _physics_process(delta) or _process(delta), which rotates in y correctly, but this stops the translation and rotation of the unlocked axes, calculated by the physics engine. Another try to change the translation in _integrate_forces(state) doesn't do anything.

Any ideas?



in Engine by (99 points)
edited by

1 Answer

0 votes
Best answer

use the RigidBody mode "character"
then modify the transform in the bodystate

func _integrate_forces( state ):
    state.transform.basis = state.transform.basis.rotated(Vector3.UP,the_rotation)
by (3,932 points)
selected by

Hi klaas,

state.transform.basis = state.transform.basis.rotated(Vector3.UP,the_rotation)

fixed my problem. I leave the mode as Rigid and not Character, because I need the automatic physics rotation in x, and z.

Thank you so much, I've learnd something new, and I think I like Godot more and more, Cheers


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.