public override Shape Clone() { LoopShape loop = new LoopShape(); loop._density = _density; loop._radius = _radius; loop.Vertices = Vertices; loop.MassData = MassData; return loop; }
public static Fixture AttachLoopShape(Vertices vertices, PhysicsBody body, object userData) { LoopShape shape = new LoopShape(vertices); return body.CreateFixture(shape, userData); }
//Contributed by Matthew Bettcher /// <summary> /// Convert a path into a set of edges and attaches them to the specified body. /// Note: use only for static edges. /// </summary> /// <param name="path">The path.</param> /// <param name="body">The body.</param> /// <param name="subdivisions">The subdivisions.</param> public static void ConvertPathToEdges(Path path, PhysicsBody body, int subdivisions) { Vertices verts = path.GetVertices(subdivisions); if (path.Closed) { LoopShape loop = new LoopShape(verts); body.CreateFixture(loop); } else { for (int i = 1; i < verts.Count; i++) { body.CreateFixture(new EdgeShape(verts[i], verts[i - 1])); } } }