Noob question:
How to teleport an oblect(player) on collision with a collider/object?
Sorry: no debug code.
Thanks anyway
I’ll presume you are using Unity Script:
- One of the objects needs a rigidbody attached. It can be set to isKinematic = true
- Both objects need colliders
This script would be attached to your player object - and it presumes the player knows where it is supposed to teleport.
var thePositionToMoveTo : Vector3;
function OnCollisionEnter(other : Collision) {
if(other.gameObject.tag == "Teleporter") { //Or whatever
transform.position = thePositionToMoveTo;
}
}