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
- type Advanced
- type Any
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) AddBone(name string) int
- func (self Instance) Advance(delta Float.X)
- func (self Instance) AnimatePhysicalBones() bool
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Node3D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsSkeleton3D() Instance
- func (self Instance) ClearBones()
- func (self Instance) ClearBonesGlobalPoseOverride()
- func (self Instance) CreateSkinFromRestTransforms() Skin.Instance
- func (self Instance) FindBone(name string) int
- func (self Instance) ForceUpdateAllBoneTransforms()
- func (self Instance) ForceUpdateBoneChildTransform(bone_idx int)
- func (self Instance) GetBoneChildren(bone_idx int) []int32
- func (self Instance) GetBoneCount() int
- func (self Instance) GetBoneGlobalPose(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetBoneGlobalPoseNoOverride(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetBoneGlobalPoseOverride(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetBoneGlobalRest(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetBoneMeta(bone_idx int, key string) any
- func (self Instance) GetBoneMetaList(bone_idx int) []string
- func (self Instance) GetBoneName(bone_idx int) string
- func (self Instance) GetBoneParent(bone_idx int) int
- func (self Instance) GetBonePose(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetBonePosePosition(bone_idx int) Vector3.XYZ
- func (self Instance) GetBonePoseRotation(bone_idx int) Quaternion.IJKX
- func (self Instance) GetBonePoseScale(bone_idx int) Vector3.XYZ
- func (self Instance) GetBoneRest(bone_idx int) Transform3D.BasisOrigin
- func (self Instance) GetConcatenatedBoneNames() string
- func (self Instance) GetParentlessBones() []int32
- func (self Instance) GetVersion() int
- func (self Instance) HasBoneMeta(bone_idx int, key string) bool
- func (self Instance) ID() ID
- func (self Instance) IsBoneEnabled(bone_idx int) bool
- func (self Instance) LocalizeRests()
- func (self Instance) ModifierCallbackModeProcess() ModifierCallbackModeProcess
- func (self Instance) MotionScale() Float.X
- func (self Instance) OnBoneEnabledChanged(cb func(bone_idx int), flags ...Signal.Flags)
- func (self Instance) OnBoneListChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnPoseUpdated(cb func(), flags ...Signal.Flags)
- func (self Instance) OnRestUpdated(cb func(), flags ...Signal.Flags)
- func (self Instance) OnShowRestOnlyChanged(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSkeletonUpdated(cb func(), flags ...Signal.Flags)
- func (self Instance) PhysicalBonesAddCollisionException(exception RID.Body3D)
- func (self Instance) PhysicalBonesRemoveCollisionException(exception RID.Body3D)
- func (self Instance) PhysicalBonesStartSimulation()
- func (self Instance) PhysicalBonesStopSimulation()
- func (self Instance) RegisterSkin(skin Skin.Instance) SkinReference.Instance
- func (self Instance) ResetBonePose(bone_idx int)
- func (self Instance) ResetBonePoses()
- func (self Instance) SetAnimatePhysicalBones(value bool)
- func (self Instance) SetBoneEnabled(bone_idx int)
- func (self Instance) SetBoneGlobalPose(bone_idx int, pose Transform3D.BasisOrigin)
- func (self Instance) SetBoneGlobalPoseOverride(bone_idx int, pose Transform3D.BasisOrigin, amount Float.X)
- func (self Instance) SetBoneMeta(bone_idx int, key string, value any)
- func (self Instance) SetBoneName(bone_idx int, name string)
- func (self Instance) SetBoneParent(bone_idx int, parent_idx int)
- func (self Instance) SetBonePose(bone_idx int, pose Transform3D.BasisOrigin)
- func (self Instance) SetBonePosePosition(bone_idx int, position Vector3.XYZ)
- func (self Instance) SetBonePoseRotation(bone_idx int, rotation Quaternion.IJKX)
- func (self Instance) SetBonePoseScale(bone_idx int, scale Vector3.XYZ)
- func (self Instance) SetBoneRest(bone_idx int, rest Transform3D.BasisOrigin)
- func (self Instance) SetModifierCallbackModeProcess(value ModifierCallbackModeProcess)
- func (self Instance) SetMotionScale(value Float.X)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetShowRestOnly(value bool)
- func (self Instance) ShowRestOnly() bool
- func (self Instance) UnparentBoneAndRest(bone_idx int)
- func (self Instance) Virtual(name string) reflect.Value
- type ModifierCallbackModeProcess
Constants ¶
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 Expanded ¶
type Expanded [1]gdclass.Skeleton3D
func (Expanded) 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 (Expanded) SetBoneEnabled ¶
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 ¶
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]) AsSkeleton3D ¶
type 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.
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 (Instance) AddBone ¶
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 ¶
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 (Instance) AsSkeleton3D ¶
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 (Instance) FindBone ¶
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 ¶
Force updates the bone transform for the bone at 'bone_idx' and all of its children.
func (Instance) GetBoneChildren ¶
Returns an array containing the bone indexes of all the child node of the passed in bone, 'bone_idx'.
func (Instance) GetBoneCount ¶
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 ¶
Returns the metadata for the bone at index 'bone_idx' with 'key'.
func (Instance) GetBoneMetaList ¶
Returns the list of all metadata keys for the bone at index 'bone_idx'.
func (Instance) GetBoneName ¶
Returns the name of the bone at index 'bone_idx'.
func (Instance) GetBoneParent ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
Returns true if the bone at index 'bone_idx' has metadata with the key 'key'.
func (Instance) IsBoneEnabled ¶
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 (Instance) OnBoneEnabledChanged ¶
func (Instance) OnBoneListChanged ¶
func (Instance) OnPoseUpdated ¶
func (Instance) OnRestUpdated ¶
func (Instance) OnShowRestOnlyChanged ¶
func (Instance) OnSkeletonUpdated ¶
func (Instance) PhysicalBonesAddCollisionException ¶
Adds a collision exception to the physical bone.
Works just like the graphics.gd/classdb/RigidBody3D node.
func (Instance) PhysicalBonesRemoveCollisionException ¶
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 ¶
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 (Instance) SetBoneEnabled ¶
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 ¶
Sets the metadata for the bone at index 'bone_idx', setting the 'key' meta to 'value'.
func (Instance) SetBoneName ¶
Sets the bone name, 'name', for the bone at 'bone_idx'.
func (Instance) SetBoneParent ¶
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 ¶
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 ¶
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 (Instance) SetShowRestOnly ¶
func (Instance) ShowRestOnly ¶
func (Instance) UnparentBoneAndRest ¶
Unparents the bone at 'bone_idx' and sets its rest position to that of its parent prior to being reset.
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 )