World extends Object, adding functions and properties to it.
World is not creatable, there's only one instance of it. It can only be accessed through its globally exposed variable.

World is the Object at the root of the 3D scene.


Inherited from Object


Adds given Object as a child.

Object extensions like Shape or MutableShape are naturally accepted too.

By default, when using AddChild, the child maintains it's LocalPosition. But since the local position remains the same in the new parent, it means the child's world position may change.

The keepWorld optional parameter, false by default, can be used to maintain the child's Position (world position) instead.

It's also a good practice to set child/parent relationships before setting positions.

local o = Object()
local myShape = Shape(Items.someuser.someitem)

Unsets parent/child relationship with child parameter. The child ends up being deleted if it has no other references.


Unsets parent/child relationship with all children. Individual children end up being deleted if they have no other references.

nil GetChild ( integer index )

Get child Object at index.

if o.ChildrenCount > 0 then
  print(o:GetChild(1)) -- prints first child

Get World's parent.



Inherited from Object


nil by default. Can be set to a function that will be triggered when the World ends colliding with another Object.

The function is called with 2 parameters: the object the callback was set for and the other actor in the collision.

object.OnCollisionEnd = function(o1, o2)
  -- `o1` is `object` here
  print("collision ended between", o1, "and", o2)

Executed when the Pointer is dragged (moved while down). Receives a PointerEvent parameter, just like Pointer.Drag.

(nil by default)

myObject.OnPointerDrag = function(pointerEvent)
  print("dx:", pointerEvent.DX, "dy:", pointerEvent.DY)

Tick is a function executed ~30 times per second when set (nil by default). Provides the World and elapsed time in seconds as parameters.

-- executed ~30 times per second on each user device
myObject.Tick = function(object, dt)
  print("elapsed:", dt, "seconds")

Returns number of child Objects.