have a script effect the object its attached to

I have this script attached to a game object.:

public class Flight : MonoBehaviour {

public int height = 2000; 

void OnTriggerEnter ()
{
	(this gameoject ( Vector3.up * height) 	
}

}

the Idea being that when a Rigidbody enters the trigger the object that this is attached to will go up into the air, any help greatly appreciated.

void OnTriggerEnter(Collider col)
{
this.transform = new Vector3 (this.transform.x, this.transform.y, height);
}

this is the idea, but this will teleport your game object instead of make it move.
many solutions : - you can use Rigidbody.AddForce(float force) until a specific height.
-You can start a coroutine which will move the object with Mathf.Lerp
-You can also take a look at the effectors.

I would suggest you to watch the tutorials on the unity site here for scripting and here for physics.

Please vote for me :slight_smile: