private void SetupFrictionJoint(RigidBody body)
{
// If we already have a friction joint, is it connecting the right bodies?
if (this.frictionJoint != null)
{
if (this.frictionJoint.ParentBody != body ||
this.frictionJoint.ParentBody != this.baseObject)
{
this.frictionJoint.ParentBody.RemoveJoint(this.frictionJoint);
this.frictionJoint = null;
}
}
// Create a friction joint connecting our body to the body it is standing on
if (this.frictionJoint == null)
{
this.frictionJoint = new FrictionJointInfo();
this.frictionJoint.CollideConnected = true;
this.frictionJoint.MaxTorque = 0.0f;
body.AddJoint(this.frictionJoint, this.baseObject);
}
}