On tap, entire Lens reloads. Only want the images to cycle through

Options

Hey everyone,

I have a Lens that cycles through images for an Art Gallery. On every tap, the entire lens reloads and everything disappears for a second. How can I prevent everything from disappearing momentarily on the reload? I only want the images to cycle through. Even the frame (.OBJ) flashes when the images change.
What am I missing?

Thank You!!

Answers

  • audun
    audun Posts: 302 🔥🔥🔥
    Options

    Hi @Virtual Reality Xperience,
    Is this what you're looking for?

    // -----CRX CODE-----
    
    // @input SceneObject[] obj
    
    var count = 0;
    
    script.obj[0].enabled = true;
    
    for (var i = 1; i < script.obj.length; i++) {
            script.obj[i].enabled = false;
    }
    
    function onTapped(eventData) {
            count++;
    
            for (var i = 0; i < script.obj.length; i++) {
                    if (count == i) {
                            script.obj[i].enabled = true;
                    } else {
                            script.obj[i].enabled = false;
                    }
            }
    
            if (count == script.obj.length) {
                    count = 0;
    
                    script.obj[0].enabled = true;
            }
    }
    
    var event = script.createEvent('TapEvent');
    
    event.bind(onTapped);