コード例 #1
0
        public Agent(World world, Vector2 position)
        {
            _collidesWith        = Category.All;
            _collisionCategories = Category.All;

            _agentBody          = world.CreateBody(position);
            _agentBody.BodyType = BodyType.Dynamic;

            //Center
            _agentBody.CreateCircle(0.5f, 0.5f);

            //Left arm
            _agentBody.CreateRectangle(1.5f, 0.4f, 1f, new Vector2(-1f, 0f));
            _agentBody.CreateCircle(0.5f, 0.5f, new Vector2(-2f, 0f));

            //Right arm
            _agentBody.CreateRectangle(1.5f, 0.4f, 1f, new Vector2(1f, 0f));
            _agentBody.CreateCircle(0.5f, 0.5f, new Vector2(2f, 0f));

            //Top arm
            _agentBody.CreateRectangle(0.4f, 1.5f, 1f, new Vector2(0f, 1f));
            _agentBody.CreateCircle(0.5f, 0.5f, new Vector2(0f, 2f));

            //Bottom arm
            _agentBody.CreateRectangle(0.4f, 1.5f, 1f, new Vector2(0f, -1f));
            _agentBody.CreateCircle(0.5f, 0.5f, new Vector2(0f, -2f));

            //GFX
            _box  = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateRectangle(2.5f / 2f, 0.4f / 2f), Color.White, ContentWrapper.Black, 24f));
            _knob = new Sprite(ContentWrapper.CircleTexture(0.5f, "Square", ContentWrapper.Black, ContentWrapper.Gold, ContentWrapper.Black, 1f, 24f));

            _offset = 2f;
        }
コード例 #2
0
ファイル: Agent.cs プロジェクト: lab132/owlicity
        public Agent(World world, Vector2 position)
        {
            _collidesWith        = Category.All;
            _collisionCategories = Category.All;

            Body          = BodyFactory.CreateBody(world, position);
            Body.BodyType = BodyType.Dynamic;

            //Center
            FixtureFactory.AttachCircle(0.5f, 0.5f, Body);

            //Left arm
            FixtureFactory.AttachRectangle(1.5f, 0.4f, 1f, new Vector2(-1f, 0f), Body);
            FixtureFactory.AttachCircle(0.5f, 0.5f, Body, new Vector2(-2f, 0f));

            //Right arm
            FixtureFactory.AttachRectangle(1.5f, 0.4f, 1f, new Vector2(1f, 0f), Body);
            FixtureFactory.AttachCircle(0.5f, 0.5f, Body, new Vector2(2f, 0f));

            //Top arm
            FixtureFactory.AttachRectangle(0.4f, 1.5f, 1f, new Vector2(0f, 1f), Body);
            FixtureFactory.AttachCircle(0.5f, 0.5f, Body, new Vector2(0f, 2f));

            //Bottom arm
            FixtureFactory.AttachRectangle(0.4f, 1.5f, 1f, new Vector2(0f, -1f), Body);
            FixtureFactory.AttachCircle(0.5f, 0.5f, Body, new Vector2(0f, -2f));

            //GFX
            _box  = new Sprite(ContentWrapper.PolygonTexture(PolygonUtils.CreateRectangle(1.75f, 0.2f), Color.White, ContentWrapper.Black));
            _knob = new Sprite(ContentWrapper.CircleTexture(0.5f, "Square", ContentWrapper.Black, ContentWrapper.Gold, ContentWrapper.Black, 1f));

            _offset = ConvertUnits.ToDisplayUnits(2f);
        }
コード例 #3
0
        private void CreateLegTextures()
        {
            Vector2 p1 = new Vector2(-5.4f, -6.1f);
            Vector2 p2 = new Vector2(-7.2f, -1.2f);
            Vector2 p3 = new Vector2(-4.3f, -1.9f);
            Vector2 p4 = Vector2.Zero;
            Vector2 p5 = new Vector2(-2.9f, 0.7f);
            Vector2 p6 = new Vector2(0.6f, 2.9f);

            _leftShoulder        = new Sprite(ContentWrapper.PolygonTexture(new[] { p4, p5, p6 }, Color.White * 0.6f, ContentWrapper.Black, 24f));
            _leftShoulder.Origin = ContentWrapper.CalculateOrigin(_leftShoulders[0], 24f);

            _leftLeg        = new Sprite(ContentWrapper.PolygonTexture(new[] { p1, p3, p2 }, Color.White * 0.6f, ContentWrapper.Black, 24f));
            _leftLeg.Origin = ContentWrapper.CalculateOrigin(_leftLegs[0], 24f);

            p1.X *= -1f;
            p2.X *= -1f;
            p3.X *= -1f;
            p5.X *= -1f;
            p6.X *= -1f;

            _rightShoulder        = new Sprite(ContentWrapper.PolygonTexture(new[] { p4, p6, p5 }, Color.White * 0.6f, ContentWrapper.Black, 24f));
            _rightShoulder.Origin = ContentWrapper.CalculateOrigin(_rightShoulders[0], 24f);

            _rightLeg        = new Sprite(ContentWrapper.PolygonTexture(new[] { p1, p2, p3 }, Color.White * 0.6f, ContentWrapper.Black, 24f));
            _rightLeg.Origin = ContentWrapper.CalculateOrigin(_rightLegs[0], 24f);
        }
