• 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 VivekD · Apr 22, 2013 at 03:21 PM · collisionphysics

Inconsistent Spherical Collisions

Hi guys, I am currently working on a Snooker game and had an issue with the point of contacts when the collisions were occurring.

alt text

As you can see I am sphere-casting in the direction of my cue and drawing a ghost ball at the intended point of contact between the cue ball and the colored ball.

alt text

However as seen in screen # 2 the cue ball enters OnCollisionEnter before reaching this position( sometimes it overshoots and merges into the colored ball before entering OnCollisionEnter). This causes the colored ball to go into a completely different direction than what my sphere-cast predicts. To avoid this, I entered my own physics code once the cue ball enters OnCollisionExit with the target colored ball.

However, this causes a lot of issues in the aftermath. For one, the collision looks extremely fake and the resultant collision momentum doesn't look good either. I would really prefer unity's own physics engine to calculate and perform these collisions perfectly.

I have already tried changing physics timestep as well as the maximum allowed timestep. Is there any other solution or technique that I haven't tried yet?

Thanks!

screen1.png (263.3 kB)
screen1.png (263.3 kB)
screen2.png (258.6 kB)
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 Bunny83 · Apr 22, 2013 at 03:46 PM 1
Share

"changing physics timestep" by what value? If you want to reliably simulate a snooker game you either should calculate it yourself, or increase the FixedUpdate by a factor of 100 or more. You could try to let the physics engine "precalculate" the whole situation on an off-screen version of your table and record the results. When it's done just replay what happens. That way you can use a very low fixed timestep. However that might result in a noticable delay.

The physics calculation will never be "correct", because it's just a simulation at discrete time intervals. Collisions are only detected when objects "overlap". how much they overlap from one frame to another depends on the frame rate. That's the the result is always frame-rate dependent.

Btw, try to increase the "solver count" as well

avatar image PlanetTimmy · Apr 22, 2013 at 04:25 PM 0
Share

I would suggest you write the snooker ball physics yourself as it'll be entirely under your control. Snooker is sufficiently simple that writing a physics simulation for it isn't a huge undertaking, and there seem to be a lot of resources on the web that could help you, for instance:

http://archive.ncsa.illinois.edu/Classes/$$anonymous$$ATH198/townsend/math.html

I think the basic approach would be to analytically deter$$anonymous$$e the time at which the two balls are one ball's diameter apart; this will give you the exact collision time.

In each timestep you'd ignore any collisions that happened further than that timestep in the future; if you used a fixed update, you could apply friction from the table only at the beginning of each timestep, assu$$anonymous$$g that for collision purposes, during that timestep the velocity of moving balls remains constant.

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.

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

13 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

Related Questions

Rigidbodies won't collide if mass difference is too high 0 Answers

Detailed terrain mesh collision 1 Answer

Problem with custom raycast2D collision detection system. 1 Answer

Character Controller meets Rigidbody 1 Answer

How to get collisions on Character controller? 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