[SOLVED] Set correct rotation using teleport

I have decided to recreate my game using physics. Now I try to align the rotation of the rigidbody with the rotation of the object to climb. Previously I used getRotation() and setRotation(). I don’t think this is an option with a dynamic rigidbody. I tried diffrent ways, lik the rule below, but setting the rotation doesn’t work at all. Anyone an idea what I do wrong?

player.rigidbody.teleport(targetBottom.getPosition(), targetBottom.getEulerAngles());


Hi @Albertos,

I think what you tried should work, if you tweak the rotation angles.

If you used in the past getRotation/setRotation that returns a quaternion. Whereas teleport excepts euler angles.

It should work if you find the right angle, since it works in a similar way.

The third person controller example uses teleport together with position and rotation angles to move the character. Check it out (PlayerMovement.js) script:


1 Like

Alright, I found the problem. Because lookAt is not possible on a dynamic rigidbody, I use this on the model, so the rotation of the model deviates from the parent. When climbing, I still had to reset the model to the original rotation. Thanks @Leonidas!