Beispiel #1
0
        protected override void CopyTo(JointInfo target)
        {
            base.CopyTo(target);
            FrictionJointInfo c = target as FrictionJointInfo;

            c.localAnchorA = this.localAnchorA;
            c.localAnchorB = this.localAnchorB;
            c.maxForce     = this.maxForce;
            c.maxTorque    = this.maxTorque;
        }
 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;
         }
     }
 }
 private void DrawJoint(Canvas canvas, FrictionJointInfo joint)
 {
     this.DrawLocalFrictionMarker(canvas, joint.BodyA, joint.LocalAnchorA);
     this.DrawLocalFrictionMarker(canvas, joint.BodyB, joint.LocalAnchorB);
     this.DrawLocalLooseConstraint(canvas, joint.BodyA, joint.BodyB, joint.LocalAnchorA, joint.LocalAnchorB);
 }
        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);
            }
        }