# Pinball -> flippers physics calculation

Hello,

I am building a pinball machine, i used a tutorial to get working flippers, while they work the physics calculation is screwed up on some spots of the flippers. I assume this is due to animations that let the flipper do it’s thing (but i am not sure). In the tutorial, the person says that it will be a bit off and best is to use a bounding box as collision detection, i agree with that but however in this case it doesn’t matter, the flippers or bounding box results in the same problem.

physics steps are at 5
flippers move due to animations (L+R shift key)

tried:

• bounding box
• compound bounding box
• just a box to compound with
• box, triangle, convex hull, etc, bounding boxes.
• insane high and low poly objects (to see if it solved the problem)

So i want to know… are there better ways to make flippers? everything else just works how it should be.

My pinball machine:
(terrible video settings used to record, so the movie will be bad/shocking a bit)

at 1:25 - 1.30 you see 1 small flipper bug, he shoots and flips it in air, then tosses it around the table.
another error the one i want you to see wont come up after 10 play troughs xD. But in short the ball can get stuck inside the flipper (on origin) or it uhm loops around the flipper and get tossed back in/out of the game.

try setting the physics to Ghost, then, using python collision callbacks, calculate the vector based on flipper orientation and distance to the pivot, then apply a force. that way you dont have to worry about physics bugs.

hey deadalus, thanks for the suggestion, i will look into it and see if i can get something to work.

Ok as said i looked into it, and i could use some help with this.

i did put the flipper on ghost and atached the following script to it:

``````
def stuff(cont):

own = cont.owner

left_collision = own.sensors['coll']
left_shift = own.sensors['l_shift']
left_flipper = own.scene.objects['flipper_left']

if left_collision.positive:

hit_obj = left_collision.hitObject

if left_shift.positive:
hit_obj.worldOrientation.col[2] = left_flipper.worldOrientation.col[2]
hit_obj.applyForce([0.0,20.0,0.0],True)

``````

this will ‘bounce’ the ball back when hitting shift, but you can see it does this a bit late.

but now the question will be, if it is ghost how do i get it to hold the ball on the flipper?
and how to get it more precise?

as with above script the left flipper + ball acts like this: