Pool game problem - accuracy of physics engine?

Hi,

I am working on a simple Pool game using Unity. The problem is that the physics engine seems to be struggling with working with small objects.

I currently have the balls scaled to be 0.1 in the x, y and z. The problem is that they appear to slightly sink into the pool table and when I apply force to them, they move across the table and then stick to the table edges - again appearing to slightly sink into them.

Is there a problem with the physics engine getting confused with very small objects?

I originally tried using much larger objects, but they didn’t move effectively

Has anyone got any ideas?

John

Sorry - forgot to add the the balls have rigid bodies attached to them and sphere colliders with the material set to bouncy

The table top and sides ar simple boxes with box colliders attached.

If any more info is required - I would be happy to provide it.

John

Yet more info - I have tried changing the Min Penetration for Penalty figure in the Physics Engine Settings and it doesn’t make any difference.

Neither does making the bounch threshold lower. Although if I make it less than 1.4 when I apply a force to the ball to make it move, it goes flying off the table!!

Have you tweaked the time step?

Just tried the time step - unfortunately it doesn’t make a difference. The wierd thing is that even if I project a ball at an angle onto the side cushion - it still appears to stick to it, whilst sliding along the egde of it.

Does that make any sense?

I had similar problems with my dice game - I’ve created a collider larger than the visible object which creates new problems when dice (or in your case balls) are laying directly beside each other (or better will never) - I think later I switched to a combination of an higher invisible ground and made the larger colliders a little smaller than before and it was OK.

“I currently have the balls scaled to be 0.1” This scale is aplied in the import mesh settings, or in transform settings? As I remember, people ask to do this kind of adjustment in the import settings.

Hope this helps!

Are the balls imported models from a 3D package? Or are they sphere primitives created in Unity?

how they are imported and what they are is of no importance as you really want to use sphere colliders in this case as you need the mathematical precision of the sphere col collision. You can’t afford to lose it for the sake of being a magnitude slower and less precise by using mesh colliders for example :slight_smile:

My soon to be released game uses Unity physics engine with only a few minor scripts to adjust some behavior. I spent quite a bit of time tweaking settings to get reasonable performance/behaviour combination.

I’d suggest sticking some GUI elements on the screen that let you dynamically change physics/time/material/collider settings.

This way you can quickly try all kinds of settings.

Indeed! Just didn’t paid attention to that :stuck_out_tongue:

I asked how they are created, but meant to add to check that sphere colliders are being used, and to check that the colliders are the same size as the object. Highlight a ball in the Hierarchy view and look at it in the scene view. Does the highlighted collider look to match the surface of the ball?

Hi,

Thanks to everyone who has replied so far - I do appreciate the help. To update:

The balls at the moment are simple Unity game object spheres

The collider on the balls is a sphere collider

I have tried messing with the time step without it making a difference

I have tried messing with the table materials to reduce friction and increase bouncyness but this doesn’t make a difference

I tried making the balls heavier and lighter and this didn’t make a difference

I tried increasing and decreasing the size of the box collider on the table sides and this didn’t make a difference.

Any more ideas from anyone - this is driving me nuts now!

John

They are sphere primatives created un Unity

Hi!

I’ve sorted it - it was the bounce threashold in the Physics setting that was too high. I have reduced it now and it wll works as it should.

Thanks to everyone who helped.

John

John,
Thanks for posting the solution… Helped me :slight_smile:

HI, To avoid collision problem , set rigidbody Collision Detection to Continuos or Continuos Dynamic, it will overcome collision problem! [quote=“anon_70257666, post:1, topic: 416396, username:anon_70257666”]
Hi,

I am working on a simple Pool game using Unity. The problem is that the physics engine seems to be struggling with working with small objects.

I currently have the balls scaled to be 0.1 in the x, y and z. The problem is that they appear to slightly sink into the pool table and when I apply force to them, they move across the table and then stick to the table edges - again appearing to slightly sink into them.

Is there a problem with the physics engine getting confused with very small objects?

I originally tried using much larger objects, but they didn’t move effectively

Has anyone got any ideas?

John
[/quote]