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
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);
_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);