Esempio n. 1
0
        /// <inheritdoc/>
        protected override bool OnApplyImpulse()
        {
            if (!_limitIsActive)
            {
                return(false);
            }

            var relativeVelocity = _constraint.GetRelativeVelocity(BodyA, BodyB);
            var impulse          = _constraint.SatisfyConstraint(BodyA, BodyB, relativeVelocity, 0, MaxForce);

            return(Math.Abs(impulse) > Simulation.Settings.Constraints.MinConstraintImpulse);
        }
Esempio n. 2
0
        private float ApplyImpulse(int index)
        {
            if (_minImpulseLimits[index] != 0)
            {
                Constraint1D constraint       = _constraints[index];
                float        relativeVelocity = constraint.GetRelativeVelocity(BodyA, BodyB);
                float        impulse          = constraint.SatisfyConstraint(
                    BodyA,
                    BodyB,
                    relativeVelocity,
                    _minImpulseLimits[index],
                    _maxImpulseLimits[index]);

                return(impulse);
            }

            return(0);
        }