public static Body createCircle(World world, float radius, float density, Vector2 position = new Vector2(), BodyType bodyType = BodyType.Static, object userData = null) { var body = createBody(world, position, 0, bodyType); FixtureFactory.attachCircle(radius, density, body, userData); return(body); }
public static Body createCapsule(World world, float height, float endRadius, float density, Vector2 position = new Vector2(), float rotation = 0, BodyType bodyType = BodyType.Static, object userData = null) { //Create the middle rectangle var rectangle = PolygonTools.createRectangle(endRadius, height / 2); var list = new List <Vertices>(); list.Add(rectangle); var body = createCompoundPolygon(world, list, density, position, rotation, bodyType, userData); //Create the two circles FixtureFactory.attachCircle(endRadius, density, body, new Vector2(0, height / 2)); FixtureFactory.attachCircle(endRadius, density, body, new Vector2(0, -(height / 2))); return(body); }