Mesh LOD for disabling and enabling mesh instances


#1

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.


#2

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


#3

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


#4

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


#5

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);
        }
    }
}