get

Makes the given BufferPrimitive a view onto this collection's primitive at the given index, for use when reading/writing primitive properties. When iterating over a large collection, prefer to reuse the same BufferPrimitive instance throughout the loop — rebinding an existing instance to a different primitive is cheap, and avoids allocating in-memory objects for every object.

const primitive = new BufferPrimitive();
for (let i = 0; i < collection.primitiveCount; i++) {
collection.get(i, primitive);
primitive.setColor(Color.RED);
}

Return

The BufferPrimitive instance passed as the 'result' argument, now bound to the specified primitive index.

See also