public static BreakableBody CreateBreakableBody(World world, IEnumerable<Shape> shapes, Vector2 position = new Vector2(), float rotation = 0) { BreakableBody breakableBody = new BreakableBody(world, shapes, position, rotation); breakableBody.MainBody.Position = position; world.AddBreakableBody(breakableBody); return breakableBody; }
public static BreakableBody CreateBreakableBody(World world, IEnumerable<Shape> shapes, Vector2 position) { BreakableBody breakableBody = new BreakableBody(shapes, world); breakableBody.MainBody.Position = position; world.AddBreakableBody(breakableBody); return breakableBody; }
public static BreakableBody CreateBreakableBody(World world, Vertices vertices, float density, Vector2 position = new Vector2(), float rotation = 0) { //TODO: Implement a Voronoi diagram algorithm to split up the vertices List<Vertices> triangles = Triangulate.ConvexPartition(vertices, TriangulationAlgorithm.Earclip); BreakableBody breakableBody = new BreakableBody(world, triangles, density, position, rotation); breakableBody.MainBody.Position = position; world.AddBreakableBody(breakableBody); return breakableBody; }
/// <summary> /// Creates a breakable body. You would want to remove collinear points before using this. /// </summary> /// <param name="world">The world.</param> /// <param name="vertices">The vertices.</param> /// <param name="density">The density.</param> /// <param name="position">The position.</param> /// <returns></returns> public static BreakableBody CreateBreakableBody(World world, Vertices vertices, float density, Vector2 position) { List<Vertices> triangles = EarclipDecomposer.ConvexPartition(vertices); BreakableBody breakableBody = new BreakableBody(triangles, world, density); breakableBody.MainBody.Position = position; world.AddBreakableBody(breakableBody); return breakableBody; }
/// <summary> /// Creates a breakable body. You would want to remove collinear points before using this. /// </summary> /// <param name="world">The world.</param> /// <param name="vertices">The vertices.</param> /// <param name="density">The density.</param> /// <param name="position">The position.</param> /// <returns></returns> public static BreakableBody CreateBreakableBody(World world, Vertices vertices, float density, Vector2 position, PressPlay.FFWD.Components.Collider userData) { List<Vertices> triangles = EarclipDecomposer.ConvexPartition(vertices); BreakableBody breakableBody = new BreakableBody(triangles, world, density, userData); breakableBody.MainBody.Position = position; world.AddBreakableBody(breakableBody); return breakableBody; }