I spent more time than I'd like to admit making the models shown in the video. The code I wrote to make the effect work is actually quite simplistic. I've added it below:
using UnityEngine;
public class DynamicTeleport : MonoBehaviour {
public GameObject player;
public Transform target;
void OnTriggerEnter(Collider other)
{
Vector3 offset = new Vector3(transform.position.x - player.transform.position.x, transform.position.y - player.transform.position.y, transform.position.z - player.transform.position.z); //get player's offset from the center of the trigger volume
player.transform.position = target.position - offset; //subtract the offset from the target position, giving us the player's true position relative to the trigger volume.
}
}
The music used was "Snack Time" found in the KZitem audio library.
#GameDeveloper #Surreal #Dream #Nightmare #nyctophobia
Негізгі бет Turning around to see the room changed behind you...
Пікірлер: 3