I'm a complete beginner in Unity 3D, and I'm following a video training. In the video the instructor uses the following code to open a door using raycast:
using UnityEngine; using System.Collections; public class HelloRaycasting : MonoBehaviour { bool doorClosed = true; // Use this for initialization void Start () { } // Update is called once per frame void Update () { Vector3 backward = new Vector3 ( 0, 0, -1); Vector3 origin = this.gameObject.transform.position; if (Physics.Raycast( origin, backward, 1f) && doorClosed) { doorClosed = false; GameObject.Find ("Left_Quad").transform.Translate ( new Vector3(-.8f, 0, 0)); GameObject.Find ("Right_Quad").transform.Translate ( new Vector3(.8f, 0, 0)); } } } It works just fine for him. But when I try to run this on my computer I get this error:
Assets/HelloRaycasting.cs(20,29): error CS0117: 'Physics' does not contain a definition for 'Raycast'
In the end I'm not able to access none of the properties and methods of the Physics class.
I'm using Unity 5.3.2f1 (64-bit). What am I doing wrong?