Reputation: 13
So I'm making a 3D pool game. Basically I have a main camera that when you press a button it adds force to the cue ball based on the position of the camera, which works ok.
But whenever the cue ball hits the wall of the table, it just stops. I want it to smoothly bounce off the wall like a real pool cue ball would.
The cue ball is just a basic sphere Game Object. The walls are basic cubes with colliders.
I have tried Vector3.Reflect
with no success. It seems to bounce back a tiny bit but then immediately stops.
Any help would be great!
Upvotes: 1
Views: 5586
Reputation: 5
To make bounce on wall we need to create physic material and after that we need to change the value of dynamic friction =0.3 and static friction = 0.3 and bounciness=0.8 and frictionCombine choose Average from dropdown and bouncecombine choose Average . Hence the ball is start bouncing on the wall by using the upper property.
Upvotes: 0
Reputation: 691
You can do one thing.
Store the ball velocity when it collide with the wall, calculate the reflected direction through Vector3.Reflect and give the stored velocity to the ball in reflected direction.
Hope that this will help you...
Best, Hardik.
Upvotes: 0
Reputation: 2221
You should create a PhysicMaterial
with low or no friction (both dynamic
and static
), bounciness = 1
and Bounce Combine = Maximum
and then apply that PhysicMaterial
to the rigidbody
of your sphere
Upvotes: 5