Rotation to teleport
Hey everyone,
I'm back again with another problem (seriously, I'm the LAST person on earth who should be programming). Essentially, I'm trying to teleport the player when they rotate on a teleportation pad (think Star Trek). However, I'm trying to get information from the first person camera and I can't quite get it to work.
Apparently
I'm back again with another problem (seriously, I'm the LAST person on earth who should be programming). Essentially, I'm trying to teleport the player when they rotate on a teleportation pad (think Star Trek). However, I'm trying to get information from the first person camera and I can't quite get it to work.
using UnityEngine;
using System.Collections;
using UnityEngine.VR;
public class RotateTeleporter : MonoBehaviour {
private bool playerInTeleporter;
private float playerInitialDirection;
Camera mycamera;
// Use this for initialization
void Start () {
playerInTeleporter = false;
playerInitialDirection = 0;
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter (Collider trig){
playerInitialDirection = GameObject.Find("FirstPersonCharacter").camera.transform.eulerAngles.x;
playerInTeleporter = true;
}
}
Apparently
playerInitialDirection = GameObject.Find("FirstPersonCharacter").camera.transform.eulerAngles.x; is outdated according to Unity. How should I write this? All I'm trying to do is teleport the player when they're on the pad and then rotate 180 degrees. Thanks!