Mesh LOD for disabling and enabling mesh instances

Allow users to select which mesh instances to draw in a model. I have a model with several meshes as children all labeled “something_lod1” …_lod2 would be nice to set which ones to draw or not without having to switch assets on the model component.

Maybe you need https://developer.playcanvas.com/en/api/pc.MeshInstance.html#visible ?

have you gotten this to work? I have set it to false and not seen any change.

Yes, I set meshInstance.visible to false if I don’t want to render it.

1 Like

for anyone looking for a solution


function disableMeshInstance(meshInstance, app) {
    for(var index in app.scene.drawCalls) {
        var dcs = app.scene.drawCalls[index];
        if(dcs.node.name==meshInstance.name) {
            app.scene.drawCalls.splice(index, 1);
        }
    }
}
1 Like