-
Notifications
You must be signed in to change notification settings - Fork 0
Update, Click and Init scripts
Update script are scripts you can write for each mesh that runs once every rendered frame. Update scripts are useful for creating looped animations or to update leaderboards.
Click script are scripts you can write for each mesh that runs when the mesh is clicked in the HorangHill client. Click scripts are useful for creating coins, buttons and more.
The current mesh is declared as mesh
and the scene is declared as scene
to remove the mesh you can do the following:
scene.remove(mesh)
Init script are scripts you can write for each mesh that runs when the mesh is loaded in the HorangHill client. Unlike the others, init script only runs once when it is loaded in the scene.
To change the background skybox in HorangHill, You can make a part that have a size of (0, 0, 0 aka invisible) then in the init script we can add the following:
scene.background = new THREE.Color(0x005A9C);
You can spawn HTML elements in the client sidebar, this can be useful for showing the player stats or can act as clickable buttons here is an example:
var button = document.createElement('a')
button.innerText = "Hello, Horanger!"
document.getElementById('topsidebar').appendChild(button)
This is an example on how to toggle the sidebar when the ESC key is pressed.
document.addEventListener('keydown', function(event) {
if(event.keyCode == 27) {
toggleSideBar()
}
});