Skeleton3D

package
v0.0.0-...-e1beaa7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 16, 2025 License: MIT Imports: 29 Imported by: 0

Documentation

Overview

graphics.gd/classdb/Skeleton3D provides an interface for managing a hierarchy of bones, including pose, rest and animation (see graphics.gd/classdb/Animation). It can also use ragdoll physics.

The overall transform of a bone with respect to the skeleton is determined by bone pose. Bone rest defines the initial transform of the bone pose.

Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it is not the actual global/world transform of the bone.

Index

Constants

View Source
const NotificationUpdateSkeleton Object.Notification = 50 //gd:Skeleton3D.NOTIFICATION_UPDATE_SKELETON

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsSkeleton3D() Instance
}

type Expanded

type Expanded [1]gdclass.Skeleton3D

func (Expanded) PhysicalBonesStartSimulation

func (self Expanded) PhysicalBonesStartSimulation(bones []string)

Tells the graphics.gd/classdb/PhysicalBone3D nodes in the Skeleton to start simulating and reacting to the physics world.

Optionally, a list of bone names can be passed-in, allowing only the passed-in bones to be simulated.

func (Expanded) SetBoneEnabled

func (self Expanded) SetBoneEnabled(bone_idx int, enabled bool)

Disables the pose for the bone at 'bone_idx' if false, enables the bone pose if true.

func (Expanded) SetBoneGlobalPoseOverride

func (self Expanded) SetBoneGlobalPoseOverride(bone_idx int, pose Transform3D.BasisOrigin, amount Float.X, persistent bool)

Sets the global pose transform, 'pose', for the bone at 'bone_idx'.

'amount' is the interpolation strength that will be used when applying the pose, and 'persistent' determines if the applied pose will remain.

Note: The pose transform needs to be a global pose! To convert a world transform from a graphics.gd/classdb/Node3D to a global bone pose, multiply the graphics.gd/classdb/Transform3D.Instance.AffineInverse of the node's graphics.gd/classdb/Node3D.Instance.GlobalTransform by the desired world transform.

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsNode

func (self *Extension[T]) AsNode() Node.Instance

func (*Extension[T]) AsNode3D

func (self *Extension[T]) AsNode3D() Node3D.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsSkeleton3D

func (self *Extension[T]) AsSkeleton3D() Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.Skeleton3D

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AddBone

func (self Instance) AddBone(name string) int

Adds a new bone with the given name. Returns the new bone's index, or -1 if this method fails.

Note: Bone names should be unique, non empty, and cannot include the : and / characters.

func (Instance) Advance

func (self Instance) Advance(delta Float.X)

Manually advance the child [graphics.gd/classdb/SkeletonModifier3D]s by the specified time (in seconds).

Note: The 'delta' is temporarily accumulated in the graphics.gd/classdb/Skeleton3D, and the deferred process uses the accumulated value to process the modification.

func (Instance) AnimatePhysicalBones

func (self Instance) AnimatePhysicalBones() bool

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsNode3D

func (self Instance) AsNode3D() Node3D.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsSkeleton3D

func (self Instance) AsSkeleton3D() Instance

func (Instance) ClearBones

func (self Instance) ClearBones()

Clear all the bones in this skeleton.

func (Instance) ClearBonesGlobalPoseOverride

func (self Instance) ClearBonesGlobalPoseOverride()

Removes the global pose override on all bones in the skeleton.

func (Instance) CreateSkinFromRestTransforms

func (self Instance) CreateSkinFromRestTransforms() Skin.Instance

func (Instance) FindBone

func (self Instance) FindBone(name string) int

Returns the bone index that matches 'name' as its name. Returns -1 if no bone with this name exists.

func (Instance) ForceUpdateAllBoneTransforms

func (self Instance) ForceUpdateAllBoneTransforms()

Force updates the bone transforms/poses for all bones in the skeleton.

func (Instance) ForceUpdateBoneChildTransform

func (self Instance) ForceUpdateBoneChildTransform(bone_idx int)

