#all methods called in FixedUpdate

1 messages · Page 1 of 1 (latest)

outer plank
limpid ivy
#

yoo

outer plank
#

Jump is boosted anyone have a idea why ?

#

hey

limpid ivy
#

why multiply mewVelocity.x?

#

Are you using character controller?

outer plank
limpid ivy
#

ok

#

well do rb.velocity += Vector3.up * value;

outer plank
#

I will try

#

in jump method ?

#

I replace "getRigidbody2D().AddForce(newForce, ForceMode2D.Impulse);" with "rb.velocity += Vector3.up * value;" ?

limpid ivy
#

yeah try it

outer plank
limpid ivy
#

Figure out if there's another function interfering with this. This is a typical debugging procedure

outer plank
#

I will see

limpid ivy
#

Just remove certain functions which you think can be having an effect

#

I don't understand the if(getIsJumping())

outer plank
#

Ok

#

it's just a method that check if player is jumping

limpid ivy
#

But you're setting a new velocity after that?

outer plank
#

  protected override void jump()
    {
        if (canJump && controller.currentInput.yMovement > 0)
        {

            canJump = false;
            isJumping = true;
           
            //getRigidbody2D().velocity = Vector2.zero;

            //newForce.Set(0, (float)getEntityAttribute().getAttribute(SharedAttributes.JUMP_STRENGTH.getName()).getDefaultValue());
            //getRigidbody2D().AddForce(newForce, ForceMode2D.Impulse);

            getRigidbody2D().velocity = Vector3.up * 70;
        }
    }

``` no I use it here
limpid ivy
#

use += not just =

outer plank
#

Oh well seen

limpid ivy
#

Did it work

outer plank
#

I can't use += in vector

limpid ivy
#

Use GetComponent<Rigidbody2d>().velocity +=

#

Hold on

visual trail
#

like the error mentions, you're trying to give a vector3 to a vector2
try Vector2.up instead

limpid ivy
#

Yeah that's it

#

I was just searching if you can still do velocity += in 2d rigidbodies

outer plank
#

ok I see

#

+= work now but there is the same problem

limpid ivy
#

Remove all functions that move your character but this Jump() one

#

See if it changes

outer plank
#

Ok