diff --git a/Assets/Scripts/GrappleHook.cs b/Assets/Scripts/GrappleHook.cs index ddb7e98..87a7160 100644 --- a/Assets/Scripts/GrappleHook.cs +++ b/Assets/Scripts/GrappleHook.cs @@ -91,15 +91,27 @@ public class GrappleHook : MonoBehaviour if(!hitMarkerRect.gameObject.activeSelf)hitMarkerRect.gameObject.SetActive(true); hitMarkerRect.anchoredPosition = WorldToUI(gameObject.transform.position + aimDir * maxGrappleDist); - if(Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)){ - hitMarkerRect.anchoredPosition = WorldToUI(hit.point); - hitMarkerRect.gameObject.GetComponent().color = Color.green; - - if(grappling){ - StartGrapple(hit); - }else{ - grappling = false; + if (Physics.Raycast(gameObject.transform.position, aimDir, out hit, maxGrappleDist, grappleableLayer)) { + if (hit.transform.gameObject.layer != 7) + { + hitMarkerRect.anchoredPosition = WorldToUI(hit.point); + hitMarkerRect.gameObject.GetComponent().color = Color.green; + + if (grappling) + { + StartGrapple(hit); + } + else + { + grappling = false; + } } + else + { + hitMarkerRect.anchoredPosition = WorldToUI(hit.point); + hitMarkerRect.gameObject.GetComponent().color = Color.red; + } + }else{ hitMarkerRect.gameObject.GetComponent().color = Color.red; }