private void CheckGround() { if (!isGrounded && Physics.Raycast(transform.position, -transform.up, checkGroundDistance)) { OnLanded?.Invoke(); } isGrounded = Physics.Raycast(transform.position, -transform.up, checkGroundDistance); }
private void CheckGround() { bool tmpLanded = Physics.Raycast(transform.position, -transform.up, checkGroundDownDistance); if (!isGrounded && tmpLanded) { OnLanded?.Invoke(); } if (isGrounded && !tmpLanded) { OnLeftGround?.Invoke(); } isGrounded = tmpLanded; }