Quantcast
Channel: Questions in topic: "error message"
Viewing all articles
Browse latest Browse all 2891

How would I make CAM = to the Main Camera without getting errors? Im trying to use a ray/cast for interacting.

$
0
0
It sort of works but apparently im missing a ";", which isn't the problem. My Code: \/\/\/ using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerInteract : MonoBehaviour { private Camera cam; [SerializeField] private float distance = 3f; // Start is called before the first frame update void Start() { *cam = Main Camera;* <<< // Help // } // Update is called once per frame void Update() { // Create a ray at the center of the camera, shooting outwards. Ray ray = new Ray(cam.transform.position, cam.transform.forward); Debug.DrawRay(ray.origin, ray.direction * distance); } }

Viewing all articles
Browse latest Browse all 2891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>