colliision

currently i have

function OnCollisionEnter(other : Collision) 
{ 
    if (other.gameObject.tag == "Enemy") { 
		transform.Translate(10,0,10);

   } 
}

which moves the players character randomly

instead would someone be able to help me make it so on collision the player moves to another objects location

iv tried

    other.transform.position = destination.position;

iv been messing around with this for a while and cant get it right >.<

It looks like you have the right idea with your second code example, but if it’s the player you want to move (and if the script in question is attached to the player), it’s probably transform.position you want to modify, rather than other.transform.position. (I’m assuming that in this context, ‘destination’ references the transform of the object whose position you want the player’s to match.)

Ahhh thanks jesse

got it working now :slight_smile:

 var destination: Transform;

function OnCollisionEnter(other : Collision) 
{ 
    if (other.gameObject.tag == "Enemy") { 
		transform.position = destination.position;
   } 
}