I’ve posted about this before, but I couldn’t find any help. I run into this problem every single time I use Unity physics to jump, so I don’t understand why I can’t seem to find anyone experiencing the same thing. I don’t know what I’m doing wrong.
The players presses a button, in my current case he touches his screen. A positive y impulse force is applied to the player object and it hops into the air. I do this in FixedUpdate. When the player returns to the platform he jumped off of, they can jump again. But sometimes it’s a little jump, and sometimes it’s a big jump. There’s only one jump force, and it is not modified by anything. My code is quite simple, and the player object doesn’t do anything but jump and move downward with Unity gravity.
I have only one theory. I think that the current vertical velocity at the time of jumping is affecting the jump. The reason I think this is because if I print the vertical velocity of my player object to the console and step through my game one frame at a time, the vertical velocity is never exactly zero, even while seemingly still on the y axis, chilling on a platform…Probably because the platform is moving constantly, but I’ve also had the player object moving constantly before and had an identical problem. But I don’t know what to do about it. I just had the idea while writing this to manually set the vertical velocity to zero before the jump, but that didn’t work.