Respawn¶
PlayerControl contains a field that sets the position to bring the player to when they should be respawned: lastpos.
This field is automatically set during TransferMap and MoveInside, but it's also possible to manually set it as well as have 2 ways to manage it from within the map:
- Define a SetPlayerRespawn whose
vectordata[0]corresponds to the position to setlastposwhen the player collides with itsboxcol(Ifvectordata[0]magnitude isn't higher than 0.1, it acts like the second method described below since theRespawntag is applied to theboxcolautomatically) - Define any trigger collider in the map whose GameObject has the
Respawntag. In this case, if the player collides with the collider whileongroundfor more than 15.0 frames (tracked via the player'srespawncountfield), the player'slastposis set to its current position
Essentially, either define an NPCControl with the position to set lastpos, or define a collider with a tag that resets lastpos to the player current position periodically. Defining the NPCControl without a position to set will act as a plain Respawn tagged collider.