Skip to content

World Drawing

The World Drawing API allows you to draw on the game world. This is useful for debugging, creating visual aids, or replay analysis.

Usage

There are only three functions in the World Drawing API:

World.drawLine()
World.drawPoint()
World.clear()

World.drawLine()

World.drawLine(startPos: Vec3, endPos: Vec3, r: number, g: number, b: number, thickness: number, lifetime: number)

This draws a line from startPos to endPos with the specified color and thickness. The line will disappear after the specified lifetime in seconds. If a lifetime of 0 is specified, the line will be permanent until World.clear() is called.

World.drawPoint()

World.drawPoint(position: Vec3, r: number, g: number, b: number, pointSize: number, lifetime: number)

This draws a point at position with the specified color and size. The line will disappear after the specified lifetime in seconds. If a lifetime of 0 is specified, the line will be permanent until World.clear() is called. The point size is in screen pixels, and will scale when you get closer or further from the point in the game world.

World.clear()

World.clear()
This removes all lines and points drawn on the world, even if they were set to be permanent.