- Home /
Jump heights are different on different devices
I'm creating a simple 3D game where the user touches the screen and it causes the character to jump. I've been testing on an android HTC One with a res of 1920 x 1080. Everything works fine. I've made adjustments so that the character jumps to the right height. But, when testing on lower resolution android phones and even iphones, the character jumps a lot higher. Is there a way to determine the correct force to apply for different screen resolutions? And I'm assuming its because the resolution here.
Here is my code:
void Update () {
if(touchingPlatform){
if(Input.GetButtonDown("Jump")){
rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
this.GetComponent<AudioSource>().Play();
}
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {
rigidbody.AddForce(jumpVelocity, ForceMode.VelocityChange);
this.GetComponent<AudioSource>().Play();
}
if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); }
}
}
and in my fixedUpdate I have this:
void FixedUpdate () {
// continously move
transform.Translate(moveSpeed * Time.deltaTime, 0f, 0f);
}
Thanks
it doesn't actually jump higher, it looks like it because of the lower resolution. If you map 1080 pixels in like 4/5 inches, everything looks smaller as compared to, say, 540 or 420 pixels in same 4/5 inches. So when you have a jump height of 3 units, it will look bigger on low-res phones compared to HTC One, which has a beast of the resolution for it's screen. :P
So is the best approach to ask for screen height and make an approximation as to how many units to apply based on certain heights?
rather you should ask for screen resolution and then based on that, zoom out the camera on lower resolution phones so that you won't loose quality of rendering.
That makes more sense. Thanks for your help. That should also help with the sides being cut-off - great.
Your answer
Follow this Question
Related Questions
GameObject get launched underneath the terrain when using AddForce 0 Answers
How do I downsize all textures for mobile version? 3 Answers
Developing on multiple resolutions 1 Answer
How can i make my game look better on unity remote 4? 2 Answers
Is there a way to scale the 2:3 resolution to the 480:800? 0 Answers