コード例 #4
0
        public Pyramid(World world, Vector2 position, int count, float density)
        {
            Vertices     rect  = PolygonUtils.CreateRectangle(0.5f, 0.5f);
            PolygonShape shape = new PolygonShape(rect, density);

            Vector2 rowStart = position;

            rowStart.Y -= 0.5f + count * 1.1f;

            Vector2     deltaRow = new Vector2(-0.625f, 1.1f);
            const float spacing  = 1.25f;

            // Physics
            _boxes = new List <Body>();

            for (int i = 0; i < count; i++)
            {
                Vector2 pos = rowStart;

                for (int j = 0; j < i + 1; j++)
                {
                    Body body = BodyFactory.CreateBody(world);
                    body.BodyType = BodyType.Dynamic;
                    body.Position = pos;
                    body.CreateFixture(shape);
                    _boxes.Add(body);

                    pos.X += spacing;
                }
                rowStart += deltaRow;
            }

            //GFX
            _box = new Sprite(ContentWrapper.PolygonTexture(rect, "Square", ContentWrapper.Blue, ContentWrapper.Gold, ContentWrapper.Black, 1f));
        }
コード例 #5
0
        public override void LoadContent()
        {
            base.LoadContent();

            World.Gravity = Vector2.Zero;

            _border = new Border(World, LineBatch, Framework.GraphicsDevice);

            Vertices rectangle1 = PolygonTools.CreateRectangle(_rectangleSize.X / 2f, _rectangleSize.Y / 2f);
            Vertices rectangle2 = PolygonTools.CreateRectangle(_rectangleSize.X / 2f, _rectangleSize.Y / 2f);

            rectangle1.Translate(-_offset);
            rectangle2.Translate(_offset);

            List <Vertices> vertices = new List <Vertices>(2);

            vertices.Add(rectangle1);
            vertices.Add(rectangle2);

            _rectangles          = World.CreateCompoundPolygon(vertices, 1f);
            _rectangles.BodyType = BodyType.Dynamic;

            SetUserAgent(_rectangles, 200f, 200f);

            // create sprite based on rectangle fixture
            _rectangleSprite = new Sprite(ContentWrapper.PolygonTexture(rectangle1, "Square", ContentWrapper.Blue, ContentWrapper.Gold, ContentWrapper.Black, 1f, 24f));
        }
コード例 #6
0
        public Objects(World world, Vector2 startPosition, Vector2 endPosition, int count, float radius, ObjectType type, float toothHeight = 1f)
        {
            _bodyRadius = radius;
            BodyList    = new List <Body>(count);


            for (int i = 0; i < count; i++)
            {
                switch (type)
                {
                case ObjectType.Circle:
                    BodyList.Add(world.CreateCircle(radius, 1f));
                    break;

                case ObjectType.Rectangle:
                    BodyList.Add(world.CreateRectangle(radius, radius, 1f));
                    _bodyRadius = radius / 2f;
                    break;

                case ObjectType.Star:
                    BodyList.Add(world.CreateGear(radius, 10, 0f, toothHeight, 1f));
                    _bodyRadius = radius * 2.7f;
                    break;

                case ObjectType.Gear:
                    BodyList.Add(world.CreateGear(radius, 10, 100f, toothHeight, 1f));
                    _bodyRadius = radius * 2.7f;
                    break;
                }
            }

            for (int i = 0; i < BodyList.Count; i++)
            {
                Body body = BodyList[i];
                body.BodyType = BodyType.Dynamic;
                body.Position = Vector2.Lerp(startPosition, endPosition, i / (float)(count - 1));
                body.SetRestitution(0.7f);
                body.SetFriction(0.2f);
            }

            //GFX
            switch (type)
            {
            case ObjectType.Circle:
                _object = new Sprite(ContentWrapper.CircleTexture(radius, ContentWrapper.Gold, ContentWrapper.Grey, 24f));
                break;

            case ObjectType.Rectangle:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateRectangle(radius / 2f, radius / 2f), ContentWrapper.Red, ContentWrapper.Grey, 24f));
                break;

            case ObjectType.Star:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateGear(radius, 10, 0f, toothHeight), ContentWrapper.Brown, ContentWrapper.Black, 24f));
                break;

            case ObjectType.Gear:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateGear(radius, 10, 100f, toothHeight), ContentWrapper.Orange, ContentWrapper.Grey, 24f));
                break;
            }
        }
