Search Unity

Physics Material 2D problem

Discussion in 'Physics' started by GreatGardna, Sep 9, 2020.

  1. GreatGardna

    GreatGardna

    Joined:
    Jan 9, 2020
    Posts:
    14
    Hello guys, I'm developing a game project after my work hours.

    I added a NoFriction Physics2D material to prevent the character from wall jumping. But after adding the material, the physics in my character isn't working well.

    Here are some samples, the first gif is without the material, while the 2nd is the one that I applied.

    https://imgur.com/a/jgDOIfJ

    https://imgur.com/a/DSKW7rp

    I tried tweaking the code but I couldn't make it work.
    Code (CSharp):
    1. f (collision.tag == "Hitbox")
    2.         {
    3.          
    4.             state = State.hurt;
    5.             baRigidBody.velocity = new Vector2(-hurtForce, baRigidBody.velocity.y);
    6.            // baRigidBody.AddForce(transform.right * -hurtForce, ForceMode2D.Impulse);
    7.         }
    Thanks in advance.