Toggling AO on and off


I’m looking for a way to toggle AO maps on and off. Choosing ‘Vertex Color’ in the Ambience panel is a quick way to do it in the interface, but looking through the documentation I didn’t see any easy way to do that with code, or to turn the AO on/off using other methods in code.

A good project to reference is the Terminator T800 demo:

It has a script (placed on the root node) that toggles AO maps on materials assigned via a script attribute.

The script responds to an event called ‘ao’ that is fired from the UI script:

        var aoButton = document.getElementById('ao');
        aoButton.addEventListener('click', function (e) {
        }, true);