How to make an doubleclicktrigger(action manager) on a invisible mesh(isEnabled is false)

i have a ground when i double click on it isenabled trun to false and invisible i want to double click again on the same place (on the invisible ground) and make it visible again

ground1.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(
{
trigger: BABYLON.ActionManager.OnDoublePickTrigger,
},
function () {
if(ground1.isEnabled()){
ground1.setEnabled(ground1.isEnabled() ? false : true);
}else{
ground1.setEnabled(ground1.isEnabled() ? true : false);
}
}
)
);

You could drop the opacity to 0 or maybe try isVisible here ?

1 Like