Lua ScriptingAdvanced

gameObject API reference

Signatures for transforms, physics, lookup, audio, GUI, hierarchy, vehicles, and constraints.

Identity, lookup, and variables

SignatureResult
gameObject.idCurrent object UUID
getVar(name)number, string, boolean, object API, or nil
setVar(name, value)Updates a primitive object variable
getObject(uuid)Object API or nil
getObjectByName(name)Exact-name match or nil
getObjectsByNamePrefix(prefix)Array of object APIs
getObjectsByType(type)Array of object APIs

Transforms and hierarchy

getPosition(), setPosition(x,y,z), getRotation(), setRotation(x,y,z,w), rotate(x,y,z), getParent(), getChildren(), setParent(parentIdOrNil), getWorldPosition(), getWorldRotation(), getWorldScale(), getLocalPosition(), getLocalRotation(), getLocalScale(), getForward(), getRight(), isRoot().

Physics and queries

addForce(x,y,z), addImpulse(x,y,z), addTorque(x,y,z), registerForCollisions(), deregisterForCollisions(), raycast(direction,maxDistance), sphereQuery(radius), boxQuery(halfExtents).

Characters and animation

isOnGround(), getGroundInfo(), getCharacterVelocity(), setCharacterVelocity(x,y,z), jump(), setCrouched(crouched), isCrouched(), isInWater(), getWaterSubmersion(), plus the animation API.

Rendering, GUI, and audio

getLightColor(), setLightColor(color), getLightIntensity(), setLightIntensity(value), getLightGroundColor(), setLightGroundColor(color), setText(text), setTextColor(r,g,b), setBackgroundColor(r,g,b,a), setFontSize(size), setVisible(visible), setImageAsset(assetId), playSound(assetId, options).

Vehicles and constraints

Vehicle and constraint signatures are documented in Vehicles and navigation.