Toggling AO on and off

Hi,

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:

https://playcanvas.com/project/348970/overview/terminator-t800

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

https://playcanvas.com/editor/code/348970/ao.js

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) {
            app.fire('ao');
        }, true);