Like the box collider is not active or exist. I added a box collider on the left soldier.
I’m using firstpersoncontroller and firstpersoncharacter as player but i can move through the soldier and when the mouse cursor is over the soldier it’s not detecting it as “Interactable” object.
The only object that is detecting is the door behind the soldiers. Any other objects are not detecting using the ray cast. So i added a box collider to the soldier for testing but it’s not working.
Can’t figure out why only the door is detecting.
using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraRaycast : MonoBehaviour { Ray ray; RaycastHit hit; void Update() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, 1000)) { if (hit.transform.tag == "Interactable") { print("Hitted on: " + hit.transform.name); } } } }