Quantcast
Channel: Answers by "hoekkii"
Viewing all articles
Browse latest Browse all 26

Answer by hoekkii

$
0
0
What is happening now, is that the raycast detects de player itsself, so it is always grounded. So you need to add a LayerMask, so the raycast doesn't detect the player. After adding this it looks like this: /*Code*/ public LayerMask layerMask; /*Code*/ void FixedUpdate() { RaycastHit2D hit = Physics2D.Raycast(transform.position, -Vector2.up, 0.5f, layerMask); grounded = hit.collider != null; } In the editor set the player to another layer (just add new layer "Player" or something) and go to the layermask and select all except the "Player" layermask.

Viewing all articles
Browse latest Browse all 26

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>