#Player Controller Jumping
1 messages · Page 1 of 1 (latest)
Ideally it would be a downward force (not impulse) that is applied during the whole jump. Im guessing it feels weird as this impulse force is suddenly applied when the player velocity is not +y anymore.
I did try using ForceMode.Force at first but it seemed really slow Ill try using it again at a higher number and see how to add the debug stevesmith mentioned
A good approach is a large jump inpulse to start. Then the force being applied to push them down takes a bit to take effect and will cause then to slow down and go to the ground faster than just gravity.
Player Controller Jumping
The force is working but its weird... idk if its because FixedUpdate() is on a timed interval and Im catching it in different stages but sometimes i can jump really high other times not so much
In the first screenshot I was able to build up to -8 because I got a high jump and in the 2nd only -4
Are you still doing the same logic where you apply forces only after some velocity is reached?
I usually achieve a decent jump with a good mass value +drag and a tuned impulse jump value that matches
Oh I see, yeah I still had the same logic. I read that touching mass would create problems if the lowest and highest mass were too far apart so I never touched them but I’ll try it out
I see mass limits the jump height but I still have the same problem with the heights being different for some reason. I did comment out where this function is being called as well so I dont understand
If anyone reads this in the future, the problem was PlayerInput() was being called in Update() so it would be called every frame. It would be called multiple times before isGrounded turned to false causing the player to stack up jump height depending on the framerate. I fixed it by switching from Input.GetKey(jumpKey) to Input.GetKeyDown(jumpKey)
horiSen = Input.GetAxisRaw("Horizontal");
vertSens = Input.GetAxisRaw("Vertical");
if(Input.GetKeyDown(jumpKey)&&isGrounded){
Jump();
}
}```