Skip to main content

Node3D

Description:

  Class used for building a hierarchical tree of 3D objects.

Inherits from: Object.

order

Type: Field.

Description:

  The order of the node in the parent's children array.

Signature:

order: integer

tag

Type: Field.

Description:

  The tag of the node as a string.

Signature:

tag: string

visible

Type: Field.

Description:

  Whether the node is visible.

Signature:

visible: boolean

parent

Type: Readonly Field.

Description:

  The parent 3D node.

Signature:

const parent: Node3D | nil

hasChildren

Type: Readonly Field.

Description:

  Whether the node has child 3D nodes.

Signature:

const hasChildren: boolean

position

Type: Field.

Description:

  The node position.

Signature:

position: Vec3

scale

Type: Field.

Description:

  The node scale.

Signature:

scale: Vec3

rotation

Type: Field.

Description:

  The node rotation quaternion.

Signature:

rotation: any

angles

Type: Field.

Description:

  The node Euler rotation in degrees.

Signature:

angles: Vec3

worldMatrix

Type: Readonly Field.

Description:

  The node world transform matrix.

Signature:

const worldMatrix: any

x

Type: Field.

Description:

  The X-axis position of the node.

Signature:

x: number

y

Type: Field.

Description:

  The Y-axis position of the node.

Signature:

y: number

z

Type: Field.

Description:

  The Z-axis position of the node.

Signature:

z: number

angleX

Type: Field.

Description:

  The X-axis rotation angle of the node in degrees.

Signature:

angleX: number

angleY

Type: Field.

Description:

  The Y-axis rotation angle of the node in degrees.

Signature:

angleY: number

angleZ

Type: Field.

Description:

  The Z-axis rotation angle of the node in degrees.

Signature:

angleZ: number

scaleX

Type: Field.

Description:

  The X-axis scale factor of the node.

Signature:

scaleX: number

scaleY

Type: Field.

Description:

  The Y-axis scale factor of the node.

Signature:

scaleY: number

scaleZ

Type: Field.

Description:

  The Z-axis scale factor of the node.

Signature:

scaleZ: number

addChild

Type: Function.

Description:

  Adds a child 3D node to the current node.

Signature:

addChild: function(
self: Node3D,
child: Node3D,
order?: integer --[[0]],
tag?: string --[[""]]
)

Parameters:

ParameterTypeDescription
childNode3DThe child node to add.
orderinteger[optional] The drawing order of the child node. Default is 0.
tagstring[optional] The tag of the child node. Default is an empty string.

removeChild

Type: Function.

Description:

  Removes a child 3D node from the current node.

Signature:

removeChild: function(self: Node3D, child: Node3D, cleanup?: boolean --[[true]])

Parameters:

ParameterTypeDescription
childNode3DThe child node to remove.
cleanupboolean[optional] Whether to cleanup the child node. Default is true.

removeAllChildren

Type: Function.

Description:

  Removes all child 3D nodes from the current node.

Signature:

removeAllChildren: function(self: Node3D, cleanup?: boolean --[[true]])

Parameters:

ParameterTypeDescription
cleanupboolean[optional] Whether to cleanup the child nodes. Default is true.

removeFromParent

Type: Function.

Description:

  Removes the current node from its parent node.

Signature:

removeFromParent: function(self: Node3D, cleanup?: boolean --[[true]])

Parameters:

ParameterTypeDescription
cleanupboolean[optional] Whether to cleanup the current node. Default is true.

cleanup

Type: Function.

Description:

  Cleans up the current node and releases its 3D resources.

Signature:

cleanup: function(self: Node3D)

convertToWorldSpace

Type: Function.

Description:

  Converts a point from node space to world space.

Signature:

convertToWorldSpace: function(self: Node3D, localPoint: Vec3): Vec3

Parameters:

ParameterTypeDescription
localPointVec3The point in node space.

Returns:

Return TypeDescription
Vec3The converted point in world space.

convertToNodeSpace

Type: Function.

Description:

  Converts a point in world space to node space.

Signature:

convertToNodeSpace: function(self: Node3D, worldPoint: Vec3): Vec3

Parameters:

ParameterTypeDescription
worldPointVec3The point in world space.

Returns:

Return TypeDescription
Vec3The converted point in node space.