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 luniac · Jun 29, 2012 at 05:10 AM · rigidbodydragclampair

Controlling velocity of rigidbody in air

Okay im a little stumped here. Basically i have a rigidbody that has a certain constant drag when in contact with floor. When it loses contact with the floor and is now in the "air", i set the drag to ".1", essentially 0. I do this because the ground drag is around 2.5 or so, which means that if the rigidbody is in the air, it would float down very slowly and unrealistically. By setting drag to .1 or 0, i get a proper falling object.

My problem is that since i control my rigidbody using addforce(), when the object enters the air while moving a certain direction, if i keep holding the movement key corresponding to that direction, the object will continue to speed up more and more. The speed up is unsatisfactory even if i lower addforce() when the rigidbody is in the air, which i did.

The reason i dont make addforce() very low or turn it off altogether when the rigidbody is in the air, is because i want to give the player a chance to adjust the position of rigidbody while it's in the air.

So what i want to do is essentially set a max X and Z velocity that the rigidbody can reach while in the air without clamping the velocity which i hear is bad practice when it comes to the physics engine. I was thinking of increasing drag to a point where the velocity won't increase past a certain point, but then the Y direction of the rigidbody is affected by drag as well, which is something i want to avoid.

I can think of one particular solution, where i manually check the velocity in the X and Z directions every frame while the object is in the air, and if it's past a certain velocity, then i can turn off the movement controls in that particular direction until the velocity goes below the threshold. This way i never manually mess around with the velocities.

I was wondering if there's a more elegant solution to my problem that some genius here can think of :)? thanks.

Comment
Add comment
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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to Stop a Game Object from Passing through a Collider while it's being Dragged? 3 Answers

Drag Rigidbody 2 Answers

How do i Clamp the Z position of a rigidbody? 1 Answer

Moving a rigidbody onto exact mouse position using rigidbody.MovePosition? 1 Answer

What would be a good physics model model for 2d ship? 1 Answer


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