- Home /
Jump height affected editor window size
It's come to my attention recently that my main character's jump height is drastically changed based on the screen size. What's strange to me is that no other components, like movement or dash speed/distance, seem to be affected by it. Currently, the character jumps much higher when the editor is larger, and barely hops off the ground when the window is shrunken.
I've tried with both "player.AddForce(jumpForce, ForceMode.Impulse)" and "player.velocity = jumpForce", as well as putting the calculations in both Update() and FixedUpdate(), but none of these combinations seems to fix it.
How can I fix this to get a consistent jump height regardless of screen/window size?
Is your jumpForce variable modified in any way before it's used? The first thought that comes to $$anonymous$$d is that if your window is smaller, you likely have a higher framerate, so if you're multiplying jumpForce by Time.deltaTime prior to use, a high framerate would result in a lower force applied.
As far as I can tell, it's not being modified at all. I searched for all references, and it only appears a) when it's declared, b) when it's used. I used shortened code in the main body, but the exact code for its usage is mPlayerRb.AddForce(mPlayerControls.mJumpForce * (-mPlayerControls.mGravShifter.mGravNormal), ForceMode.Impulse);
Then I assume the mGravNormal is also normalized (since you aren't normalizing it at time of use, anyway)? Other than that, the only other see$$anonymous$$gly likely factor would be if your character's Rigidbody's mass scales with screen size for some reason? (or if the camera's zoom/position scales with resolution, it could skew apparent results, too)
Answer by Lenny991 · Jun 03, 2021 at 05:19 PM
I am not a 100% sure about this, but you could try changing it to player.AddForce(jumpForce, ForceMode.Impulse); (or alternatively if it's a 2d game make it ForceMode2D.Impulse)
Ah sorry, that's my fault for not clarifying. I was using ForceMode.Impulse in the parameters. Also it's technically a 3d game (2d gameplay, 3d graphics). I'll update the original post to reflect this
Your answer
![](https://koobas.hobune.stream/wayback/20220613034524im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D 360 degress platformer example needed 0 Answers
how to stop mesh entering another mesh, both with colliders 3 Answers
Make hopping/walking with IK. 0 Answers
Rendering Wireframes of FixedJoints 0 Answers
How can the resultant velocity of an object after a potential collision be predicted? 1 Answer