Teleport on trigger enter

Hi,
I am working on some mobile app & in that i want the player to reach its starting location after entering the triggered area…i have used the below code

var destination : Transform;

function OnTriggerEnter(other : Collider) {
    if (other.tag == "Player") {
        other.transform.position = destination.position;
    }
}

i have even tagged the entire player relative controls game object as player & camera object under it as a childobject. But still i don’t know why the camera & the sphere collider is going away from the sphere object(player). Pls help me out.

I guess your collider is not directly associated with the player “root” game object, am I right? This code moves the game object associated with the collider, not everything that is tagged as player. Give appropriated names to all your game objects hat are child of Player and print the name of the object that you’re moving and you’ll understand the issue:

var destination : Transform;

function OnTriggerEnter(other : Collider) {
    if (other.tag == "Player") {
        Debug.Log("Moving " + other.name);
        other.transform.position = destination.position;
    }
}

PS: If the game object that hold the collider is child of player you can use:

other.transform.parent.position = destination.position;

try: other.transform.position = destination.transform.position; It can work