Skeleton3D

package
v0.0.0-...-ae8aae0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package Skeleton3D provides methods for working with Skeleton3D object instances.

Index

Constants

This section is empty.

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 Instance

type Instance [1]gdclass.Skeleton3D

[Skeleton3D] provides an interface for managing a hierarchy of bones, including pose, rest and animation (see [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.

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 [code]-1[/code] if this method fails. [b]Note:[/b] Bone names should be unique, non empty, and cannot include the [code]:[/code] and [code]/[/code] characters.

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() [1]gdclass.Skin

func (Instance) FindBone

func (self Instance) FindBone(name string) int

Returns the bone index that matches [param name] as its name. Returns [code]-1[/code] 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 [param 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, [param 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. [b]Note:[/b] 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 [signal SkeletonModifier3D.modification_processed].

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 [param bone_idx].

func (Instance) GetBoneGlobalRest

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

Returns the global rest transform for [param bone_idx].

func (Instance) GetBoneName

func (self Instance) GetBoneName(bone_idx int) string

Returns the name of the bone at index [param 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 [param bone_idx]. If -1, then bone has no parent. [b]Note:[/b] The parent bone returned will always be less than [param bone_idx].

func (Instance) GetBonePose

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

Returns the pose transform of the specified bone. [b]Note:[/b] 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 [signal SkeletonModifier3D.modification_processed].

func (Instance) GetBonePosePosition

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

Returns the pose position of the bone at [param bone_idx]. The returned [Vector3] is in the local coordinate space of the [Skeleton3D] node.

func (Instance) GetBonePoseRotation

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

Returns the pose rotation of the bone at [param bone_idx]. The returned [Quaternion] 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 [param bone_idx].

func (Instance) GetBoneRest

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

Returns the rest transform for a bone [param bone_idx].

func (Instance) GetConcatenatedBoneNames

func (self Instance) GetConcatenatedBoneNames() string

Returns all bone names concatenated with commas ([code],[/code]) as a single [StringName]. 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) IsBoneEnabled

func (self Instance) IsBoneEnabled(bone_idx int) bool

Returns whether the bone pose for the bone at [param 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() gdclass.Skeleton3DModifierCallbackModeProcess

func (Instance) MotionScale

func (self Instance) MotionScale() Float.X

func (Instance) OnBoneEnabledChanged

func (self Instance) OnBoneEnabledChanged(cb func(bone_idx int))

func (Instance) OnBoneListChanged

func (self Instance) OnBoneListChanged(cb func())

func (Instance) OnPoseUpdated

func (self Instance) OnPoseUpdated(cb func())

func (Instance) OnShowRestOnlyChanged

func (self Instance) OnShowRestOnlyChanged(cb func())

func (Instance) OnSkeletonUpdated

func (self Instance) OnSkeletonUpdated(cb func())

func (Instance) PhysicalBonesAddCollisionException

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

Adds a collision exception to the physical bone. Works just like the [RigidBody3D] node.

func (Instance) PhysicalBonesRemoveCollisionException

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

Removes a collision exception to the physical bone. Works just like the [RigidBody3D] node.

func (Instance) PhysicalBonesStartSimulation

func (self Instance) PhysicalBonesStartSimulation()

Tells the [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 [PhysicalBone3D] nodes in the Skeleton to stop simulating.

func (Instance) RegisterSkin

func (self Instance) RegisterSkin(skin [1]gdclass.Skin) [1]gdclass.SkinReference

Binds the given Skin to the Skeleton.

func (Instance) ResetBonePose

func (self Instance) ResetBonePose(bone_idx int)

Sets the bone pose to rest for [param 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 [param bone_idx] if [code]false[/code], enables the bone pose if [code]true[/code].

func (Instance) SetBoneGlobalPose

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

Sets the global pose transform, [param pose], for the bone at [param bone_idx]. [b]Note:[/b] 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 [method set_bone_pose] with precalculation.

func (Instance) SetBoneGlobalPoseOverride

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

Sets the global pose transform, [param pose], for the bone at [param bone_idx]. [param amount] is the interpolation strength that will be used when applying the pose, and [param persistent] determines if the applied pose will remain. [b]Note:[/b] The pose transform needs to be a global pose! To convert a world transform from a [Node3D] to a global bone pose, multiply the [method Transform3D.affine_inverse] of the node's [member Node3D.global_transform] by the desired world transform.

func (Instance) SetBoneName

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

Sets the bone name, [param name], for the bone at [param bone_idx].

func (Instance) SetBoneParent

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

Sets the bone index [param parent_idx] as the parent of the bone at [param bone_idx]. If -1, then bone has no parent. [b]Note:[/b] [param parent_idx] must be less than [param bone_idx].

func (Instance) SetBonePose

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

Sets the pose transform, [param pose], for the bone at [param bone_idx].

func (Instance) SetBonePosePosition

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

Sets the pose position of the bone at [param bone_idx] to [param position]. [param position] is a [Vector3] describing a position local to the [Skeleton3D] node.

func (Instance) SetBonePoseRotation

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

Sets the pose rotation of the bone at [param bone_idx] to [param rotation]. [param rotation] is a [Quaternion] 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 [param bone_idx] to [param scale].

func (Instance) SetBoneRest

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

Sets the rest transform for bone [param bone_idx].

func (Instance) SetModifierCallbackModeProcess

func (self Instance) SetModifierCallbackModeProcess(value gdclass.Skeleton3DModifierCallbackModeProcess)

func (Instance) SetMotionScale

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

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 [param bone_idx] and sets its rest position to that of its parent prior to being reset.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

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

type ModifierCallbackModeProcess

type ModifierCallbackModeProcess = gdclass.Skeleton3DModifierCallbackModeProcess //gd:Skeleton3D.ModifierCallbackModeProcess
const (
	/*Set a flag to process modification during physics frames (see [constant Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS]).*/
	ModifierCallbackModeProcessPhysics ModifierCallbackModeProcess = 0
	/*Set a flag to process modification during process frames (see [constant Node.NOTIFICATION_INTERNAL_PROCESS]).*/
	ModifierCallbackModeProcessIdle ModifierCallbackModeProcess = 1
)

Jump to

Keyboard shortcuts

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