Coming soon toSteam
Modding docsAPI 1

Module · Engine client only

world

Put your own objects in the world, and ask about what is there. Needs the "world" permission.

world.camera(): table?

client only

Where the camera is and which way it looks.

world.empty(name?: string, options?: any): Object

client only

Creates an empty object, to attach lights or sounds to, or to follow something.

local marker = world.empty("host-marker")

world.gravity(): vec3

client only

How strong gravity is, in metres per second squared.

world.me(): vec3?

client only

Where the player you are is standing, or nil.

world.raycast(origin: vec3, direction: vec3, distance?: number): table?

client only

Fires a ray and returns what it hit, or nil. Distance is in metres.

local hit = world.raycast(cam.position, cam.forward, 50)
if hit then log.info("hit at", hit.point) end

world.shape(shape: string, options?: any): Object

client only

Creates a simple shape without needing a model file: "cube", "sphere", "capsule", "cylinder" or "quad".

local marker = world.shape("sphere", { position = vec3(0, 2, 0), color = color("#ff4040") })

world.spawn(modelPath: string, options?: any): Object

client only

Puts one of your models in the world.

local ball = world.spawn("models/sphere.glb", { position = vec3(0, 3, 0), scale = vec3(0.5, 0.5, 0.5) })