THREE.InstancedMesh draws a body of every copy. Thus a storey with 40 chairs draws each chair body one time, not 40 times. The copies stay real elements with their own ids and edits.
Before you start
You have a session with a storey that has two or more copies of one block. See Place furniture.Find the objects that draw the copies
Each object that draws copies has the nameinstanced:<assetRef>:<bodyKey> and the data userData.floorkitInstanced. Its kind is surface, symbol-fill or symbol-lines. The walls, slabs, roofs, columns, beams, stairs and railings of a storey draw through batches with the kind batched or batched-outline, and the lines and plan fills of a storey through merged-lines and merged-fill; the code below does not touch them. To style these elements, set their appearance.
- Set the material on the instanced object, not on the copies. The copies are not drawn.
- Floorkit sets the material only when it makes the object. After an edit of a storey, the new object of the same name gets your material again.
- A new build of the session (an asset edit) makes new objects. Call
styleBlockagain insession.subscribe.
Colour one copy
elementIds[i] is the element of instance i. One element can own several instances, such as the balusters of a railing.
Pick a copy
A raycaster hits the instanced object, not the copy.instancedElementId(hit) gives the id of the copy. A hit on a batched wall or slab has batchId; instancedElementId(hit) gives the id of that element too. See instanced drawables.