コード例 #7
0
        public override void LoadContent()
        {
            base.LoadContent();

            World.Gravity = Vector2.Zero;

            _border = new Border(World, Lines, Framework.GraphicsDevice);

            Vertices rectangle1 = PolygonUtils.CreateRectangle(2f, 2f);
            Vertices rectangle2 = PolygonUtils.CreateRectangle(2f, 2f);

            Vector2 translation = new Vector2(-2f, 0f);

            rectangle1.Translate(ref translation);
            translation = new Vector2(2f, 0f);
            rectangle2.Translate(ref translation);

            List <Vertices> vertices = new List <Vertices>(2);

            vertices.Add(rectangle1);
            vertices.Add(rectangle2);

            _rectangles          = BodyFactory.CreateCompoundPolygon(World, vertices, 1f);
            _rectangles.BodyType = BodyType.Dynamic;

            SetUserAgent(_rectangles, 200f, 200f);

            // create sprite based on rectangle fixture
            _rectangleSprite = new Sprite(ContentWrapper.PolygonTexture(rectangle1, "Square", ContentWrapper.Blue, ContentWrapper.Gold, ContentWrapper.Black, 1f));
            _offset          = new Vector2(ConvertUnits.ToDisplayUnits(2f), 0f);
        }
コード例 #8
0
ファイル: Objects.cs プロジェクト: wyb314/Farseer-Physics
        public Objects(World world, Vector2 startPosition, Vector2 endPosition, int count, float radius, ObjectType type)
        {
            _bodies             = new List <Body>(count);
            CollidesWith        = Category.All;
            CollisionCategories = Category.All;

            // Physics
            for (int i = 0; i < count; i++)
            {
                switch (type)
                {
                case ObjectType.Circle:
                    _bodies.Add(BodyFactory.CreateCircle(world, radius, 1f));
                    break;

                case ObjectType.Rectangle:
                    _bodies.Add(BodyFactory.CreateRectangle(world, radius, radius, 1f));
                    break;

                case ObjectType.Star:
                    _bodies.Add(BodyFactory.CreateGear(world, radius, 10, 0f, 1f, 1f));
                    break;

                case ObjectType.Gear:
                    _bodies.Add(BodyFactory.CreateGear(world, radius, 10, 100f, 1f, 1f));
                    break;
                }
            }

            for (int i = 0; i < _bodies.Count; i++)
            {
                Body body = _bodies[i];
                body.BodyType    = BodyType.Dynamic;
                body.Position    = Vector2.Lerp(startPosition, endPosition, i / (float)(count - 1));
                body.Restitution = 0.7f;
                body.Friction    = 0.2f;
            }

            //GFX
            switch (type)
            {
            case ObjectType.Circle:
                _object = new Sprite(ContentWrapper.CircleTexture(radius, ContentWrapper.Gold, ContentWrapper.Grey));
                break;

            case ObjectType.Rectangle:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateRectangle(radius / 2f, radius / 2f), ContentWrapper.Red, ContentWrapper.Grey));
                break;

            case ObjectType.Star:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateGear(radius, 10, 0f, 1f), ContentWrapper.Brown, ContentWrapper.Black));
                break;

            case ObjectType.Gear:
                _object = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateGear(radius, 10, 100f, 1f), ContentWrapper.Orange, ContentWrapper.Grey));
                break;
            }
        }
