public void WarmStart(ref BodyVelocities wsvA, ref ContactManifold1OneBodyProjection projection, ref Contact1AccumulatedImpulses accumulatedImpulses)
 {
     Helpers.BuildOrthnormalBasis(ref projection.Normal, out var x, out var z);
     TangentFrictionOneBody.WarmStart(ref x, ref z, ref projection.Tangent, ref projection.InertiaA, ref accumulatedImpulses.Tangent, ref wsvA);
     PenetrationLimit1OneBody.WarmStart(ref projection.Penetration, ref projection.InertiaA,
                                        ref projection.Normal,
                                        ref accumulatedImpulses.Penetration0, ref wsvA);
 }
 public void Prestep(Bodies bodies, ref Vector <int> bodyReferences, int count,
                     float dt, float inverseDt, ref Contact1OneBodyPrestepData prestep, out ContactManifold1OneBodyProjection projection)
 {
     bodies.GatherInertia(ref bodyReferences, count, out projection.InertiaA);
     projection.PremultipliedFrictionCoefficient = prestep.FrictionCoefficient;
     projection.Normal = prestep.Normal;
     Helpers.BuildOrthnormalBasis(ref prestep.Normal, out var x, out var z);
     TangentFrictionOneBody.Prestep(ref x, ref z, ref prestep.OffsetA0, ref projection.InertiaA, out projection.Tangent);
     PenetrationLimit1OneBody.Prestep(ref projection.InertiaA, ref prestep.Normal, ref prestep, dt, inverseDt, out projection.Penetration);
 }
        public void Solve(ref BodyVelocities wsvA, ref ContactManifold1OneBodyProjection projection, ref Contact1AccumulatedImpulses accumulatedImpulses)
        {
            Helpers.BuildOrthnormalBasis(ref projection.Normal, out var x, out var z);
            var maximumTangentImpulse = projection.PremultipliedFrictionCoefficient * accumulatedImpulses.Penetration0;

            TangentFrictionOneBody.Solve(ref x, ref z, ref projection.Tangent, ref projection.InertiaA, ref maximumTangentImpulse, ref accumulatedImpulses.Tangent, ref wsvA);
            //Note that we solve the penetration constraints after the friction constraints.
            //This makes the penetration constraints more authoritative at the cost of the first iteration of the first frame of an impact lacking friction influence.
            //It's a pretty minor effect either way.
            PenetrationLimit1OneBody.Solve(ref projection.Penetration, ref projection.InertiaA, ref projection.Normal,
                                           ref accumulatedImpulses.Penetration0, ref wsvA);
        }