I want to detect and generate an event if the camera is touching a game object in first-person view. (for example, if I moved the camera and it hit cube) it should play audio.
Hi! Just put a box collider (or any type of collider really) onto your camera. Then you can put a script onto your camera which will test if it’s intersecting other colliders.
void OnCollisionEnter(Collision collision) { if (collision.gameObject.name == "MyGameObjectName") { Debug.Log("Do something here"); } }
P.S depending on whether or not you want to allow you camera to go through objects, you may want to switch the camera collider to IsTrigger and check for OnTriggerEnter.