Teleport Charactor

I am needing a code that when you collide with an invisable collide i have placed in the doors. I want it so that each door of my building has a invisable collider in it and depending on wich u collide with you go inside to the other side of that door. All my inside and out are in one scene.

It sounds to me as though you want to have a collider defined as a trigger and when the trigger throws an event, you detect that event and change the position of the character that caused the trigger to be a new position corresponding to “inside door”. The core concepts of this answer are:

  • Triggers
  • Collider.OnTriggerEnter
  • Transform.position

ok what you can do is set an emptyGameObject in each of the sides of the door(where the player will "teleport"once the collider is activated)…and add this script to the empty game objects.

second add another 2 empty game objects and place them a little appart from the other 1s so its like if u have 2 emtygameobjects on each side …add this script to 1 emty on each side …and a collision box …set the collision box to “trigger”…and fill in the “destination” variable by draging the oposite empty into there …so emty is 2 collided and the other to teleport from the opposite side…

var destination: Transform; // drag the destination object here
var teleportSound: AudioClip; // set this to the teleport sound, if any

function OnTriggerEnter(col: Collider){
    col.transform.position = destination.position; // teleports object
    col.transform.rotation = destination.rotation; // makes it face the correct side
    if (teleportSound){ // plays the sound effect at the destination
        AudioSource.PlayClipAtPoint(teleportSound, destination.position);
    }
}