I'm trying to make a relatively simple elevator (which essentially teleports the player), but I don't want it to instantly teleport them. I want the player to enter the collider, wait 2-3 seconds, and then do it to take make it seem somewhat more natural.
My code thus far:
using UnityEngine;
using System.Collections;
public class Teleporter : MonoBehaviour
{
public GameObject TeleportTo;
//public Material NewSkybox;
void TimerInvoke()
{
}
void OnTriggerEnter(Collider other)
{
Vector3 displacement = other.transform.position - this.transform.position;
other.transform.position = TeleportTo.transform.position;
other.transform.position += displacement;
//RenderSettings.skybox = NewSkybox;
}
}
Also if possible I'd like to stray away from coroutines. How should I do this?
No comments:
Post a Comment