Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because:
  • you might not know where the center of mass will be.
  • if you add/remove shapes from a body and recompute the mass, the joints will be broken.
Наследование: JointDef
Пример #1
0
        public RevoluteJoint(IWorldPool argWorld, RevoluteJointDef def)
            : base(argWorld, def)
        {
            LocalAnchorA.Set(def.LocalAnchorA);
            LocalAnchorB.Set(def.LocalAnchorB);
            ReferenceAngle = def.ReferenceAngle;

            MotorImpulse = 0;

            LowerAngle       = def.LowerAngle;
            UpperAngle       = def.UpperAngle;
            m_maxMotorTorque = def.MaxMotorTorque;
            m_motorSpeed     = def.MotorSpeed;
            m_limitEnabled   = def.EnableLimit;
            m_motorEnabled   = def.EnableMotor;
            LimitState       = LimitState.Inactive;
        }
Пример #2
0
        public RevoluteJoint(IWorldPool argWorld, RevoluteJointDef def)
            : base(argWorld, def)
        {
            m_localAnchorA.set_Renamed(def.localAnchorA);
            m_localAnchorB.set_Renamed(def.localAnchorB);
            m_referenceAngle = def.referenceAngle;

            m_motorImpulse = 0;

            m_lowerAngle = def.lowerAngle;
            m_upperAngle = def.upperAngle;
            m_maxMotorTorque = def.maxMotorTorque;
            m_motorSpeed = def.motorSpeed;
            m_enableLimit = def.enableLimit;
            m_enableMotor = def.enableMotor;
            m_limitState = LimitState.INACTIVE;
        }
Пример #3
0
        public RevoluteJoint(IWorldPool argWorld, RevoluteJointDef def)
            : base(argWorld, def)
        {
            LocalAnchorA.Set(def.LocalAnchorA);
            LocalAnchorB.Set(def.LocalAnchorB);
            ReferenceAngle = def.ReferenceAngle;

            MotorImpulse = 0;

            LowerAngle = def.LowerAngle;
            UpperAngle = def.UpperAngle;
            m_maxMotorTorque = def.MaxMotorTorque;
            m_motorSpeed = def.MotorSpeed;
            m_limitEnabled = def.EnableLimit;
            m_motorEnabled = def.EnableMotor;
            LimitState = LimitState.Inactive;
        }