Fixed leaves blocking raycast
This commit is contained in:
parent
57c115e2ee
commit
301c3cde23
@ -14,6 +14,13 @@ public class LeavesHiding : MonoBehaviour
|
|||||||
|
|
||||||
static RPGController player = null;
|
static RPGController player = null;
|
||||||
static new Camera camera = null;
|
static new Camera camera = null;
|
||||||
|
static int ignoreRaycastLayer = -1;
|
||||||
|
|
||||||
|
private void Awake()
|
||||||
|
{
|
||||||
|
if (ignoreRaycastLayer == -1)
|
||||||
|
ignoreRaycastLayer = LayerMask.NameToLayer("Ignore Raycast");
|
||||||
|
}
|
||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
@ -81,6 +88,9 @@ public class LeavesHiding : MonoBehaviour
|
|||||||
if (!player || !camera)
|
if (!player || !camera)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (gameObject.layer != ignoreRaycastLayer)
|
||||||
|
gameObject.layer = ignoreRaycastLayer;
|
||||||
|
|
||||||
Vector3 playerPos = player.transform.position + Vector3.up;
|
Vector3 playerPos = player.transform.position + Vector3.up;
|
||||||
Vector3 cameraPos = camera.transform.position;
|
Vector3 cameraPos = camera.transform.position;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user