onFrameTick

Platform Compatibility PC Mac OSX Oculus Quest X X X onFrameTick triggers every frame with a deltaTime variable for keeping value changes consistent no matter what FPS the application runs at Parameters: dt A decimal number that is used to adjust for fluctuations in framerate Example: 1234function onFrameTick(dt)     –Adds up by 1 every … Read more onFrameTick

onGlobalMessage

Platform Compatibility PC Mac OSX Oculus Quest X X X onGlobalMessage triggers when a global message has been sent and this object receives it Parameters: data A string containing data Example: 12345function onGlobalMessage(data)     if data == "activate" then         –Do something     end end

onCollisionExit

Platform Compatibility PC Mac OSX Oculus Quest X X X onCollisionExit runs after a collision event has ended, such as two physics objects repelling each other as they are both solid. Parameters: name A string showing the name of the object tag A string showing the tag of the object object UID A string for … Read more onCollisionExit

onCollisionEnter

Platform Compatibility PC Mac OSX Oculus Quest X X X onCollisionEnter runs right when a collision event has started, such as two physics objects about to determine the result of their collisions. Parameters: name A string showing the name of the object tag A string showing the tag of the object object UID A string … Read more onCollisionEnter

onTriggerExit

Platform Compatibility PC Mac OSX Oculus Quest X X X onTriggerExit runs after leaving a trigger. As triggers are not solid, you may find that this runs quite some time after the onTriggerEnter effect, and generally is useful for things like automated doors or activating a chain of events when leaving an area. Parameters: name … Read more onTriggerExit

onTriggerEnter

Platform Compatibility PC Mac OSX Oculus Quest X X X onTriggerEnter runs when first entering a trigger, which is not solid and will happily allow a solid object to sit within its trigger zone. Parameters: name A string showing the name of the object tag A string showing the tag of the object object UID … Read more onTriggerEnter

LUA Basics

Although there are plenty of better tutorials out there online, this is a sort of “cheat sheet” for coding that may still help even if you have had experience with another coding language before Artspark’s inner engine functionality is wrapped under a single object simply called “obj” Comments are lines of text that you can … Read more LUA Basics

onClick

Platform Compatibility PC Mac OSX Oculus Quest X X X onClick triggers whenever the object is clicked on with a mouse or a VR hand trigger Parameters: type An integer value between 0 and 4 0 – Left click 1 – Left hand trigger (VR) 2 – Right hand trigger (VR) 3 – Right click … Read more onClick

Built-In Functions

Built-in functions of the scripting language will run when the engine determines that an event has triggered them, they always exist but will only run if you write a custom function inside the script to take advantage of them.

Script Lifecycle

Every object except the Player Start Position can have a single script attached to them. The script can have multiple custom functions and take advantage of built-in functions, and has its own memory pool for variables. Scripts have the ability to change their own object, impact other objects, and also store global variables or send … Read more Script Lifecycle