Pinball Physics

I was playing around with trying to simulate pinball physics in a playground and I’m not sure if I’m on the right track.

https://www.babylonjs-playground.com/#APA8YU#2 Press Z to activate a force on the flipper.

For the flipper I was trying to find a way to limit angular rotation but there doesn’t seem to be an easy way to do this. I used a bit of a hack by having invisible stopper objects that the flippers collide with to stop their motion.

I’m wondering if trying to do the simulation in 3D is overkill and if performance would be better working on a 2D plane and mapping the values to the rendering engine.

1 Like

I do not think it is overkill. On the contrary I think this is the best way to do it :slight_smile:
Let me ping @RaananW our god of Physics

Hi!

Yes,

this is one way to do that. Another way is to set a limit on the motor (which with this type of joint only works correctly in Oimo.js):

https://www.babylonjs-playground.com/#APA8YU#3

Setting stoppers is a great way of making it work, I would recommend to have a few defensive lines in an onBeforeRender loop, making sure the object doesn’t leave its boundries.

2 Likes