GLTFNode
Inherits:Resource<RefCounted<Object
glTF node class.
Description
Represents a glTF node. glTF nodes may have names, transforms, children (other glTF nodes), and more specialized properties (represented by their own classes).
glTF nodes generally exist inside ofGLTFState which represents all data of a glTF file. Most of GLTFNode's properties are indices of other data in the glTF file. You can extend a glTF node with additional properties by usingget_additional_data() andset_additional_data().
Tutorials
Properties
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
| ||
|
Methods
append_child_index(child_index:int) | |
get_additional_data(extension_name:StringName) | |
get_scene_node_path(gltf_state:GLTFState, handle_skeletons:bool = true) | |
set_additional_data(extension_name:StringName, additional_data:Variant) |
Property Descriptions
intget_camera()
If this glTF node is a camera, the index of theGLTFCamera in theGLTFState that describes the camera's properties. If -1, this node is not a camera.
PackedInt32Arraychildren =PackedInt32Array()
🔗
PackedInt32Arrayget_children()
The indices of the child nodes in theGLTFState. If this glTF node has no children, this will be an empty array.
Note: The returned array iscopied and any changes to it will not update the original property value. SeePackedInt32Array for more details.
intget_height()
How deep into the node hierarchy this node is. A root node will have a height of 0, its children will have a height of 1, and so on. If -1, the height has not been calculated.
intget_light()
If this glTF node is a light, the index of theGLTFLight in theGLTFState that describes the light's properties. If -1, this node is not a light.
intget_mesh()
If this glTF node is a mesh, the index of theGLTFMesh in theGLTFState that describes the mesh's properties. If -1, this node is not a mesh.
Stringget_original_name()
The original name of the node.
intget_parent()
The index of the parent node in theGLTFState. If -1, this node is a root node.
Vector3position =Vector3(0,0,0)
🔗
Vector3get_position()
The position of the glTF node relative to its parent.
Quaternionrotation =Quaternion(0,0,0,1)
🔗
Quaternionget_rotation()
The rotation of the glTF node relative to its parent.
Vector3get_scale()
The scale of the glTF node relative to its parent.
intget_skeleton()
If this glTF node has a skeleton, the index of theGLTFSkeleton in theGLTFState that describes the skeleton's properties. If -1, this node does not have a skeleton.
intget_skin()
If this glTF node has a skin, the index of theGLTFSkin in theGLTFState that describes the skin's properties. If -1, this node does not have a skin.
Transform3Dxform =Transform3D(1,0,0,0,1,0,0,0,1,0,0,0)
🔗
Transform3Dget_xform()
The transform of the glTF node relative to its parent. This property is usually unused since the position, rotation, and scale properties are preferred.
Method Descriptions
voidappend_child_index(child_index:int)🔗
Appends the given child node index to thechildren array.
Variantget_additional_data(extension_name:StringName)🔗
Gets additional arbitrary data in thisGLTFNode instance. This can be used to keep per-node state data inGLTFDocumentExtension classes, which is important because they are stateless.
The argument should be theGLTFDocumentExtension name (does not have to match the extension name in the glTF file), and the return value can be anything you set. If nothing was set, the return value isnull
.
NodePathget_scene_node_path(gltf_state:GLTFState, handle_skeletons:bool = true)🔗
Returns theNodePath that this GLTF node will have in the Godot scene tree after being imported. This is useful when importing glTF object model pointers withGLTFObjectModelProperty, for handling extensions such asKHR_animation_pointer
orKHR_interactivity
.
Ifhandle_skeletons
istrue
, paths to skeleton bone glTF nodes will be resolved properly. For example, a path that would be^"A/B/C/Bone1/Bone2/Bone3"
iffalse
will become^"A/B/C/Skeleton3D:Bone3"
.
voidset_additional_data(extension_name:StringName, additional_data:Variant)🔗
Sets additional arbitrary data in thisGLTFNode instance. This can be used to keep per-node state data inGLTFDocumentExtension classes, which is important because they are stateless.
The first argument should be theGLTFDocumentExtension name (does not have to match the extension name in the glTF file), and the second argument can be anything you want.