1
\$\begingroup\$

So guys ive edited the question and here is what my problem is i have a player which has a rigidbody2d attached to it.my player is able to doublejump in the air nicely and stick to walls when colliding with them and slowly slides to the ground.All movement is handle through physics and no transform manipulations.here i did something similar to this in the FixedUpdate of my player.

    void FixedUpdate()
    {
     if(wall && Input.GetButtonDown("Jump"))
      {
       if(facingright)//player is facing the left side of the wall
        {
         rigidbody2D.Addforce(new vector2(-1f,2f)*jumpforce);
         /*Now the player should jump backwards following this directional vector and
   should follow a smooth curve which in this part works well*/
        }
       else
       {
        rigidbody2D.Addforce(new vector2(1f,2f)*jumpforce);
        /*Now this is where everything gets complicated as you should have noticed
          this is the same directional vector only the opposite x axis value 
        and the same amount of force is used but it behaves like the red curve 
        in the  picture below*/
       }
      }
    }

bad behaviour and vector in red

.I tested the same thing(both addforce methods) for a simple jump and they exactly behave like mentionned above in the picture.so here is my problem.Jumping diagonally forward with rigidbody2d.addforce() do not have the same impact,do not follow the same curve as jumping the opposite direction with the same exact amount of force.if i could fix this or get past this i could implement a walljump system like a ninja jumping in zigzag between two opposite wall to climb them.Any ideas or alternatives?

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.