Question by
EisAmStiel · Jan 08, 2021 at 12:59 PM ·
colliderraycasthitraycasthit2dedge detection
How can I check whether my Ray is hitting an edge collider or not?
I can detect if my ray is hitting a collider or not but I need to know whether it hits an edge collider in particular.
My code is:
void Update() { RaycastHit2D groundInfoPlayer = Physics2D.Raycast(groundDetectionPlayer.position, Vector2.down, distancePlayer); if(groundInfoPlayer.collider == true){ Debug.Log("Player is touching the ground");
}else{
Debug.Log("Player is not touching the ground");
}
Unfortunately, I can´t just write: if(groundInfoPlayer.Edgecollider == true){ ...}
If you have any ideas let me know. Thx.
Comment