[SOLVED] Issues with setEulerAngles

Hello, do you see anything wrong with this code?

            var Bpos=this.app.root.findByName('Inn').getPosition();
            var Brot=this.app.root.findByName('Inn').getEulerAngles();
            if (Brot.y===0) {

Also if i keep changing the Brot.y+(value) the player don’t rotate properly…pretty frustrating.

Hi @ayrin,

What do you expect this code to do? And what’s happening now?

The code get the position and rotation of a building (Inn in this case) and move the player to a specific location and rotate it in the right direction too, since the position and rotation of building change also the positioning of player have to change according. Actually the position is ok but the rotation don’t change as it should.

If it’s a rigid body you need to set the rotation on the teleport method, since the body is controlled by physics.

Just make sure it’s world euler angles and not local:

this.entity.rigidbody.teleport(Bpos.x-1,2.5,Bpos.z-2.2, 0,Brot.y+180,0);

@Leonidas it works, i didn’t know i could put it together in teleport. Thanks a lot.

1 Like