Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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
2
Question by pAWNproductions · Jun 02, 2021 at 10:06 PM · physicseditorwindowscreen size

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?

Comment
Add comment · Show 6
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 logicandchaos · Jun 03, 2021 at 01:51 PM 0
Share

need to see your jump code.

avatar image Eno-Khaon · Jun 03, 2021 at 07:29 PM 0
Share

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.

avatar image pAWNproductions Eno-Khaon · Jun 03, 2021 at 08:16 PM 0
Share

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);

avatar image Eno-Khaon pAWNproductions · Jun 03, 2021 at 09:09 PM 0
Share

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)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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)

Comment
Add comment · Show 1 · Share
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 pAWNproductions · Jun 03, 2021 at 07:14 PM 0
Share

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

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

201 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 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 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 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 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 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 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

2D 360 degress platformer example needed 0 Answers

Unity 3D my ball won't roll on a Blender made model 2 Answers

Animate physics not doing anything 0 Answers

Edit this script so that on the second jump change the gravity to 5 2 Answers

Unity (ECS & DOTS) Entity Sinking 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