コード例 #9
0
        public Ragdoll(World world, Vector2 position)
        {
            // Physics
            // Head
            _head                = world.CreateCircle(0.75f, 10f);
            _head.BodyType       = BodyType.Dynamic;
            _head.AngularDamping = LimbAngularDamping;
            _head.Mass           = 2f;
            _head.Position       = position;

            // Torso
            _upperBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _upperBody.BodyType = BodyType.Dynamic;
            _upperBody.Mass     = 1f;
            _upperBody.SetTransform(position + new Vector2(0f, -1.75f), -MathHelper.Pi / 2f);
            _middleBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _middleBody.BodyType = BodyType.Dynamic;
            _middleBody.Mass     = 1f;
            _middleBody.SetTransform(position + new Vector2(0f, -3f), -MathHelper.Pi / 2f);
            _lowerBody          = world.CreateCapsule(0.5f, 0.75f, LegDensity);
            _lowerBody.BodyType = BodyType.Dynamic;
            _lowerBody.Mass     = 1f;
            _lowerBody.SetTransform(position + new Vector2(0f, -4.25f), -MathHelper.Pi / 2f);

            // Left Arm
            _lowerLeftArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _lowerLeftArm.BodyType       = BodyType.Dynamic;
            _lowerLeftArm.AngularDamping = LimbAngularDamping;
            _lowerLeftArm.Mass           = 2f;
            _lowerLeftArm.Rotation       = -1.4f;
            _lowerLeftArm.Position       = position + new Vector2(-4f, -2.2f);

            _upperLeftArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _upperLeftArm.BodyType       = BodyType.Dynamic;
            _upperLeftArm.AngularDamping = LimbAngularDamping;
            _upperLeftArm.Mass           = 2f;
            _upperLeftArm.Rotation       = -1.4f;
            _upperLeftArm.Position       = position + new Vector2(-2f, -1.8f);

            // Right Arm
            _lowerRightArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _lowerRightArm.BodyType       = BodyType.Dynamic;
            _lowerRightArm.AngularDamping = LimbAngularDamping;
            _lowerRightArm.Mass           = 2f;
            _lowerRightArm.Rotation       = 1.4f;
            _lowerRightArm.Position       = position + new Vector2(4f, -2.2f);

            _upperRightArm                = world.CreateCapsule(1f, 0.45f, ArmDensity);
            _upperRightArm.BodyType       = BodyType.Dynamic;
            _upperRightArm.AngularDamping = LimbAngularDamping;
            _upperRightArm.Mass           = 2f;
            _upperRightArm.Rotation       = 1.4f;
            _upperRightArm.Position       = position + new Vector2(2f, -1.8f);

            // Left Leg
            _lowerLeftLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _lowerLeftLeg.BodyType       = BodyType.Dynamic;
            _lowerLeftLeg.AngularDamping = LimbAngularDamping;
            _lowerLeftLeg.Mass           = 2f;
            _lowerLeftLeg.Position       = position + new Vector2(-0.6f, -8f);

            _upperLeftLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _upperLeftLeg.BodyType       = BodyType.Dynamic;
            _upperLeftLeg.AngularDamping = LimbAngularDamping;
            _upperLeftLeg.Mass           = 2f;
            _upperLeftLeg.Position       = position + new Vector2(-0.6f, -6f);

            // Right Leg
            _lowerRightLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _lowerRightLeg.BodyType       = BodyType.Dynamic;
            _lowerRightLeg.AngularDamping = LimbAngularDamping;
            _lowerRightLeg.Mass           = 2f;
            _lowerRightLeg.Position       = position + new Vector2(0.6f, -8f);

            _upperRightLeg                = world.CreateCapsule(1f, 0.5f, LegDensity);
            _upperRightLeg.BodyType       = BodyType.Dynamic;
            _upperRightLeg.AngularDamping = LimbAngularDamping;
            _upperRightLeg.Mass           = 2f;
            _upperRightLeg.Position       = position + new Vector2(0.6f, -6f);

            // head -> upper body
            DistanceJoint jointHeadBody = new DistanceJoint(_head, _upperBody, new Vector2(0f, -1f), new Vector2(-0.75f, 0f));

            jointHeadBody.CollideConnected = true;
            jointHeadBody.DampingRatio     = DampingRatio;
            jointHeadBody.Frequency        = Frequency;
            jointHeadBody.Length           = 0.025f;
            world.Add(jointHeadBody);

            // lowerLeftArm -> upperLeftArm
            DistanceJoint jointLeftArm = new DistanceJoint(_lowerLeftArm, _upperLeftArm, new Vector2(0f, 1f), new Vector2(0f, -1f));

            jointLeftArm.CollideConnected = true;
            jointLeftArm.DampingRatio     = DampingRatio;
            jointLeftArm.Frequency        = Frequency;
            jointLeftArm.Length           = 0.02f;
            world.Add(jointLeftArm);

            // upperLeftArm -> upper body
            DistanceJoint jointLeftArmBody = new DistanceJoint(_upperLeftArm, _upperBody, new Vector2(0f, 1f), new Vector2(-0.15f, -1f));

            jointLeftArmBody.DampingRatio = DampingRatio;
            jointLeftArmBody.Frequency    = Frequency;
            jointLeftArmBody.Length       = 0.02f;
            world.Add(jointLeftArmBody);

            // lowerRightArm -> upperRightArm
            DistanceJoint jointRightArm = new DistanceJoint(_lowerRightArm, _upperRightArm, new Vector2(0f, 1f), new Vector2(0f, -1f));

            jointRightArm.CollideConnected = true;
            jointRightArm.DampingRatio     = DampingRatio;
            jointRightArm.Frequency        = Frequency;
            jointRightArm.Length           = 0.02f;
            world.Add(jointRightArm);

            // upperRightArm -> upper body
            DistanceJoint jointRightArmBody = new DistanceJoint(_upperRightArm, _upperBody, new Vector2(0f, 1f), new Vector2(-0.15f, 1f));

            jointRightArmBody.DampingRatio = DampingRatio;
            jointRightArmBody.Frequency    = 25;
            jointRightArmBody.Length       = 0.02f;
            world.Add(jointRightArmBody);

            // lowerLeftLeg -> upperLeftLeg
            DistanceJoint jointLeftLeg = new DistanceJoint(_lowerLeftLeg, _upperLeftLeg, new Vector2(0f, 1.1f), new Vector2(0f, -1f));

            jointLeftLeg.CollideConnected = true;
            jointLeftLeg.DampingRatio     = DampingRatio;
            jointLeftLeg.Frequency        = Frequency;
            jointLeftLeg.Length           = 0.05f;
            world.Add(jointLeftLeg);

            // upperLeftLeg -> lower body
            DistanceJoint jointLeftLegBody = new DistanceJoint(_upperLeftLeg, _lowerBody, new Vector2(0f, 1.1f), new Vector2(0.7f, -0.8f));

            jointLeftLegBody.CollideConnected = true;
            jointLeftLegBody.DampingRatio     = DampingRatio;
            jointLeftLegBody.Frequency        = Frequency;
            jointLeftLegBody.Length           = 0.02f;
            world.Add(jointLeftLegBody);

            // lowerRightleg -> upperRightleg
            DistanceJoint jointRightLeg = new DistanceJoint(_lowerRightLeg, _upperRightLeg, new Vector2(0f, 1.1f), new Vector2(0f, -1f));

            jointRightLeg.CollideConnected = true;
            jointRightLeg.DampingRatio     = DampingRatio;
            jointRightLeg.Frequency        = Frequency;
            jointRightLeg.Length           = 0.05f;
            world.Add(jointRightLeg);

            // upperRightleg -> lower body
            DistanceJoint jointRightLegBody = new DistanceJoint(_upperRightLeg, _lowerBody, new Vector2(0f, 1.1f), new Vector2(0.7f, 0.8f));

            jointRightLegBody.CollideConnected = true;
            jointRightLegBody.DampingRatio     = DampingRatio;
            jointRightLegBody.Frequency        = Frequency;
            jointRightLegBody.Length           = 0.02f;
            world.Add(jointRightLegBody);

            // upper body -> middle body
            RevoluteJoint jointUpperTorso = new RevoluteJoint(_upperBody, _middleBody, _upperBody.Position + new Vector2(0f, -0.625f), true);

            jointUpperTorso.LimitEnabled = true;
            jointUpperTorso.SetLimits(MathHelper.Pi / 16f, -MathHelper.Pi / 16f);
            world.Add(jointUpperTorso);

            // middle body -> lower body
            RevoluteJoint jointLowerTorso = new RevoluteJoint(_middleBody, _lowerBody, _middleBody.Position + new Vector2(0f, -0.625f), true);

            jointLowerTorso.LimitEnabled = true;
            jointLowerTorso.SetLimits(MathHelper.Pi / 8f, -MathHelper.Pi / 8f);
            world.Add(jointLowerTorso);

            // GFX
            _face      = new Sprite(ContentWrapper.CircleTexture(0.75f, "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Grey, 1f, 24f));
            _torso     = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateRoundedRectangle(1.5f, 2f, 0.75f, 0.75f, 2), "Stripe", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 2.0f, 24f));
            _upperLimb = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 1f, 24f));
            _lowerLimb = new Sprite(ContentWrapper.PolygonTexture(PolygonTools.CreateCapsule(2f, 0.5f, 16), "Square", ContentWrapper.Gold, ContentWrapper.Orange, ContentWrapper.Black, 1f, 24f));
        }
