I tried to set unique materials to a specific fragmentMesh. However, it turns out that the fragmentMesh can have multiple instances and thus the material is being applied to all its instances.
- How can I tell which instance my raycasting intersect.object is pointing to ?
const raycaster = viewer.raycaster;
const intersect: Intersection | null =
raycaster.castRay([
...this.components.meshes,
]);
const obj3d = intersect.object;
- and then use that data to map it to its respective mesh geometry/bufferGeometry so I can set the paint material

regards
Apparently, the OBC.MaterialManager class from the library doesn't provide a way to set the material color for an individual instance. https://github.com/ThatOpen/engine_components/blob/main/src/core/MaterialManager/index.ts#L57
Indeed, the fragmentMesh extends from the instancedMesh class and the quick solution is to use the pure threejs library: sample here: https://github.com/mrdoob/three.js/blob/master/examples/webgl_instancing_raycast.html