Hy everybody,
In my 2D game plateform, I want to check if my player is on the ground. For this, I use this code in my FixedUpdate() method:
void FixedUpdate(){
RaycastHit2D hit=Physics2D.Raycast(transform.position,-Vector.up,velocity.y);
if(hit.collider!=null){
isGrounded=true;
}
}
As a result, the Raycast function returns my own player collider2D. I’ve tried with layers but doesn’t work (I added a tag and assigned it to the plateform, added the LayerMask.NameToLayer(“plateforms”) as an argument to my method and I had the same result).
Do you know how to send the exact Ray (what are the rights arguments of origins, direction and distance)?
Thanks in advance