Example #1
0
        private void CreateGFX(AssetCreator assets)
        {
            _face  = new Sprite(assets.CircleTexture(0.9f, MaterialType.Squares, Color.Gray, 1f, 24f));
            _torso = new Sprite(assets.TextureFromVertices(PolygonTools.CreateRoundedRectangle(2f, 4f, 0.5f, 0.7f, 2), MaterialType.Squares, Color.LightSlateGray, 0.8f, 24f));

            _upperArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerArm = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(1.9f, 0.45f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));

            _upperLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DimGray, 0.8f, 24f));
            _lowerLeg = new Sprite(assets.TextureFromVertices(PolygonTools.CreateCapsule(2f, 0.5f, 16), MaterialType.Squares, Color.DarkSlateGray, 0.8f, 24f));
        }
Example #2
0
        public static Body CreateRoundedRectangle(World world, float width, float height, float xRadius, float yRadius, int segments, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null)
        {
            var verts = PolygonTools.CreateRoundedRectangle(width, height, xRadius, yRadius, segments);

            //There are too many vertices in the rect. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                var vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                return(CreateCompoundPolygon(world, vertList, density, position, rotation, bodyType, userData));
            }

            return(CreatePolygon(world, verts, density, position, rotation, bodyType, userData));
        }
Example #3
0
        public Body CreateRoundedRectangle(float width, float height, float xRadius, float yRadius, int segments, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static)
        {
            Vertices verts = PolygonTools.CreateRoundedRectangle(width, height, xRadius, yRadius, segments);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                return(CreateCompoundPolygon(vertList, density, position, rotation, bodyType));
            }

            return(CreatePolygon(verts, density, position, rotation, bodyType));
        }
Example #4
0
        /// <summary>
        /// Creates a rounded rectangle.
        /// Note: Automatically decomposes the capsule if it contains too many vertices (controlled by Settings.MaxPolygonVertices)
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="xRadius">The x radius.</param>
        /// <param name="yRadius">The y radius.</param>
        /// <param name="segments">The segments.</param>
        /// <param name="density">The density.</param>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public static Body CreateRoundedRectangle(World world, float width, float height, float xRadius, float yRadius, int segments, float density, Vector2 position, object userData = null)
        {
            Vertices verts = PolygonTools.CreateRoundedRectangle(width, height, xRadius, yRadius, segments);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                Body            body     = CreateCompoundPolygon(world, vertList, density, userData);
                body.Position = position;
                return(body);
            }

            return(CreatePolygon(world, verts, density));
        }
Example #5
0
        public static List <Fixture> AttachRoundedRectangle(float width, float height, float xRadius, float yRadius, int segments, float density, Body body, object userData = null)
        {
            var verts = PolygonTools.CreateRoundedRectangle(width, height, xRadius, yRadius, segments);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                var vertList = Triangulate.ConvexPartition(verts, TriangulationAlgorithm.Earclip);
                return(AttachCompoundPolygon(vertList, density, body, userData));
            }

            var fixtures = new List <Fixture>(1);

            fixtures.Add(AttachPolygon(verts, density, body, userData));
            return(fixtures);
        }
        /// <summary>
        /// Creates a rounded rectangle.
        /// Note: Automatically decomposes the capsule if it contains too many vertices (controlled by Settings.MaxPolygonVertices)
        /// </summary>
        /// <param name="world">The world.</param>
        /// <param name="width">The width.</param>
        /// <param name="height">The height.</param>
        /// <param name="xRadius">The x radius.</param>
        /// <param name="yRadius">The y radius.</param>
        /// <param name="segments">The segments.</param>
        /// <param name="density">The density.</param>
        /// <param name="position">The position.</param>
        /// <returns></returns>
        public static List <Fixture> CreateRoundedRectangle(World world, float width, float height, float xRadius,
                                                            float yRadius,
                                                            int segments, float density, Vector2 position)
        {
            Vertices verts = PolygonTools.CreateRoundedRectangle(width, height, xRadius, yRadius, segments);

            //There are too many vertices in the capsule. We decompose it.
            if (verts.Count >= Settings.MaxPolygonVertices)
            {
                List <Vertices> vertList    = EarclipDecomposer.ConvexPartition(verts);
                List <Fixture>  fixtureList = CreateCompoundPolygon(world, vertList, density);
                fixtureList[0].Body.Position = position;
                return(fixtureList);
            }

            return(new List <Fixture> {
                CreatePolygon(world, verts, density)
            });
        }
