Skip to main content
Version: 0.10.0

UeObject3D

The base class for all 3D entities in Unique Engine. Inherits from UeTransform, and acts as a hierarchical scene graph node.

Constructor​

new UeObject3D(data = {})

Inherits from UeTransform

Data parameters​

KeyTypeDefaultDescription
namestring""Optional object name
visiblebooleantrueVisibility flag
parentUeObject3DundefinedParent object in the hierarchy
renderOrdernumber0Custom sort order for rendering
castShadowbooleanfalseWhether this object casts shadows
receiveShadowbooleanfalseWhether this object receives shadows
gmObjectstringundefinedGameMaker object name to instantiate (e.g. "objPlayer") when this object is created by UeProjectLoader
gmLayerstring"Instances"GameMaker layer name for the instantiation
prefabUeObject3DundefinedThe original asset this object is an instance of (set automatically when dragging assets into a scene (Scene Editor)

Properties​

PropertyTypeDefaultDescription
isObject3DbooleantrueIndicates that this is an Object3D
typestring"Object3D"Object type
idnumber(auto-generated)Incremental object ID
uuidstring(auto-generated)Randomly generated unique identifier
namestring""Optional object name
visiblebooleantrueVisibility flag
parentUeObject3DundefinedParent object in the scene graph
childrenarray[]Array of child objects
renderOrdernumber0Overrides render sort when rendering
layersUeLayersLayers with membership set to layer 0 by default
userDatastructA struct where to safely place custom related data for this entity
gmObjectstringundefinedGameMaker object name to instantiate with this 3D object
gmLayerstring"Instances"GameMaker layer name where the object will be instantiated
prefabUeObject3DundefinedReference to the source prefab/asset this instance belongs to (Scene Editor)
onBeforeRendermethodvoid methodFunction called before rendering this object
onAfterRendermethodvoid methodFunction called after rendering this object
onBeforeShadowmethodvoid methodFunction called before rendering this object to shadow map
onAfterShadowmethodvoid methodFunction called after rendering this object to shadow map
frustumCulledbooleantrueIf true, only renders this object if within the camera frustum. Geometry needs to have a bounding sphere, otherwise the test will be skipped and the object will always be rendered
castShadowbooleanfalseIf true, this object will cast shadows when shadow mapping is enabled
receiveShadowbooleanfalseIf true, this object will receive shadows from shadow-casting lights
animationsarray[]List of UeAnimation associated with this node

πŸ” Inherited from UeTransform​

This class inherits all transformation logic, including:

  • .position, .rotation, .scale
  • .setPosition(), .rotate(), .lookAt() etc.
  • .matrix, .matrixWorld and update flags

🧩 Methods​

add(...objects)

Adds one or more child objects. Accepts individual objects as arguments or an array of objects.

remove(child)

Removes a specific child from this object.

removeFromParent()

Removes this object from its parent.

clear()

Recursively removes all children from this object.

clone()

Returns a deep clone of this object.

traverse(callback)

Executes a function on this object and all children (recursively).

traverseVisible(callback)

Same as .traverse(), but skips invisible objects.

traverseAncestors(callback)

Executes a callback function on this object’s ancestors, from immediate parent up to the root. Useful for parent hierarchy inspection.

attach(child)

Adds child to this object while preserving the child’s world transform. Does not support non-uniformly scaled parents.

copy(source, recursive = true)

Copies properties from another UeObject3D. If recursive is true, also clones and adds the source’s children.

getObjectById(targetId)

Searches for and returns the first object with a matching .id in the entire hierarchy.

getObjectByName(name)

Searches for and returns the first object with a matching .name. Names are empty by default unless set manually.

getObjectByProperty(name, value)

Searches for and returns the first object in the hierarchy where object[name] === value.

getObjectsByProperty(name, value, optionalTarget = [])`

Same as getObjectByProperty, but collects all matching objects in the hierarchy. Optional array target can be passed for reuse.

traverseChildren(callback)

Executes the callback on all children of this object (not on the object itself).


Events​

The following events are automatically dispatched by UeObject3D:

  • added – emitted on a child when it is added to a parent via .add(), .attach().
  • childAdded – emitted on the parent when a child is added via .add(), .attach().
  • removed – emitted on a child when it is removed from its parent via .clear(), .remove(), .removeFromParent().
  • childRemoved – emitted on the parent when a child is removed via .clear(), .remove(), .removeFromParent().

🧠 Notes​

All 3D objects in the scene (meshes, groups, lights, etc.) extend UeObject3D

When building a scene graph, you can nest children arbitrarily using .add() and traverse them for rendering or updates.

Globals​

UE_OBJECT3D_DEFAULT_UP = vec3_create(0, 0, -1) Default up vector for objects (applied on the up property)

UE_OBJECT3D_DEFAULT_MATRIX_AUTO_UPDATE = true Default value for all new created objects

UE_OBJECT3D_DEFAULT_MATRIX_WORLD_AUTO_UPDATE = true Default value for all new created objects