Fixed leaves blocking raycast

This commit is contained in:
DraiRuben 2026-05-22 13:58:46 +02:00
parent 57c115e2ee
commit 301c3cde23

View File

@ -14,6 +14,13 @@ public class LeavesHiding : MonoBehaviour
static RPGController player = null;
static new Camera camera = null;
static int ignoreRaycastLayer = -1;
private void Awake()
{
if (ignoreRaycastLayer == -1)
ignoreRaycastLayer = LayerMask.NameToLayer("Ignore Raycast");
}
void Start()
{
@ -81,6 +88,9 @@ public class LeavesHiding : MonoBehaviour
if (!player || !camera)
return;
if (gameObject.layer != ignoreRaycastLayer)
gameObject.layer = ignoreRaycastLayer;
Vector3 playerPos = player.transform.position + Vector3.up;
Vector3 cameraPos = camera.transform.position;