Box2D.Collision.Shapes.ChainShape.CreateLoop C# (CSharp) Method

CreateLoop() public method

Create a loop. This automatically adjusts connectivity.
public CreateLoop ( Vec2 vertices, int count ) : void
vertices Box2D.Common.Vec2 an array of vertices, these are copied
count int the vertex count
return void
        public void CreateLoop(Vec2[] vertices, int count)
        {
            Debug.Assert(Vertices == null && Count == 0);
            Debug.Assert(count >= 3);
            Count = count + 1;
            Vertices = new Vec2[Count];
            for (int i = 0; i < count; i++)
            {
                Vertices[i] = new Vec2(vertices[i]);
            }
            Vertices[count] = Vertices[0];
            m_prevVertex.Set(Vertices[Count - 2]);
            m_nextVertex.Set(Vertices[1]);
            HasPrevVertex = true;
            HasNextVertex = true;
        }