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

CreateChain() public method

Create a chain with isolated end vertices.
public CreateChain ( 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 CreateChain(Vec2[] vertices, int count)
        {
            Debug.Assert(Vertices == null && Count == 0);
            Debug.Assert(count >= 2);
            Count = count;
            Vertices = new Vec2[Count];
            for (int i = 0; i < Count; i++)
            {
                Vertices[i] = new Vec2(vertices[i]);
            }
            HasPrevVertex = false;
            HasNextVertex = false;
        }

Usage Example

Esempio n. 1
0
        public override Shape Clone()
        {
            ChainShape clone = new ChainShape();

            clone.CreateChain(Vertices, Count);
            clone.m_prevVertex.Set(m_prevVertex);
            clone.m_nextVertex.Set(m_nextVertex);
            clone.HasPrevVertex = HasPrevVertex;
            clone.HasNextVertex = HasNextVertex;
            return(clone);
        }
All Usage Examples Of Box2D.Collision.Shapes.ChainShape::CreateChain