2
\$\begingroup\$

I want to create a pool game using Unity.

  1. I added the spheres as playballs and cubes as the walls.
  2. I added a rigidbody to all objects and Im able to do some basic collisions like in a pool game.

My Question is:

What physics settings do I need to apply to make the pool game realistic?

Right now, it's a bit weird. The ball does not bounce off the walls realistically and also the ball to ball collisions are not ok.

Any suggestions?

\$\endgroup\$
  • \$\begingroup\$ I am not sure about this, but do the walls need to be rigidbody? Can't they be just box colliders? \$\endgroup\$ – Vinayak Garg Jul 18 '15 at 17:32
  • \$\begingroup\$ Ths for reply...they need to be box colliders, sinde the balls need to collide and reflect off the wall, right? \$\endgroup\$ – mirzahat Jul 18 '15 at 18:01
  • \$\begingroup\$ You need a box collider for collisions. Rigidbodies are usually the objects that move around or in other words react to physics. The wall itself wouldn't react (or move), so it need not be rigidbody. \$\endgroup\$ – Vinayak Garg Jul 18 '15 at 18:14
2
\$\begingroup\$

Late, I know, but I think the big piece that you are missing is Physics Materials - they are what give the colliding objects their behaviors, in this case their bounciness.

\$\endgroup\$
1
\$\begingroup\$

You should look at this tutorial video https://unity3d.com/learn/tutorials/projects/roll-a-ball/moving-the-player

And maybe the entire Unity tutorial on Roll a ball

For making the balls bounce of the wall and from each other, on collision detection you should add a force based on momentum of ball(s).

\$\endgroup\$
  • \$\begingroup\$ Many thanks, there is no silver bullet, it looks like there are many approchaes to achieve a realistic pool game movement. I will look at it and get back to you! \$\endgroup\$ – mirzahat Jul 18 '15 at 18:02
1
\$\begingroup\$

Add physics material to your balls and walls. Then set the bounciness as per your requirement. Now the most important thing: Go to edit > project setting > Physics > Bounce Threshold and set it to zero(0). This will solve your problem. Now your balls sticks to the wall and bounces off at any speed.

Lets me know if it works for you. If you want I can share my project for your reference.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.