コード例 #1
0
ファイル: Chain.cs プロジェクト: Zikomo/Leximo
        public void AttachEnd(BodyNode body, float initialRotation, Vector2 endAnchor, Vector2 bodyAnchor)
        {
            int end = links.Count - 1;
            PinJoint joint = null;

            //body.body.Position = bodies[end].body.Position + (bodies[end].bounds.X - 4) * Vector2.UnitX;
            body.body.Position = links[end].body.Position + (7) * Vector2.UnitX;
            body.body.Rotation = initialRotation;
            //joint = JointFactory.Instance.CreatePinJoint(simulator, bodies[end].body, endAnchor, body.body, bodyAnchor);
            joint = JointFactory.Instance.CreatePinJoint(simulator, links[end].body, endAnchor, body.body, bodyAnchor);

            joint.Softness = 0.0000f;
            joint.TargetDistance = 0;
            joint.BiasFactor = 0.0f;
            body.body.LinearDragCoefficient = 100000;
            if (body.isLink)
            {
                links.Add(body);
            }
            else
            {
                body.isVisible = false;
                links.Add(body);
                body.isVisible = true;
                bodies.Add(body);
            }

            joints.Add(joint);
        }
コード例 #2
0
ファイル: Chain.cs プロジェクト: Zikomo/Leximo
 public void CapEnd()
 {
     BodyNode end = new BodyNode(BodyFactory.Instance.CreateRectangleBody(simulator, 10, 10, 1000), null);
     end.isVisible = false;
     AttachEnd(end, 0);
 }
コード例 #3
0
ファイル: Chain.cs プロジェクト: Zikomo/Leximo
 public void AttachEnd(BodyNode body, float initialRotation)
 {
     int end = links.Count - 1;
     //AttachEnd(body, initialRotation, (bodies[end].bounds.X - 2) * Vector2.UnitX, Vector2.Zero);
     AttachEnd(body, initialRotation, (10 - 2) * Vector2.UnitX, Vector2.Zero);
 }