AttachPolygon() публичный статический Метод

public static AttachPolygon ( Vertices vertices, float density, Body body, object userData = null ) : Fixture
vertices Vertices
density float
body FarseerPhysics.Dynamics.Body
userData object
Результат FarseerPhysics.Dynamics.Fixture
Пример #1
0
        public static Body CreatePolygon(World world, Vertices vertices, float density, Vector2 position, object userData = null)
        {
            Body body = CreateBody(world, position);

            FixtureFactory.AttachPolygon(vertices, density, body, userData);
            return(body);
        }
Пример #2
0
        public static Body CreatePolygon(World world, Vertices vertices, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null)
        {
            var body = CreateBody(world, position, rotation, bodyType);

            FixtureFactory.AttachPolygon(vertices, density, body, userData);
            return(body);
        }
Пример #3
0
        public static Body CreatePolygon(World world, Vertices vertices, float density, Vector2 position,
                                         PressPlay.FFWD.Component userData)
        {
            Body body = CreateBody(world, position);

            FixtureFactory.AttachPolygon(vertices, density, body, userData);
            return(body);
        }
Пример #4
0
        public static Body CreateRectangle(World world, float width, float height, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null)
        {
            if (width <= 0)
            {
                throw new ArgumentOutOfRangeException("width", "Width must be more than 0 meters");
            }

            if (height <= 0)
            {
                throw new ArgumentOutOfRangeException("height", "Height must be more than 0 meters");
            }

            Body body = CreateBody(world, position, rotation, bodyType, userData);

            Vertices rectangleVertices = PolygonTools.CreateRectangle(width / 2, height / 2);

            FixtureFactory.AttachPolygon(rectangleVertices, density, body);

            return(body);
        }