コード例 #1
0
 void ICmpInitializable.OnDeactivate()
 {
     // Clean up the temporary friction joint we have created
     if (this.frictionJoint != null)
     {
         this.frictionJoint.ParentBody.RemoveJoint(this.frictionJoint);
         this.frictionJoint = null;
     }
 }
コード例 #2
0
 void ICmpInitializable.OnShutdown(Component.ShutdownContext context)
 {
     if (context == ShutdownContext.Deactivate)
     {
         // Clean up the temporary friction joint we have created
         if (this.frictionJoint != null)
         {
             this.frictionJoint.ParentBody.RemoveJoint(this.frictionJoint);
             this.frictionJoint = null;
         }
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 private void DrawJoint(Canvas canvas, FrictionJointInfo joint)
 {
     this.DrawLocalFrictionMarker(canvas, joint.ParentBody, joint.LocalAnchorA);
     this.DrawLocalFrictionMarker(canvas, joint.OtherBody, joint.LocalAnchorB);
     this.DrawLocalLooseConstraint(canvas, joint.ParentBody, joint.OtherBody, joint.LocalAnchorA, joint.LocalAnchorB);
 }