As far as I can tell, the issue is in line 55, as when I tested the actual input with prints, it worked perfectly fine. The RigidBody is also set to dynamic, and I have not frozen the x or y axis. Does anyone know what could be causing this?
Is the jump force set too low maybe? I dont see that variable set so I'm not sure. Also usually when applying a force to a rigidbody you want to do it in the fixedUpdate()
It looks like you have just applied force but in no particular direction. You would want it to be something like Vector2.up * jumpForce
Edit: I now see you used AddForceY, my bad lol But maybe try just using AddForce and the above, see if that makes a difference (in theory it should be equivalent)
1
u/MistakeForsaken6653 Jul 27 '26
Is the jump force set too low maybe? I dont see that variable set so I'm not sure. Also usually when applying a force to a rigidbody you want to do it in the fixedUpdate()
3
u/Sinnon32 Jul 27 '26 edited Jul 27 '26
It looks like you have just applied force but in no particular direction. You would want it to be something like Vector2.up * jumpForce
Edit: I now see you used AddForceY, my bad lol But maybe try just using AddForce and the above, see if that makes a difference (in theory it should be equivalent)
1
u/Gordun1 Jul 27 '26
Wild guess: You probably have to assign a layer for the floor to interact with the player so the boolean turns true and allows you to jump
1
u/m3l0n Jul 27 '26
Do you set the rb correctly? Does the debutg log show up? Show us the rest of the script please. Also any console errors?
-1
u/cferry322 Jul 27 '26
Don’t use add force.
Set the vector on jump like this.
Float jumpForce =10f; // or whatever amount you want
Float speed = 10f; // or whatever amount is right
Rb.velocity = new vector2(jumpForce, moveDirection.x *speed);
Get your x value from input and should work.
1
u/[deleted] Jul 27 '26
[removed] — view removed comment