Skip to main content

Object

Client Server

The object visible in the hierarchy. Every object has a transform and can have additional components attached to it.

Methods

Vec3 LocalToWorld(Vec3 point)

Vec3 WorldToLocal(Vec3 point)

Vec3 LocalToWorldVec(Vec3 vec)

Vec3 WorldToLocalVec(Vec3 vec)

nil LookAt(Vec3 pos)

nil LookAt(Vec3 pos, Vec3 up)

Object? GetChild(string name)

Get child object by name

Script AddScript(string fileName, boolean sync)

MeshData AddMeshData()

VoxelData? AddVoxelData(string fileName)

StaticVoxelData? AddStaticVoxelData(string fileName)

VoxelRenderer AddVoxelRenderer()

Camera AddCamera()

Sky AddSkybox()

boolean RemoveParent()

boolean RemoveComponent(Component component)

boolean RemoveComponent(string componentType)

Component? GetComponentByType(string typeName)

Find a component by type name. Returns the first component found

Component[] GetComponentsByType(string typeName)

Find all components by type name

Component? GetComponent(string typeName)

Component[] GetComponents(string typeName)

Component AddComponent(string componentType)

boolean IsPrefab()

boolean IsPrefab(string name)

Object[] WithChildren()

Object[] WithChildren(boolean includeInactive)

get the object and all its children, descendants, does not returns destroyed objects

ScriptInstance FindScript(string name)

Find attached script component lua table by name

boolean HasScript(string name)

number GetTotalVolume(string stopIfChildObjHasScript)

Volume of all the VoxelData components in the object and all its children

string GetNetworkFlow()

string GetScriptUpdateTime()

integer GetRefCount()

Properties

Vec3 Pos

number PosX

number PosY

number PosZ

Quat Rot

Vec3 EulerRot

number Scale

Vec3 LocalPos

Quat LocalRot

Vec3 LocalEulerRot

number LocalScale

Vec3 Right

Vec3 Up

Vec3 Forward

string Name

boolean Active

boolean ActiveInHierarchy

boolean Save

Transform Transform

boolean IsDestroyed

string Id

Object? Parent

Object[] Children

integer SiblingIndex

boolean IsPrefabObject

Component[] Components

VoxelData? VoxelData

VoxelRenderer? VoxelRenderer

RigidBody? RigidBody

string name

boolean active

Set the object to be active or inactive. Inactive objects are not updated or rendered. All its children also become inactive.

boolean activeInHierarchy

Readonly. Check if the object is active in the scene. It may be inactive because a parent is inactive.

boolean save

Save this object in the hierarchy. If not saved it will be deleted after lua reset or server restart

Transform transform

Get the transform to modify the position, rotation and scale of the object

boolean isDestroyed

True if the object was destroyed. Note that references to this object will still be valid

string id

This is id is unique across clients and server

Object? parent

Object[] children

integer childCount

integer siblingIndex

boolean isPrefabObject

Component[] components

integer componentsCount