Exemple #1
0
        public PulleyJoint(PulleyJointDef def)
            : base(def)
        {
            _ground        = _body1.GetWorld().GetGroundBody();
            _groundAnchor1 = def.GroundAnchor1 - _ground.GetXForm().Position;
            _groundAnchor2 = def.GroundAnchor2 - _ground.GetXForm().Position;
            _localAnchor1  = def.LocalAnchor1;
            _localAnchor2  = def.LocalAnchor2;

            //Box2DXDebug.Assert(def.Ratio != 0.0f);
            _ratio = def.Ratio;

            _constant = def.Length1 + _ratio * def.Length2;

            _maxLength1 = CommonMath.Min(def.MaxLength1, _constant - _ratio * MinPulleyLength);
            _maxLength2 = CommonMath.Min(def.MaxLength2, (_constant - MinPulleyLength) / _ratio);

            _impulse       = 0.0f;
            _limitImpulse1 = 0.0f;
            _limitImpulse2 = 0.0f;
        }