Viewer.mode can’t be changed during runtime?

It seems like setting viewer.mode to different settings has no effect anymore. Is this intentional? I had an onscreen button in Voxel Editor that was used for that.

@UberGoober Heres some code that changes viewer mode during run time. Tap the screen to keep changing viewer mode.


viewer.mode=FULLSCREEN

function setup()
    fill(255)    
end

function draw()
    background(0)
    if vms then
        text("viewer mode standard",WIDTH/2,HEIGHT/2)
    else
        text("viewer mode full screen",WIDTH/2,HEIGHT/2)
    end
end
    
function touched(t)
    if t.state==BEGAN then
        if vms then
            vms=false
            viewer.mode=FULLSCREEN
        else
            vms=true
            viewer.mode=STANDARD
        end
    end
end

@dave1707 I ran your code, and it worked, and I felt dumb, and then I ran my own, and it didn’t work, and I felt not dumb.

--# Main
viewer.mode = OVERLAY

function setup()
    scene = craft.scene()
    viewer = scene.camera:add(OrbitViewer, vec3(0,10,0), 20, 1, 100)
end

function draw()
end

function touched(touch)
    print("yes touched got called")
    if touch.state == BEGAN then
        if viewer.mode == STANDARD then
            viewer.mode = OVERLAY 
        else
            viewer.mode = STANDARD
        end
    end
end

…for me, this does not respond to touches.

I added some text statements in draw. Your touched code is working as far as I can tell.


--# Main
viewer.mode = OVERLAY

function setup()
    textMode(CORNER)
    fill(255)
end

function draw()
    background(0)
    if viewer.mode == STANDARD then
        text("in standard mode",10,HEIGHT/3)
    else
        text("in overlay mode",10,HEIGHT/3)
    end
end

function touched(touch)
    print("yes touched got called")
    if touch.state == BEGAN then
        if viewer.mode == STANDARD then
            viewer.mode = OVERLAY 
        else
            viewer.mode = STANDARD
        end
    end
end   

@UberGoober You may feel a little silly but here’s your problem! :sweat_smile: Easily done though