World
World is the Object at the root of the 3D scene.
Functions
Inherited from Object
HideAdds 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) o:AddChild(myShape)
Unsets parent/child relationship with child parameter. The child ends up being deleted if it has no other references.
o:RemoveChild(someChildObject)
Unsets parent/child relationship with all children. Individual children end up being deleted if they have no other references.
o:RemoveChildren()
Get child Object at index.
if o.ChildrenCount > 0 then print(o:GetChild(1)) -- prints first child end
Properties
Inherited from Object
Hidenil 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) end
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) end
Returns number of child Objects.