node
node
The node class wraps Godot Engine scene tree Node instances. It enables inspecting and manipulating scene hierarchy, 3D transforms, visibility, mesh surfaces, materials, textures, and bounding boxes.
Overview
Properties (18)
| Property | Type | Summary |
|---|---|---|
active
|
boolean
|
Node active processing state. |
childCount
|
number
|
Count of direct child nodes. |
globalPosition
|
vector3
|
Global 3D world position. |
globalRotation
|
vector3
|
Global Euler rotation in degrees. |
globalScale
|
vector3
|
Global scale vector. |
isMesh
|
boolean
|
Checks if node is a 3D mesh instance. |
isNode3D
|
boolean
|
Checks if the node is a 3D spatial node. |
isValid
|
boolean
|
Checks if the node instance is valid. |
meshName
|
string
|
Mesh resource name if mesh. |
name
|
string
|
Node name in the scene tree. |
parent
|
node
|
Parent node in scene tree. |
path
|
string
|
Absolute scene tree path. |
position
|
vector3
|
Local 3D position vector. |
rotation
|
vector3
|
Local Euler rotation in degrees. |
scale
|
vector3
|
Local scale vector. |
surfaceCount
|
number
|
Number of surfaces in mesh. |
type
|
string
|
Godot class name. |
visible
|
boolean
|
Node visibility state. |
Methods (16)
| Method Signature | Returns | Summary |
|---|---|---|
node:findChild(name, [recursive = true])
|
node
|
Finds the first child matching name. |
node:findChildren([typeName], [recursive = true])
|
table
|
Finds all descendant nodes matching class type. |
node:getAabb([global = false])
|
aabb
|
Gets the bounding box of the node meshes. |
node:getAabbByMaterial(material, [global = false])
|
aabb
|
Calculates the bounding box of surfaces using the material. |
node:getAabbByTexture(textureName, [global = false])
|
aabb
|
Calculates the bounding box of surfaces using the texture. |
node:getChild(indexOrName)
|
node
|
Gets a child node by index or name. |
node:getChildren()
|
table
|
Gets all direct child nodes. |
node:getMaterialNames()
|
table
|
Gets all material resource names in the node. |
node:getMaterials()
|
table
|
Gets all material definitions used across node surfaces. |
node:getSurfaceAabb(surfaceIndex, [global = false])
|
aabb
|
Gets the bounding box of a specific mesh surface. |
node:getSurfaceMaterial(surfaceIndex)
|
materialdef
|
Gets the material definition assigned to a mesh surface. |
node:getSurfaceMaterialName(surfaceIndex)
|
string
|
Gets the material resource name of a surface. |
node:getSurfaceTextureName(surfaceIndex)
|
string
|
Gets the texture name of a surface. |
node:getTextures()
|
table
|
Gets all texture names used by the node. |
node:usesMaterial(material)
|
boolean
|
Checks if any surface on the node uses the material. |
node:usesTexture(textureName)
|
boolean
|
Checks if any surface on the node uses the texture. |
Detailed Reference
node.activebooleanActive state.
Gets or sets whether the node is active.
node.childCountnumberDirect child count.
Returns the count of direct children in scene tree.
node.globalPositionvector3Global world position.
Gets or sets global world position.
node.globalRotationvector3Global Euler angles in degrees.
Gets or sets global Euler angles.
node.globalScalevector3Global scale vector.
Gets global scale.
node.isMeshbooleanTrue if node is MeshInstance3D.
Returns true if the node is a MeshInstance3D.
node.isNode3DbooleanTrue if inherits Node3D.
Returns true if the node is a 3D spatial node.
node.isValidbooleanTrue if Godot node instance is valid.
Returns true if the Godot node exists and has not been freed.
node.meshNamestringMesh resource name.
Returns the resource name of the assigned mesh.
node.namestringNode name string.
Gets the node name.
node.parentnodeParent node wrapper or nil.
Returns the parent node wrapper.
node.pathstringNode path string.
Returns the absolute path of the node in the scene tree.
node.positionvector3Local 3D position.
Gets or sets local position.
node.rotationvector3Local Euler angles in degrees.
Gets or sets local Euler angles.
node.scalevector3Local scale vector.
Gets or sets local scale.
node.surfaceCountnumberMesh surface count.
Returns the number of material surfaces on the mesh.
node.typestringGodot class name string.
Returns class name (e.g. "Node3D", "MeshInstance3D", "CollisionShape3D").
node.visiblebooleanVisibility state.
Gets or sets node visibility.
node:findChild(name, [recursive = true])| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | Child name. | |
recursive | boolean | `true` | Search descendants. |
nodeFound child node or nil.
Searches descendant nodes for name.
node:findChildren([typeName], [recursive = true])| Parameter | Type | Default | Description |
|---|---|---|---|
typeName | string | "" | Class type filter. |
recursive | boolean | `true` | Search descendants. |
tableArray of child node objects.
Searches descendants for nodes of typeName.
node:getAabb([global = false])| Parameter | Type | Default | Description |
|---|---|---|---|
global | boolean | `false` | World coordinates if true. |
aabbBounding box.
Returns the bounding box enclosing the node.
node:getAabbByMaterial(material, [global = false])| Parameter | Type | Default | Description |
|---|---|---|---|
material | string|materialdef | Target material. | |
global | boolean | `false` | World coordinates. |
aabbBounding box or nil.
Calculates the combined bounds of surfaces with the specified material.
node:getAabbByTexture(textureName, [global = false])| Parameter | Type | Default | Description |
|---|---|---|---|
textureName | string | Target texture name. | |
global | boolean | `false` | World coordinates. |
aabbBounding box or nil.
Calculates the combined bounds of surfaces with the specified texture.
node:getChild(indexOrName)| Parameter | Type | Default | Description |
|---|---|---|---|
indexOrName | number|string | 1-based index or child node name. |
nodeChild node or nil.
Finds a direct child node.
node:getChildren()table1-based array of child node objects.
Returns an array of all direct child nodes.
node:getMaterialNames()tableArray of material resource name strings.
Collects unique material names across all mesh surfaces.
node:getMaterials()tableArray of unique materialdef descriptors.
Collects unique material definitions used by all mesh surfaces.
node:getSurfaceAabb(surfaceIndex, [global = false])| Parameter | Type | Default | Description |
|---|---|---|---|
surfaceIndex | number | 1-based surface index. | |
global | boolean | `false` | World coordinates. |
aabbSurface bounding box.
Calculates the bounds of vertices belonging to surface surfaceIndex.
node:getSurfaceMaterial(surfaceIndex)| Parameter | Type | Default | Description |
|---|---|---|---|
surfaceIndex | number | 1-based surface index. |
materialdefMaterial definition descriptor.
Returns the material definition used by the specified surface.
node:getSurfaceMaterialName(surfaceIndex)| Parameter | Type | Default | Description |
|---|---|---|---|
surfaceIndex | number | 1-based surface index. |
stringMaterial name.
Returns the resource name of the surface material.
node:getSurfaceTextureName(surfaceIndex)| Parameter | Type | Default | Description |
|---|---|---|---|
surfaceIndex | number | 1-based surface index. |
stringTexture name.
Returns the texture name assigned to the surface.
node:getTextures()tableArray of texture name strings.
Collects unique texture names across all mesh surfaces.
node:usesMaterial(material)| Parameter | Type | Default | Description |
|---|---|---|---|
material | string|materialdef | Material ID or definition. |
booleanTrue if used.
Returns true if material is used on any mesh surface.
node:usesTexture(textureName)| Parameter | Type | Default | Description |
|---|---|---|---|
textureName | string | Texture name. |
booleanTrue if used.
Returns true if textureName is used on any mesh surface.