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 kobyfr · Oct 23, 2020 at 11:11 AM · physics2dsimulationmomentumaccuracy

elastic collision simulation loses 400 kgm/s momentum in a few hours

I have made a 2D simulation of 20 balls enclosed within 4 walls, each with a velocity magnitude of 20 units/s, each with a mass of 1. all rigidbodies and colliders are elastic - 0 for friction, 1for bounce.

Initial conditions

  • The velocity sum along the x axis is 240.

  • The velocity sum along the y axis is 160.

  • The sum of |V|*m was 400 (20*20) at start, and I continuously printed that sum on screen, while the balls went on colliding within these 4 walls.

During runtime

  • after 1 second : sum = 360

  • after 10 minutes : sum = 250

  • after 4 hours : sum = 0

Motivation

Why did I do this simulation? because the ball in my arkanoid-style game loses speed over time, and I wanted to find out why. Is this due to the physics engine? shouldn't I rely on it to be accurate enough for at least a few minutes, without a need for runtime-corrections-by-code?

I know this sum does not represent how conservation of momentum works, but I start with non-zero momentum on both axis, so the simulation should not never get to 0 speed for all 20 balls.

[1]: /storage/temp/169702-untitled.jpg

untitled.jpg (361.5 kB)
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 kobyfr · Oct 23, 2020 at 12:54 PM 0
Share

Switch to calculating kinetic energy (0.5 m v^2) instead of momentum. found that the kinetic energy is not constant. After a few seconds, it is reduced from 4000 (0.5 20 400) to 3991.1, then it rises above 4000 to 4235, and simply is not constant as physics mandates. I aught to add that 1. the balls in the simulation have their Z rotation frozen 2. all objects (walls, balls) have interpolation active, and collision detection is set to "continuous".

1 Reply

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

Answer by kobyfr · Oct 23, 2020 at 12:03 PM

Is it possible to modify the parameters in "Physics 2D" to achieve a more accurate simulation?

physics 2D offset


untitled.jpg (71.4 kB)
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 kobyfr · Oct 23, 2020 at 01:49 PM 0
Share

yep, setting velocity threshold from 1 to 0.0001, get's the job done, and reduces the energy loss to a $$anonymous$$imum.

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

140 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

Related Questions

What is the best way to implement physic simulation prediction for AI in Unity? 1 Answer

Is there a way to create water like behavior. 0 Answers

2D physics, animation-controlled kinematic colliders not affecting momentum 1 Answer

Break 2d joint? 1 Answer

Physics2D simulation is not taking into acount the material's Friction 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