addBreakableBody() public method

public addBreakableBody ( BreakableBody breakableBody ) : void
breakableBody BreakableBody
return void
Example #1
0
		public static BreakableBody CreateBreakableBody( World world, IEnumerable<Shape> shapes, Vector2 position = new Vector2(), float rotation = 0 )
		{
			var breakableBody = new BreakableBody( world, shapes, position, rotation );
			breakableBody.mainBody.position = position;
			world.addBreakableBody( breakableBody );
			return breakableBody;
		}
Example #2
0
		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 );

			var breakableBody = new BreakableBody( world, triangles, density, position, rotation );
			breakableBody.mainBody.position = position;
			world.addBreakableBody( breakableBody );
			return breakableBody;
		}