(Pool/8Ball Game) Strange Elastic Collisions
So in my pool game, I'm trying to create perfectly inelastic collisions. In my scene, there's a basic setup of the pool balls shown above. A white cue ball has a script that applies a velocity onto it so that it can simulate a break shot.
What (I'm pretty sure) should happen is that when the white ball hits the front pool ball, the momentum is mostly transferred from ball to ball all the way to the back ball (shown in black). The black ball will receive most of the momentum while the other balls won't move as much.
However, what ends up happening every time, no matter what I tweak, is that every ball behind the front pool ball is hit with the same momentum, at the same time. I have no idea why this should be happening. If anyone knows how to achieve this sort of collision or if anyone knows how pool physics actually work then please let me know.
Every pool ball (including the cue ball) has a physics material with both frictions set to 0 (friction type Average) and its bounciness set to 1(bounciness type Multiply). Every pool ball's rigidbody has a mass of 20, a drag of 1, an angular drag of 1, and is set to Continuous Dynamic collision detection. The BouncinessThreshold is set to 0. The plane that the balls are rolling on doesn't have a physics material attached.
Answer by Bunny83 · Dec 15, 2019 at 09:26 PM
Uhm, why perfectly inelastic? Pool balls have an almost perfect elastic nature though I guess that's what you mean based on your images ^^.
There are several things not clear. First of all do you actually use 3d physics or 2d physics? They use completely different physics systems. You have some really strong overlaps between your balls which usually shouldn't happen. Next thing is based on your right most image it looks like you hit the first ball pretty much in the center. So of course it's energy would propergate in the same direction. Which means that it would hit the next two balls almost equally.
Finally note that PhysX (Physics) as well as Box2d (Physics2D) are just implement a rough approximation of real world physics. Any processes which happens on a microscopic level within a short time span won't be simulated "correctly" since the simulation happens at discrete timesteps. You could try boosting up the solver count in the physics settings. However it may serverely impact the performance and does not necessarily solve your issue.
I gave a similar answer about 6 years ago. However some things have changed since then. You can now drive the physics system manually doing smaller timesteps might help, however as explained it might not necessarily fix your issues.
Also check your velocity thresholds in the physics settings. Any collision below that threshold is always treated inelastic. This is to stop tiny amounts of energy to bounce endlessly between many bodies. You might want to lower them.
ps: which Unity version do you use? Unity has changed the physX version since 2018.3beta
Just to clear a point of confusion, the green arrow you see in his picture is not part of drawing, and doesn't represent the momentum applied, it's just the unity translate tool.