protected internal override void GetContactInformation(int index, out ContactInformation info)
{
info.Contact = MeshManifold.contacts.Elements[index];
//Find the contact's normal and friction forces.
info.FrictionImpulse = 0;
info.NormalImpulse = 0;
for (int i = 0; i < contactConstraint.frictionConstraints.Count; i++)
{
if (contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.contact == info.Contact)
{
info.FrictionImpulse = contactConstraint.frictionConstraints.Elements[i].accumulatedImpulse;
info.NormalImpulse = contactConstraint.frictionConstraints.Elements[i].PenetrationConstraint.accumulatedImpulse;
break;
}
}
//Compute relative velocity
if (convex.entity != null)
{
Vector3 velocity;
Vector3.Subtract(ref info.Contact.Position, ref convex.entity.position, out velocity);
Vector3.Cross(ref convex.entity.angularVelocity, ref velocity, out velocity);
Vector3.Add(ref velocity, ref convex.entity.linearVelocity, out info.RelativeVelocity);
}
else
info.RelativeVelocity = new Vector3();
info.Pair = this;
}