Pinball flippers - Joint moves if hit by ball

Hi guys,

I'm trying to create a pinball game, and am now working on the flippers. I attached a box to a revolute joint and managed to create a simple flipper.
However, if the ball hits it, the joint and box move a bit (changing x,y position). Can I lock it firmly in place?
Thanks!

HH

Code:
_mass = new FlipperMass(); //box
         _joint = new FlipperJoint(); //joint
         
         _joint._maxForce = 50;
         _joint._maxTorque = 50;
         _joint.enableMotor = false;
         _joint.type = "Revolute";
         
         _mass.type = "Dynamic";
         
         _mass.applyGravity = false;
         
         _joint.x = _position.x;
         _joint.y = _position.y;
         
         if(_jointPosition == "left")_mass.x =  _position.x +(_mass.width / 2 - JOINTOFFSET);
         if(_jointPosition == "right")_mass.x =  _position.x -(_mass.width / 2 - JOINTOFFSET);
         _mass.y = _position.y;
         
         _mass.autoSleep = false;
         
         _world.addChild(_mass);
         _world.addChild(_joint);
You may need to make the flipper much heavier than the ball - what are the mass ratios at the moment?
I don't know the mass ratio.. i can set the density though but that doesn't seem to work.

How can I change the mass?

Thanks!
mass = density * area (or size)

so by setting higher density you are changing the mass. so if density is not working, mass is also not what you are looking for.

you could also try a kenomatic body.
it will cause collisions but not be pushed around by anything that collides with it.
this would also allow a simple animation to cause the flipper to flip.
although this can make it a little sloppy when it comes to forces, and resolving multiple collisions, i think it will be fine as long as the ball can't get trapped between a flipper and a hard-place.

you could also try various joints. i assume a revolute joint would hold it very steady while allowing it to rotate as you desire it too.
After you create the ball body and the flipper body and attach their fixtures, you can call GetMass() on the body to see how much they 'weigh'.
If the ball is significantly heavier than the flipper you will see what it sounds like you are seeing.... as mentioned above, adjust the density to see if you can fix the problem - as the flipper gets heavier you will also need to increase the forces/torque used to make it move.
Fixed it! The mass needed to be a kinematic type.
Thanks all!
Any demo? I'd love to see; big pinball fan.
I used to have a demo in there using revolute joints for flippers but some big changes from Erin made them unstable. I think the best way to do it is to set your flippers to type = Animated and then animate the actual flipping in Flash. Use code to trigger play() / stop().
I'm really new to this staff, just started playing with WCK/Box2D last weekend. I decided to make pinball as my first project, because its easily defined; just one table and some functionality. My platform/rgp/adventure/puzzle game is just expanding too much in my head.

Because of this thread I tried to set my flippers animated, but its not working very well. I doesn't take account inertia ie. the ball "launches" always at "full" speed.

So I made a keyboard controlled revolution joint and set other target to static object (that box right beside flipper) and see no problem in that; you can try it here: http://megaswf.com/serve/1148563
Hey that's pretty cool! The captive ball works nicely. Post updates, ok?

Original thread: https://box2d.org/forum/viewtopic.php?t=6478