Force updates the bone transform for the bone at 'bone_idx' and all of its children.

func (Instance) GetBoneChildren

func (self Instance) GetBoneChildren(bone_idx int) []int32

Returns an array containing the bone indexes of all the child node of the passed in bone, 'bone_idx'.

func (Instance) GetBoneCount

func (self Instance) GetBoneCount() int

Returns the number of bones in the skeleton.

func (Instance) GetBoneGlobalPose

func (self Instance) GetBoneGlobalPose(bone_idx int) Transform3D.BasisOrigin

Returns the overall transform of the specified bone, with respect to the skeleton. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.

Note: This is the global pose you set to the skeleton in the process, the final global pose can get overridden by modifiers in the deferred process, if you want to access the final global pose, use [Instance.OnSkeletonmodifier3d.ModificationProcessed].

func (Instance) GetBoneGlobalPoseNoOverride

func (self Instance) GetBoneGlobalPoseNoOverride(bone_idx int) Transform3D.BasisOrigin

Returns the overall transform of the specified bone, with respect to the skeleton, but without any global pose overrides. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.

func (Instance) GetBoneGlobalPoseOverride

func (self Instance) GetBoneGlobalPoseOverride(bone_idx int) Transform3D.BasisOrigin

Returns the global pose override transform for 'bone_idx'.

func (Instance) GetBoneGlobalRest

func (self Instance) GetBoneGlobalRest(bone_idx int) Transform3D.BasisOrigin

Returns the global rest transform for 'bone_idx'.

func (Instance) GetBoneMeta

func (self Instance) GetBoneMeta(bone_idx int, key string) any

Returns the metadata for the bone at index 'bone_idx' with 'key'.

func (Instance) GetBoneMetaList

func (self Instance) GetBoneMetaList(bone_idx int) []string

Returns the list of all metadata keys for the bone at index 'bone_idx'.

func (Instance) GetBoneName

func (self Instance) GetBoneName(bone_idx int) string

Returns the name of the bone at index 'bone_idx'.

func (Instance) GetBoneParent

func (self Instance) GetBoneParent(bone_idx int) int

Returns the bone index which is the parent of the bone at 'bone_idx'. If -1, then bone has no parent.

Note: The parent bone returned will always be less than 'bone_idx'.

func (Instance) GetBonePose

func (self Instance) GetBonePose(bone_idx int) Transform3D.BasisOrigin

Returns the pose transform of the specified bone.

Note: This is the pose you set to the skeleton in the process, the final pose can get overridden by modifiers in the deferred process, if you want to access the final pose, use [Instance.OnSkeletonmodifier3d.ModificationProcessed].

func (Instance) GetBonePosePosition

func (self Instance) GetBonePosePosition(bone_idx int) Vector3.XYZ

Returns the pose position of the bone at 'bone_idx'. The returned [Vector3.XYZ] is in the local coordinate space of the graphics.gd/classdb/Skeleton3D node.

func (Instance) GetBonePoseRotation

func (self Instance) GetBonePoseRotation(bone_idx int) Quaternion.IJKX

Returns the pose rotation of the bone at 'bone_idx'. The returned [Quaternion.IJKX] is local to the bone with respect to the rotation of any parent bones.

func (Instance) GetBonePoseScale

func (self Instance) GetBonePoseScale(bone_idx int) Vector3.XYZ

Returns the pose scale of the bone at 'bone_idx'.

func (Instance) GetBoneRest

func (self Instance) GetBoneRest(bone_idx int) Transform3D.BasisOrigin

Returns the rest transform for a bone 'bone_idx'.

func (Instance) GetConcatenatedBoneNames

func (self Instance) GetConcatenatedBoneNames() string

Returns all bone names concatenated with commas (,) as a single string.

It is useful to set it as a hint for the enum property.

func (Instance) GetParentlessBones

func (self Instance) GetParentlessBones() []int32

Returns an array with all of the bones that are parentless. Another way to look at this is that it returns the indexes of all the bones that are not dependent or modified by other bones in the Skeleton.

