protected override void onChange() { base.onChange(); _revoluteJoint.EnableLimit(enableLimit); _revoluteJoint.EnableMotor(enableMotor); _revoluteJoint.SetMotorSpeed(motorSpeed); _revoluteJoint.SetMaxMotorTorque(maxMotorTorque); _revoluteJoint.GetBodyA().SetAwake(true); _revoluteJoint.GetBodyB().SetAwake(true); }
private void create() { b2Body bodyB; if (connectedB2BodyObject == null) { bodyB = _world.GetGroundBody(); } else { bodyB = connectedB2BodyObject.body; } b2RevoluteJointDef jointDef = new b2RevoluteJointDef(); jointDef.Initialize(_bodyObject.body, bodyB, new b2Vec2()); jointDef.collideConnected = enableCollision; jointDef.enableLimit = enableLimit; jointDef.referenceAngle = referenceAngle; jointDef.lowerAngle = lowerAngle; jointDef.upperAngle = upperAngle; jointDef.enableMotor = enableMotor; jointDef.motorSpeed = motorSpeed; jointDef.maxMotorTorque = maxMotorTorque; _joint = _world.CreateJoint(jointDef); _revoluteJoint = _joint as b2RevoluteJoint; _revoluteJoint.m_localAnchor1.SetV(localAnchor1); _revoluteJoint.m_localAnchor2.SetV(localAnchor2); _revoluteJoint.GetBodyA().SetAwake(true); _revoluteJoint.GetBodyB().SetAwake(true); }