I am currently building a little 2D platformer with a character that can jump. This is how the jumping looks (FixedUpdate):
if (jump)
{
if (isGrounded)
{
isGrounded = false;
rb.AddForce(Vector2.up * (jumpHeight * counterForJumpHeight) * Time.deltaTime, ForceMode2D.Impulse);
jump = false;
anim.SetBool("bool_anim_isJumping", true);
}
if (timer != null)
timer.Stop();
counterForJumpHeight = jumpMulitMin;
jumpAlreadCharging = false;
}
Looks perfect for every jump up and then falling back down.
HOWEVER: when the player JUST falls (like off a cliff oder something) without a jump it looks like he has the mass of a leaf. Sailing to the ground extremley slowly. Not accelerating at all. Just falling as in slow motion. Of course I can up the gravity, but that also affects the falling AFTER my jump and makes him look like a stone. As if the falling is sped up or something. But that doesnt make sense. Him falling AFTER a jump and him just falling off of something SHOULD look the same, right? But it doesnt.
These are my values for the RB:
it was all my fault, there was no way of guessing it from your point of view. Everything the player could jump from was tagged with "can_jump".
void OnCollisionEnter2D(Collision2D col)
{
if (col.gameObject.tag == "can_jump") // detect collision with ground game object
{
isGrounded = true;
deacceleratePerFrame = 1.5f;
anim.SetBool("bool_anim_isJumping", false);
}
}
This includes all edges. Removing this means I cannot jump atm anymore, however this caused the issue. I sure find another way :-) thank you all