I’m working on simulation of building IFC model in time. I want elements to change its material when they reach their timeEnd. It works, but the problem is that elements share same mesh, so when 1 element of mesh reaches timeEnd, it changes material of whole mesh. Should I clone mesh for every element, then change its material?
function processTimeStep(entry, time) {
const expressID = entry.expressID;
const isStartTime = entry.timeStart === time
const isEndTime = entry.timeEnd === time
const fragmentId = findFragmentIdByExpressId(expressID, model.getFragmentMap([expressID]));
const fragmentMap = model.getFragmentMap([expressID]);
if (fragmentId) {
const fragment = fragments.list[fragmentId];
const itemMesh = fragment.mesh;
if (isStartTime) {
hider.set(true, fragmentMap)
} else if (isEndTime) {
itemMesh.material = fragment.originalMaterial;
}
}
}