func (Instance) GetVersion

func (self Instance) GetVersion() int

Returns the number of times the bone hierarchy has changed within this skeleton, including renames.

The Skeleton version is not serialized: only use within a single instance of Skeleton3D.

Use for invalidating caches in IK solvers and other nodes which process bones.

func (Instance) HasBoneMeta

func (self Instance) HasBoneMeta(bone_idx int, key string) bool

Returns true if the bone at index 'bone_idx' has metadata with the key 'key'.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) IsBoneEnabled

func (self Instance) IsBoneEnabled(bone_idx int) bool

Returns whether the bone pose for the bone at 'bone_idx' is enabled.

func (Instance) LocalizeRests

func (self Instance) LocalizeRests()

Returns all bones in the skeleton to their rest poses.

func (Instance) ModifierCallbackModeProcess

func (self Instance) ModifierCallbackModeProcess() ModifierCallbackModeProcess

func (Instance) MotionScale

func (self Instance) MotionScale() Float.X

func (Instance) OnBoneEnabledChanged

func (self Instance) OnBoneEnabledChanged(cb func(bone_idx int), flags ...Signal.Flags)

func (Instance) OnBoneListChanged

func (self Instance) OnBoneListChanged(cb func(), flags ...Signal.Flags)

func (Instance) OnPoseUpdated

func (self Instance) OnPoseUpdated(cb func(), flags ...Signal.Flags)

func (Instance) OnRestUpdated

func (self Instance) OnRestUpdated(cb func(), flags ...Signal.Flags)

func (Instance) OnShowRestOnlyChanged

func (self Instance) OnShowRestOnlyChanged(cb func(), flags ...Signal.Flags)

func (Instance) OnSkeletonUpdated

func (self Instance) OnSkeletonUpdated(cb func(), flags ...Signal.Flags)

func (Instance) PhysicalBonesAddCollisionException

func (self Instance) PhysicalBonesAddCollisionException(exception RID.Body3D)

Adds a collision exception to the physical bone.

Works just like the graphics.gd/classdb/RigidBody3D node.

func (Instance) PhysicalBonesRemoveCollisionException

func (self Instance) PhysicalBonesRemoveCollisionException(exception RID.Body3D)

Removes a collision exception to the physical bone.

Works just like the graphics.gd/classdb/RigidBody3D node.

func (Instance) PhysicalBonesStartSimulation

func (self Instance) PhysicalBonesStartSimulation()

Tells the graphics.gd/classdb/PhysicalBone3D nodes in the Skeleton to start simulating and reacting to the physics world.

Optionally, a list of bone names can be passed-in, allowing only the passed-in bones to be simulated.

func (Instance) PhysicalBonesStopSimulation

func (self Instance) PhysicalBonesStopSimulation()

Tells the graphics.gd/classdb/PhysicalBone3D nodes in the Skeleton to stop simulating.

func (Instance) RegisterSkin

func (self Instance) RegisterSkin(skin Skin.Instance) SkinReference.Instance

Binds the given Skin to the Skeleton.

func (Instance) ResetBonePose

func (self Instance) ResetBonePose(bone_idx int)

Sets the bone pose to rest for 'bone_idx'.

func (Instance) ResetBonePoses

func (self Instance) ResetBonePoses()

Sets all bone poses to rests.

func (Instance) SetAnimatePhysicalBones

func (self Instance) SetAnimatePhysicalBones(value bool)

func (Instance) SetBoneEnabled

func (self Instance) SetBoneEnabled(bone_idx int)

Disables the pose for the bone at 'bone_idx' if false, enables the bone pose if true.

func (Instance) SetBoneGlobalPose

func (self Instance) SetBoneGlobalPose(bone_idx int, pose Transform3D.BasisOrigin)

Sets the global pose transform, 'pose', for the bone at 'bone_idx'.

Note: If other bone poses have been changed, this method executes a dirty poses recalculation and will cause performance to deteriorate. If you know that multiple global poses will be applied, consider using Instance.SetBonePose with precalculation.

