• 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 Spacecat · Apr 30, 2012 at 12:48 AM · collisionphysics

Physics engine does not conserve momentum on tiny objects

I've recently realized that the default 1 unit == 1 meter scale does not fit my large-scale space combat game very well, and decided to attempt to rescale everything before proceeding further. However, Unity's physics engine does not seem to approve of such tiny objects colliding.

My test case is a pair of spheres with radius = 0.0025, one stationary and the other moving toward it at 0.02 units/second. At first, I could not get them to collide properly at all, but decreasing the minimum penetration in the physics settings seems to have fixed that. Now they do collide, but both completely stop moving very soon after colliding, which looks weird and unnatural.

Is there some other setting I'm missing, or am I doing planets entirely wrong?

Comment
Add comment · Show 2
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 maroonrs2 · Apr 30, 2012 at 02:34 AM 0
Share

for the collision to work it has to be 1,1,1 with tiny objects or else it will not collide. Also it might be a scriptual error.

avatar image Spacecat · Apr 30, 2012 at 03:24 AM 0
Share

The only script in this entire project does nothing but apply a force in Start(). I'm unsure what you mean by the first part.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by aldonaletto · Apr 30, 2012 at 03:03 AM

I suspect your objects are going to bed too early: rigidbodies have a min velocity (default 0.14) below which they go sleep - velocity and angularVelocity are set to zero and the physics engine forgets about them until something awake the rigidbodies (collisions, forces applied etc.)
Since your objects got too small, the sleeping threshold became too high - you should lower rigidbody.sleepVelocity and rigidbody.sleepAngularVelocity to something well below the 0.02 velocity prior to collision.
But too small values in a physics engine may not be a good idea: many physics calculations are solved by numeric techniques, which have an intrinsic error margin - when the values are too small, they may get dangerously close to this error margin and produce weird and/or unstable results. Based only in my engineer feeling, I usually avoid using values lower than 0.01 for things like mass, velocity, forces etc. - the numeric error margins and the limited float precision (about 7 digits) may cause severe errors during internal calculations.
Due to these reasons, I think it would be better to increase the scale - too huge objects seem to produce less headaches than too small ones.

Comment
Add comment · Show 2 · 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 Spacecat · Apr 30, 2012 at 03:31 AM 0
Share

Decreasing the sleep velocities to 1e-6 does not seem to solve the problem.

I had not considered the potential errors from values that are too small, but I'm not really sure what else to do. Is there some other way to have huge objects (planets, moons) near small objects (one-person space fighters)?

avatar image aldonaletto · Apr 30, 2012 at 03:58 AM 0
Share

You can't follow the huge planetary scales - moon mass, for instance, is about 7E18 $$anonymous$$g! I would "compress" this variation to something more usable: use 100000 for the biggest mass, and 1 for the space fighter, for instance. If you want to calculate gravity forces according to the Newton laws, use a bigger gravitational constant (the actual one is good for planetary scale, not for in game simulation) - take a look at the question http://answers.unity3d.com/questions/196749/objects-acting-under-each-others-gravity.html

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.

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Collision impact force 1 Answer

I want my Player to have collision physics 1 Answer

How may I observe expected physical interactions while using Rigidbody.MoveRotation()? 1 Answer

OnCollisionStay stops firing after a second or two? 2 Answers

Keep rotation when changing parent in Unity 3D 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