Scripting

Search The Documentation:

  1. Home
  2. Docs
  3. Scripting
  4. Examples
  5. Player Color Changer

Player Color Changer

Platform Compatibility

PC Mac OSX Oculus Quest
X X X

Change the color of the player when clicked using setPlayerColor

1
2
3
4
5
6
7
8
--Set player to a random color when this is clicked
function onClick(type)
    r = obj.random(0, 1)
    g = obj.random(0, 1)
    b = obj.random(0, 1)
   
    obj.setPlayerColor(r .. ',' .. g .. ',' .. b .. ',1')
end
Tags
Was this article helpful to you? Yes No

How can we help?