Global Objects
Provides guidance on global objects.
Global Object is a predefined object that is easily accessible from anywhere within the script.
WORLD
Indicates the 3D Scene containing all 3D objects.
const box = WORLD.getObject("BOX");
const sphere = WORLD.getObject("SPHERE");
GUI
Indicates the GUI Scene that contains all the GUI.
const scoreBoard = GUI.getObject("SCORE_BOARD");
const timerUI = GUI.getObject("TIMER_UI");
PLAYER
Represents the playerβs avatar.
const speedUpItem = WORLD.getObject("SPEED_UP_ITEM");
PLAYER.onCollide(speedUpItem, () => {
speedUpItem.kill();
PLAYER.changePlayerSpeed(1.5);
});
GLOBAL
Used for linking other properties or methods to a global object.
Script 1
GLOBAL.time = 10;
Script 2
if (GLOBAL.time > 10) {
//do something
}
The following Global Objects are available in Server Script and Client Script.
Text | Server Script | Client Script |
---|---|---|
WORLD | β | β |
GUI | β | β |
PLAYER | β | β |
GLOBAL | β | β |