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.
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.
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 instead 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.
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Changing gravity affecting 'random movement' behaviour script - my NPCs go crazy, what should I do?
How could I simulate planetary gravity that has an orbit point?
How to make an axis always face an object?
Constant force, with gravity, and correct collisions.
Changing gravity on collision