• 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 /
This question was closed May 11, 2015 at 07:45 PM by AlwaysSunny for the following reason:

Question closed. This shouldn't have been resurrected to begin with.

avatar image
14
Question by Ehren · Jan 11, 2010 at 04:26 PM · physicsrigidbody

Limiting rigidbody velocity

When working with non-kinematic rigidbodies (especially bouncy ones), there can be situations where collisions with static colliders and other rigidbodies result in large increases in velocity. This can lead to undesirable effects, such as objects suddenly "teleporting" to random parts of the screen or breaking through static collider scenery.

What's the best way to limit the velocity of a non-kinematic rigidbody?

Comment
Add comment · Show 1
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 dingben · Sep 17, 2010 at 07:38 AM 0
Share

Could someone take a look at my post and let me know if this thread is really one and the same issue? You only mention collisions with known objects in this thread... in my scenario I have no collisions with known objects except, if any, the terrain itself... and also do see in my post that it happens while vehicle is at complete idle. http://answers.unity3d.com/questions/20456/terrain-unexpected-collisions-loopidy-loops

7 Replies

  • Sort: 
avatar image
0

Answer by Quassanex · May 05, 2015 at 03:30 AM

the best way to keep velocity constant i have found is:

     void FixedUpdate () {
             if (thisRigid.velocity.magnitude > maxVelocityMagnitude) {
                 float x = thisRigid.velocity.magnitude / maxVelocityMagnitude; 
                 thisRigid.velocity /= x;
             }
         }
     
 
 

First, see how much has the velocity increased compared to maxVelocity. Then divide the actual vector velocity by this number to get back instantly to maxVelocity.

Note: the relation between velocity and rigidbody2D.velocity.magnitude is 1/50 (magnit = vel/50).

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

Answer by Squarefish · May 11, 2015 at 07:43 PM

I down-voted the last comment.

Rigidbody travelling at a Vector3 velocity

const float max floatVelocity; Vector3 vector3Velocity;

Usually you look at the rigidBody in question to see why the velocity's maximum is set very high. Does it need a limit function, or velocity maximum?

a) If this limit function is required, use Unity Behaviour as a helper.

if (NormalisedToFloat (vector3Velocity) > maxfloatVelocity)

rigidbody.drag = dragAmount;

Comment
Add comment · 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
  • ‹
  • 1
  • 2

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

19 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

Related Questions

How to make Rigidbody.AddForce less delayed in Unity3D? 0 Answers

How can I constrain physics in all directions except one? 2 Answers

Avoid bouncing when ground move down 1 Answer

How do you attach moving parts (moved by physics) to an animated character? (Secondary Animations) 1 Answer

Earth quake with physics? 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