- Home /
Pinball, Sphere and gravity, hitting sphere off the table
Hi there.
To get me started in Unity I have created a simple pinball game, with two paddles using a hinge joint and the in-built physics engine.
They work, the can hit the sphere around the table, however sometimes the sphere will fly off the table once struck with the paddles.
Here is what I have tried, adjusting mass of sphere, gravity on the X,Y axis (both currently set to -12), mass of the paddles. Usually changing one of these adversely effects another such as the speed of the sphere, or the power of the paddles to hit the sphere.
Any suggestions on how I can resolve this would be excellent.
Thanks.
Answer by AngryOldMan · Mar 22, 2011 at 11:50 AM
Could you just put a plane on top of the machine facing down so that you can still see in but the ball can't fly out.
OR
Could you freeze the position of the rigidbody on the y axis under it's inspector properties? Not sure how your tables laid out.
Hi there thanks for the reply, I was thinking I could add a plane over the top, and chances are that I will, but the sphere still has issues, i.e doesn't roll down the table fast enough, or speed when struck by the paddle, I know the latter issue is going to be something to do with torque on the paddle. I tried to freeze position on the Y axis, but because of the table layout, no dice thanks for the suggestion.
In the end, I just put a non rendered cube over the top, with rigid body, did job, thanks.
try raising the local force added by the paddles, that should give you a bit more acceleration. You can put a collider on the none rendered box ins$$anonymous$$d of a rigidbody then unity doesnt need to process the physics of the rigidbody (even though it's static) Also turn down the angular drag or tilt the table down a bit more in order to get the ball to roll down the table faster.