func (Instance) SetBoneGlobalPoseOverride

func (self Instance) SetBoneGlobalPoseOverride(bone_idx int, pose Transform3D.BasisOrigin, amount Float.X)

Sets the global pose transform, 'pose', for the bone at 'bone_idx'.

'amount' is the interpolation strength that will be used when applying the pose, and 'persistent' determines if the applied pose will remain.

Note: The pose transform needs to be a global pose! To convert a world transform from a graphics.gd/classdb/Node3D to a global bone pose, multiply the graphics.gd/classdb/Transform3D.Instance.AffineInverse of the node's graphics.gd/classdb/Node3D.Instance.GlobalTransform by the desired world transform.

func (Instance) SetBoneMeta

func (self Instance) SetBoneMeta(bone_idx int, key string, value any)

Sets the metadata for the bone at index 'bone_idx', setting the 'key' meta to 'value'.

func (Instance) SetBoneName

func (self Instance) SetBoneName(bone_idx int, name string)

Sets the bone name, 'name', for the bone at 'bone_idx'.

func (Instance) SetBoneParent

func (self Instance) SetBoneParent(bone_idx int, parent_idx int)

Sets the bone index 'parent_idx' as the parent of the bone at 'bone_idx'. If -1, then bone has no parent.

Note: 'parent_idx' must be less than 'bone_idx'.

func (Instance) SetBonePose

func (self Instance) SetBonePose(bone_idx int, pose Transform3D.BasisOrigin)

Sets the pose transform, 'pose', for the bone at 'bone_idx'.

func (Instance) SetBonePosePosition

func (self Instance) SetBonePosePosition(bone_idx int, position Vector3.XYZ)

Sets the pose position of the bone at 'bone_idx' to 'position'. 'position' is a [Vector3.XYZ] describing a position local to the graphics.gd/classdb/Skeleton3D node.

func (Instance) SetBonePoseRotation

func (self Instance) SetBonePoseRotation(bone_idx int, rotation Quaternion.IJKX)

Sets the pose rotation of the bone at 'bone_idx' to 'rotation'. 'rotation' is a [Quaternion.IJKX] describing a rotation in the bone's local coordinate space with respect to the rotation of any parent bones.

func (Instance) SetBonePoseScale

func (self Instance) SetBonePoseScale(bone_idx int, scale Vector3.XYZ)

Sets the pose scale of the bone at 'bone_idx' to 'scale'.

func (Instance) SetBoneRest

func (self Instance) SetBoneRest(bone_idx int, rest Transform3D.BasisOrigin)

Sets the rest transform for bone 'bone_idx'.

func (Instance) SetModifierCallbackModeProcess

func (self Instance) SetModifierCallbackModeProcess(value ModifierCallbackModeProcess)

func (Instance) SetMotionScale

func (self Instance) SetMotionScale(value Float.X)

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) SetShowRestOnly

func (self Instance) SetShowRestOnly(value bool)

func (Instance) ShowRestOnly

func (self Instance) ShowRestOnly() bool

func (Instance) UnparentBoneAndRest

func (self Instance) UnparentBoneAndRest(bone_idx int)

Unparents the bone at 'bone_idx' and sets its rest position to that of its parent prior to being reset.

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type ModifierCallbackModeProcess

type ModifierCallbackModeProcess int //gd:Skeleton3D.ModifierCallbackModeProcess
const (
	// Set a flag to process modification during physics frames (see [Node.NotificationInternalPhysicsProcess]).
	ModifierCallbackModeProcessPhysics ModifierCallbackModeProcess = 0
	// Set a flag to process modification during process frames (see [Node.NotificationInternalProcess]).
	ModifierCallbackModeProcessIdle ModifierCallbackModeProcess = 1
	// Do not process modification. Use [Instance.Advance] to process the modification manually.
	ModifierCallbackModeProcessManual ModifierCallbackModeProcess = 2
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL