can i ask you something more since you are here?
it’s been half an hour i’m trying to implement the ability to jump when i am on a ladder, but i cannot understand why it doesn’t work
this is the simple method for the ladder
private void ClimbLadder()
{
if (!myBodycollider.IsTouchingLayers(LayerMask.GetMask("Climbing")))
{
rb.gravityScale = gravityScaleAtStart;
return;
}
Vector2 climbVelocity = new Vector2(rb.velocity.x, controlThrow * climbingSpeed);
rb.velocity = climbVelocity;
rb.gravityScale = 0;
}
the jump is above as you already have seen,
i tried to add in the ladder method something like this
if (myBodycollider.IsTouchingLayers(LayerMask.GetMask("Climbing")) && checkjump)
{
Debug.Log("touching and jumpinh");
rb.gravityScale = gravityScaleAtStart;
rb.velocity = Vector2.zero;
Vector2 jumpVelocityToAdd = new Vector2(0f, jumpSpeed);
rb.velocity += jumpVelocityToAdd;
}
the debug.log is shown when i am on a ladder and press W or Space but nothing happens