Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jay1davis · Jun 05, 2013 at 02:21 AM · androidresolutionaddforcejumping

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

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image fueldown · Jun 05, 2013 at 03:23 AM 0
Share

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

avatar image jay1davis · Jun 05, 2013 at 01:45 PM 0
Share

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?

avatar image fueldown · Jun 05, 2013 at 05:21 PM 0
Share

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.

avatar image jay1davis · Jun 05, 2013 at 07:10 PM 0
Share

That makes more sense. Thanks for your help. That should also help with the sides being cut-off - great.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges