Exemplo n.º 1
0
 public override Shape Clone()
 {
     LoopShape loop = new LoopShape();
     loop._density = _density;
     loop._radius = _radius;
     loop.Vertices = Vertices;
     loop.MassData = MassData;
     return loop;
 }
Exemplo n.º 2
0
 public static Fixture AttachLoopShape(Vertices vertices, PhysicsBody body, object userData)
 {
     LoopShape shape = new LoopShape(vertices);
     return body.CreateFixture(shape, userData);
 }
Exemplo n.º 3
0
        //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]));
                }
            }
        }