Hello, I'm trying to break into the world of Box2D with a basic pinball game. I'm using physicseditor to define my shape data. I am applying torque to the flipper body joint (left flipper only, left arrow key). The problem I'm having is that the ball passes through the flipper at moderate ball speeds when the ball is very near and the flipper is pressed.
Here is an example : http://ogmatter.com/dev/pinball/
CLICK ANYWHERE IN THE EXAMPLE TO LAUNCH THE BALL AGAIN, LEFT ARROW TO TRIGGER FLIPPER.
Here is the ball specs
Ball
The Left Flipper : Density : 1.0, Resitution : 0.10, Friction : 0.10
When you hit the left flipper I apply torque : leftFlipperBody.ApplyTorque(-1000)
Frame Rate : 30 fps
Here is an example : http://ogmatter.com/dev/pinball/
CLICK ANYWHERE IN THE EXAMPLE TO LAUNCH THE BALL AGAIN, LEFT ARROW TO TRIGGER FLIPPER.
Here is the ball specs
Ball
Code: Select all
public var wheelDensity:Number = 0.5
public var wheelRestitution:Number = 0.1
public var wheelFriction:Number = 0.10The Left Flipper : Density : 1.0, Resitution : 0.10, Friction : 0.10
Code: Select all
leftFlipperBody.SetPositionAndAngle(new b2Vec2(115 / ptm_ratio, 560 / ptm_ratio), 0);
leftFlipperBody.SetSleepingAllowed(false);
// Define the anchor point and pivot of the flipper
var leftFlipperAnchor:b2Vec2 = new b2Vec2(122 / ptm_ratio, 575 / ptm_ratio)
// Left Flipper Pivot
leftFlipJointDef.Initialize(leftFlipperBody, body, leftFlipperAnchor);
//leftFlipJointDef.Initialize(leftFlipperBody, body, leftFlipperAnchor);
leftFlipJointDef.lowerAngle = 0
leftFlipJointDef.upperAngle = 60 * (Math.PI / 180)
leftFlipJointDef.referenceAngle = 0
leftFlipJointDef.enableLimit = true
leftFlipJointDef.motorSpeed = 2
leftFlipJointDef.maxMotorTorque = 1.0;
leftFlipJointDef.enableMotor = true;
world.CreateJoint(leftFlipJointDef);When you hit the left flipper I apply torque : leftFlipperBody.ApplyTorque(-1000)
Code: Select all
world.Step(1/40, 10, 10)Frame Rate : 30 fps