I need to add a “teleport” system to my game. Like Red Dead Redemption: You can travel whit a stagecoach an skip the travel (teleport to destination).
The player will use this function to fast travel by City A to City B (or C, D…) using a terminal.
Sorry bad english. Thanks
2 Answers
2You can do something like that bro, it’s just a piece to give you some idea:
private void Teleport(Vector3 destinyPos){
//Destroy all the object that was in inspector including the player camera
Destroy(transform.gameObject.parent);
//Use this to instantiate a new Prefab of your player in the giving position in the world
Instantiate(playerPrefab, destinyPos, Quaternion.identity);
}
Hope i helped you.
this.transform.position = thatLocation.transform.position;
thanks @Stormzin, You really helped me (TE TELEPORT WORKS!!!) thank you very much.
– PsychoWolfPsychoWolf, make sure you add comments, not answers when you want to thank people, etc.
– Landern@PsychoWolf i'm glad to read this from you. Good luck! Any other questions you can ask in this answers. If this solved your problem please mark this answer as correct to keep the community organized
– Stormizin