Wednesday, 18 February 2015

Unity3D Tutorial: 18 Teleporting Objects, Player, Prefabs ... Tutorial: 18

Unity3D Tutorial: 18  Teleporting Objects, Player, Prefabs ....












THIS IS Java  scrip: GOOD 4 2D GAMES AND 3D GAMES !

Download Script HERE



----------------------------------------­­­­­------------------------------------­-­-­-­-­-

THIS IS BACKUP  IN TEXT FORM  TUTORIAL 18
1. Create New java and name it : Simpleteleport

2. Copy & Past this text and save java :








 var TeleportEndPoint : Transform; //drag your  point to here in the Inspector 
 // var spawnPoint : Vector3 = Vector3(0, 10, 0);
 
 function OnTriggerEnter(other : Collider)
 {
     if (other.gameObject.tag == "Player")
     {
         other.transform.position = TeleportEndPoint.position;
         // other.transform.position = spawnPoint; // fixed vector method
     }
 }
 




----------------------------------------­­­­­------------------------------------­-­-­-­-­-


















1 comment:

  1. Great script! However, I'm trying to teleport an object from place to place, but with a separate trigger collider located somewhere else in the game. I'd like the character to trigger a collider and then have a another different object teleport from one place to another. Is this possible?

    ReplyDelete