Teleporting to an entity


Hello, may i ask how a simple code that will teleport my player to the circle entity when the player bumps the rectangular wall using onCollisionStart? Thank you in advance :smiley:

Hi @marx_vain,

If your player is a dynamic rigid body then you can use the following method:

this.playerEntity.rigidbody.teleport(this.circleEntity.getPosition());

If your player is a kinematic body or isn’t using physics at all:

this.playerEntity.setPosition(this.circleEntity.getPosition());
1 Like