#Jumping problem 2
1 messages · Page 1 of 1 (latest)
Well I can say that the jump count never gets reset, does ```cs
if(isGrounded && velocity.y < 0)
{
velocity.y = -2f;
jumpCount = 0f;
}
no it doesnt
because this doesnt work ```csharp
void OnControllerColliderHit(ControllerColliderHit hit)
{
if(hit.normal.y > 0.1)
{
isGrounded = true;
Debug.Log("Grounded");
}
else
{
isGrounded = false;
Debug.Log("Not Grounded");
}
if(hit.gameObject.CompareTag("WallJump") && !isGrounded)
{
fallingGravity = 1f;
velocity.y = -1f;
jumpCount = 1f;
Debug.DrawRay(hit.point, hit.normal, Color.red, 1.25f);
}
}
I used pc.isGrounded
before
Also double check that the Debug.Log() statements that are displaying wether or not you are grounded display at the correct times
But its kinda buggy
?
Like when you are grounded does the “Grounded” display
And vice versa
if(hit.normal.y > 0.1)
{
isGrounded = true;
Debug.Log("Grounded");
}
else
{
isGrounded = false;
Debug.Log("Not Grounded");
}
Does this work correctly
well it says Grounded
but when I jump
it still says grounded
but when I touch a wall jumpable wall
WAIT
I think I know why
how do I check if the player is not touching anything?
Ur always above 0.1
If you are jumping, your y is going up
You are checking if its > 0.1
It always will be
Oh
Its hit.normal
wait what?
yes