Example #7
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));
        }
Example #8
0
    void Start()
    {
        // Create Vector2 vertices
        Vector2[] vertices2D = null;

        switch (tipo)
        {
        case Tipo.CAPSULE:
            vertices2D = USVG.PolygonTools.CreateCapsule(Height, Radius, Edges);
            break;

        case Tipo.CIRCLE:
            vertices2D = PolygonTools.CreateCircle(Radius, Edges);
            break;

        case Tipo.ELIPSE:
            vertices2D = PolygonTools.CreateEllipse(Radius, yRadius, Edges);
            break;

        case Tipo.GEAR:
            vertices2D = PolygonTools.CreateGear(Radius, NumberOfTheeth, TipPercentage, ToothHeight);
            break;

        case Tipo.ROUNDED_RECTANGLE:
            vertices2D = PolygonTools.CreateRoundedRectangle(Height, Width, Radius, yRadius, Edges);
            break;

        default:
        case Tipo.RECTANGLE:
            vertices2D = PolygonTools.CreateRectangle(Height, Width);
            break;
        }


        // Use the triangulator to get indices for creating triangles
        Triangulator tr = new Triangulator(vertices2D);

        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[vertices2D.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0);
        }

        // Create the mesh
        Mesh msh = new Mesh();

        msh.vertices  = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();

        // Set up game object with mesh;
        gameObject.AddComponent(typeof(MeshRenderer));
        MeshFilter filter = gameObject.GetComponent <MeshFilter>();

        if (filter == null)
        {
            filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        }

        filter.mesh = msh;
    }
        private void TextureFromDictionary(Dictionary <string, object> shapeParam, out Texture2D texture, out Vertices shapeVertices)
        {
            shapeVertices = null;
            texture       = null;
            ObjectType objectType = (ObjectType)shapeParam[ShapeParametersKeys.ObjectType];

            switch (objectType)
            {
            case ObjectType.Arc:
                shapeVertices = PolygonTools.CreatePreTransformedArt(MathHelper.ToRadians((float)shapeParam[ShapeParametersKeys.ArcDegrees]), (int)shapeParam[ShapeParametersKeys.ArcSides], (float)shapeParam[ShapeParametersKeys.ArcRadius]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);

                //shapeVertices.GetCollisionBox().;
                //Vector2 arcOffset = Vector2.One;
                //shapeVertices.Translate(ref arcOffset);
                break;

            case ObjectType.Capsule:
                shapeVertices = PolygonTools.CreateCapsule((float)shapeParam[ShapeParametersKeys.CapsuleHeight], (float)shapeParam[ShapeParametersKeys.CapsuleBottomRadius], (int)shapeParam[ShapeParametersKeys.CapsuleBottomEdges], (float)shapeParam[ShapeParametersKeys.CapsuleTopRadius], (int)shapeParam[ShapeParametersKeys.CapsuleTopEdges]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Gear:
                shapeVertices = PolygonTools.CreateGear((float)shapeParam[ShapeParametersKeys.GearTipPercentage], (int)shapeParam[ShapeParametersKeys.GearNumberOfTeeth], (float)shapeParam[ShapeParametersKeys.GearTipPercentage], (float)shapeParam[ShapeParametersKeys.GearToothHeigt]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Rectangle:
                shapeVertices = PolygonTools.CreateRectangle((float)shapeParam[ShapeParametersKeys.RectangleWidth], (float)shapeParam[ShapeParametersKeys.RectangleHeight]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.RoundedRectangle:
                shapeVertices = PolygonTools.CreateRoundedRectangle((float)shapeParam[ShapeParametersKeys.RoundedRectangleWidth], (float)shapeParam[ShapeParametersKeys.RoundedRectangleHeight], (float)shapeParam[ShapeParametersKeys.RoundedRectangleXRadius], (float)shapeParam[ShapeParametersKeys.RoundedRectangleYRadius], (int)shapeParam[ShapeParametersKeys.RoundedRectangleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.TextureFromVertices(shapeVertices, (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Ellipse:
                shapeVertices = PolygonTools.CreateEllipse((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (int)shapeParam[ShapeParametersKeys.EllipseNumberOfEdges]);
                texture       = ContentService.GetContentService().AssetCreator.EllipseTexture((float)shapeParam[ShapeParametersKeys.EllipseXRadius], (float)shapeParam[ShapeParametersKeys.EllipseYRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.Circle:
                shapeVertices = PolygonTools.CreateCircle((float)shapeParam[ShapeParametersKeys.CircleRadius], (int)shapeParam[ShapeParametersKeys.CircleSegments]);
                texture       = ContentService.GetContentService().AssetCreator.CircleTexture((float)shapeParam[ShapeParametersKeys.CircleRadius], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale]);
                break;

            case ObjectType.CustomShape:
                if ((bool)shapeParam[ShapeParametersKeys.CustomObjectUseOriginalTexture])
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (Color)shapeParam[ShapeParametersKeys.Color], out texture, out shapeVertices);
                }
                else
                {
                    ContentService.GetContentService().AssetCreator.ShapeFromTexture((string)shapeParam[ShapeParametersKeys.CustomObjectShape], (float)shapeParam[ShapeParametersKeys.CustomObjectScale], (string)shapeParam[ShapeParametersKeys.Material], (Color)shapeParam[ShapeParametersKeys.Color], (float)shapeParam[ShapeParametersKeys.MaterialScale], out texture, out shapeVertices);
                }
                break;

            default:
                throw new Exception("Unknown Shape");
            }
        }
Example #10
0
        public override void Construct()
        {
            Demo.Window.Title = "Game Scene Demo";

            Demo.Camera3D.Position = new Vector3(17f, 9f, 19f);
            Vector2 defaultPositionShift = new Vector2(-100f, 5f);

            Demo.Camera3D.Target = new Vector3(defaultPositionShift.X, defaultPositionShift.Y, 18f);
            _positionStart       = Demo.Camera3D.Target;

            ConstructBusStop();
            ConstructBackground();

            PolygonShape shape = new PolygonShape(1f)
            {
                Vertices = PolygonTools.CreateRoundedRectangle(25f, 6.45566f, 1.5f, 1.5f, 4)
            };

            _chassis3D =
                Body3DFactory.CreateBody3D(
                    _bodyModel,
                    Demo.World3D.World2D,
                    Demo.GraphicsDevice,
                    defaultPositionShift,
                    BodyType.Dynamic,
                    new Vector2(25f, 6.45566f));

            Demo.World3D.AddBody3D(_chassis3D);

            #region Přední náprava

            Vector2 frontPosition = new Vector2(6.996475f, -2.9f) + defaultPositionShift;
            Vector2 axis          = new Vector2(0f, 1.2f);

            _frontWheels = new Body();
            _frontWheels.CreateCircle(1.3163165f, 1f);

            _frontWheels3D =
                Body3DFactory.CreateBody3D(
                    _frontWheelsModel,
                    Demo.World3D.World2D,
                    _frontWheels,
                    frontPosition);

            _springFront = new WheelJoint(_chassis3D.Body2D, _frontWheels, frontPosition, axis, true)
            {
                MotorSpeed     = 0f,
                MaxMotorTorque = 10f,
                MotorEnabled   = false,
                Frequency      = 4f,
                DampingRatio   = 0.7f
            };
            Demo.World3D.World2D.Add(_springFront);

            Demo.World3D.AddBody3D(_frontWheels3D);

            #endregion Přední náprava

            #region Zadní náprava

            Vector2 backPosition = new Vector2(-5.973385f, -2.9f) + defaultPositionShift;

            _backWheels = new Body();
            _backWheels.CreateCircle(1.364622f, 1f);

            _backWheels3D =
                Body3DFactory.CreateBody3D(
                    _backWheelsModel,
                    Demo.World3D.World2D,
                    _backWheels,
                    backPosition);

            _springBack = new WheelJoint(_chassis3D.Body2D, _backWheels, backPosition, axis, true)
            {
                MotorSpeed     = DEFAULT_MOTOR_SPEED,
                MaxMotorTorque = MAX_MOTOR_TORQUE,
                MotorEnabled   = true,
                Frequency      = 4f,
                DampingRatio   = 0.7f
            };
            Demo.World3D.World2D.Add(_springBack);

            Demo.World3D.AddBody3D(_backWheels3D);

            #endregion Zadní náprava

            #region Rampa

            _ramp3D = Body3DFactory.CreateBody3D(
                _rampModel,
                Demo.World3D.World2D,
                Demo.GraphicsDevice,
                new Vector2(0f, 5f));
            Demo.World3D.AddBody3D(_ramp3D);

            #endregion Rampa
        }