If you fall off over the edge you spawn back to the original spawn point

I would like to know how i could make a teleporter when you fall off and when you do you spawn back to the original starting point.

Here is the game if you need to look at it
https://playcanvas.com/editor/scene/1361206

The simpler way is to add a collider just down the edge and when the player collides with that collider, then teleport it to its initial position.
You can study more about collision here

You can teleport by this.player.teleport(this.initialPosition,this.initialRotation);

2 Likes

so would all i have to do is put in that code here like this
Screenshot 2022-03-15 12.36.10 PM

and attach it to the collider?

So i found out how i can teleport but i cant seem to change the position it just sets it in a fixed position and whenever i mess with the coordinates it doesn’t seem to do anything
Screenshot 2022-03-15 1.40.22 PM

Also it depends where you jump off from it seems its taking the coordinates that you typed and putting them in from where you hit the collider is there anyway where i could set it to a fixed position and no matter where you hit the collider at it spawns you at the same coordinates.

You are not giving correct values for the teleport function, read about teleport here

Also, I am not sure where you have attached the script. So making a public project would help in singling out the issue.

here is my project PlayCanvas 3D HTML5 Game Engine
the place where im testing is in another scene called Testing for teleporting

and i had attached the script to a collider
Screenshot 2022-03-16 11.48.04 AM

I would like if the player would teleport to
(-1.769, 1.789, 1.252)
X Y Z

well now after i put it in the new scene its not working whenever fall onto it, It acts as an invisible platform