コード例 #10
0
        public TheoJansenWalker(World world, Vector2 position)
        {
            _position   = position;
            _motorSpeed = 2.0f;
            _motorOn    = true;

            _leftShoulders = new Body[3];
            _leftLegs      = new Body[3];

            _rightShoulders = new Body[3];
            _rightLegs      = new Body[3];

            Vector2 pivot = new Vector2(0f, -0.8f);

            // Chassis
            PolygonShape box = new PolygonShape(1f);

            box.Vertices = PolygonUtils.CreateRectangle(2.5f, 1.0f);
            _body        = new Sprite(ContentWrapper.TextureFromShape(box, _walkerColors[0], ContentWrapper.Black));

            _chassis          = BodyFactory.CreateBody(world);
            _chassis.BodyType = BodyType.Dynamic;
            _chassis.Position = pivot + _position;

            Fixture bodyFixture = _chassis.CreateFixture(box);

            bodyFixture.CollisionGroup = -1;

            // Wheel
            CircleShape circle = new CircleShape(1.6f, 1f);

            _engine = new Sprite(ContentWrapper.TextureFromShape(circle, "Stripe", _walkerColors[1] * 0.6f, _walkerColors[2] * 0.8f, ContentWrapper.Black, 3f));

            _wheel          = BodyFactory.CreateBody(world);
            _wheel.BodyType = BodyType.Dynamic;
            _wheel.Position = pivot + _position;

            Fixture wheelFixture = _wheel.CreateFixture(circle);

            wheelFixture.CollisionGroup = -1;

            // Physics
            _motorJoint = new RevoluteJoint(_wheel, _chassis, _chassis.Position, true);
            _motorJoint.CollideConnected = false;
            _motorJoint.MotorSpeed       = _motorSpeed;
            _motorJoint.MaxMotorTorque   = 400f;
            _motorJoint.MotorEnabled     = _motorOn;
            world.AddJoint(_motorJoint);

            Vector2 wheelAnchor = pivot + new Vector2(0f, 0.8f);

            CreateLeg(world, -1f, wheelAnchor, 0);
            CreateLeg(world, 1f, wheelAnchor, 0);

            _wheel.SetTransform(_wheel.Position, 120f * MathConstants.Pi / 180f);
            CreateLeg(world, -1f, wheelAnchor, 1);
            CreateLeg(world, 1f, wheelAnchor, 1);

            _wheel.SetTransform(_wheel.Position, -120f * MathConstants.Pi / 180f);
            CreateLeg(world, -1f, wheelAnchor, 2);
            CreateLeg(world, 1f, wheelAnchor, 2);

            // GFX
            Vector2[] points =
            {
                new Vector2(-5.4f,  6.1f),
                new Vector2(-7.2f,  1.2f),
                new Vector2(-4.3f,  1.9f),
                new Vector2(-2.9f, -0.7f),
                new Vector2(0.6f, -2.9f)
            };

            _leftShoulder        = new Sprite(ContentWrapper.PolygonTexture(new[] { Vector2.Zero, points[3], points[4] }, Color.White * 0.6f, ContentWrapper.Black));
            _leftShoulder.Origin = ContentWrapper.CalculateOrigin(_leftShoulders[0]);

            _leftLeg        = new Sprite(ContentWrapper.PolygonTexture(new[] { points[0], points[1], points[2] }, Color.White * 0.6f, ContentWrapper.Black));
            _leftLeg.Origin = ContentWrapper.CalculateOrigin(_leftLegs[0]);

            for (int i = 0; i < points.Length; i++)
            {
                points[i].X *= -1f;
            }

            _rightShoulder        = new Sprite(ContentWrapper.PolygonTexture(new[] { Vector2.Zero, points[4], points[3] }, Color.White * 0.6f, ContentWrapper.Black));
            _rightShoulder.Origin = ContentWrapper.CalculateOrigin(_rightShoulders[0]);

            _rightLeg        = new Sprite(ContentWrapper.PolygonTexture(new[] { points[0], points[2], points[1] }, Color.White * 0.6f, ContentWrapper.Black));
            _rightLeg.Origin = ContentWrapper.CalculateOrigin(_rightLegs[0]);
        }