[SOLVED] Respawn player & resetting player camera position

Hello

What is the best way to respawn/reset a player when they (for example fall of a platform)?

Currently I have a basic teleport that puts the player back to the starting position, however I can not reset the camera position of the player properly. The camera position resets but then instantly jitters back to what it was before when you move the mouse.

Project

Any help appreciated why this is happening. Thanks!

1 Like

is the camera a direct child entity of the player?

And did you make the fps script yourself or is it the playcanvas default? if this problem has to do with the camera it may not be hard to fix, go over the fps script and see what is not wanting to collide with your reset script.

Yes it is child of player

The fps script is the playcanvas default. I can not find what is the problem the camera location is always saved on mouse move and then when you set the euler angles to (0,0,0) manually in update as soon as you move the mouse again it reverts back to the original state.

I figured the problem.

The problem was that I was resetting the euler angles for 1 frame only on respawn (inside update function), after that the set euler angles inside the mouse move function was taking over where it left off and overriding it. Simply resetting this.eulers.y and this.eulers.x to 0 on respawn fixed the problem :melting_face:

1 Like