public static Body CreateEllipse(World world, float xRadius, float yRadius, int edges, float density, Vector2 position, PressPlay.FFWD.Component userData) { Body body = CreateBody(world, position); FixtureFactory.AttachEllipse(xRadius, yRadius, edges, density, body, userData); return(body); }
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); }
public static Body CreateRectangle(World world, float width, float height, float density, Vector2 position, PressPlay.FFWD.Component userData) { 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 newBody = CreateBody(world, position); Vertices rectangleVertices = PolygonTools.CreateRectangle(width / 2, height / 2); PolygonShape rectangleShape = new PolygonShape(rectangleVertices, density); newBody.CreateFixture(rectangleShape, userData); return(newBody); }
public static Body CreateEllipse(World world, float xRadius, float yRadius, int edges, float density, PressPlay.FFWD.Component userData) { return(CreateEllipse(world, xRadius, yRadius, edges, density, Vector2.Zero, userData)); }