Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. Examples
  5. Picture Slideshow

Picture Slideshow

Platform Compatibility

PC Mac OSX Oculus Quest
X X X

Change the texture on an object every few seconds, looping between a number of pictures forever.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--The base picture name
picturename = "picture"
--The time between picture changes
slideTime = 3
--The number of pictures
maxslides = 3

--The current picture
slide = 1
--Load the default picture
obj.loadTexture(picturename .. slide .. ".png")
--Set the timer to 0
timer = 0

function onFrameTick(dT)
    timer = timer + dT
    if timer > slideTime then
        obj.loadTexture(picturename .. slide .. ".png")
        slide = slide + 1
        if slide > maxslides then
            slide = 1
        end
        timer = 0
    end
end
Tags
Was this article helpful to you? Yes No

How can we help?