Class Skeleton2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
Skeleton2D parents a hierarchy of Bone2D nodes. It holds a reference to each Bone2D's rest pose and acts as a single point of access to its bones.
To set up different types of inverse kinematics for the given Skeleton2D, a SkeletonModificationStack2D should be created. The inverse kinematics be applied by increasing ModificationCount and creating the desired number of modifications.
public class Skeleton2D : Node2D, IDisposable
- Inheritance
-
Skeleton2D
- Implements
- Inherited Members
Constructors
Skeleton2D()
public Skeleton2D()
Methods
ExecuteModifications(float, int)
Executes all the modifications on the SkeletonModificationStack2D, if the Skeleton2D has one assigned.
public void ExecuteModifications(float delta, int executionMode)
Parameters
GetBone(int)
Returns a Bone2D from the node hierarchy parented by Skeleton2D. The object to return is identified by the parameter idx
. Bones are indexed by descending the node hierarchy from top to bottom, adding the children of each branch before moving to the next sibling.
public Bone2D GetBone(int idx)
Parameters
idx
int
Returns
GetBoneCount()
Returns the number of Bone2D nodes in the node hierarchy parented by Skeleton2D.
public int GetBoneCount()
Returns
GetBoneLocalPoseOverride(int)
Returns the local pose override transform for boneIdx
.
public Transform2D GetBoneLocalPoseOverride(int boneIdx)
Parameters
boneIdx
int
Returns
GetModificationStack()
Returns the SkeletonModificationStack2D attached to this skeleton, if one exists.
public SkeletonModificationStack2D GetModificationStack()
Returns
GetSkeleton()
Returns the Rid of a Skeleton2D instance.
public Rid GetSkeleton()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
SetBoneLocalPoseOverride(int, Transform2D, float, bool)
Sets the local pose transform, overridePose
, for the bone at boneIdx
.
strength
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 local transform relative to the Bone2D node at boneIdx
!
public void SetBoneLocalPoseOverride(int boneIdx, Transform2D overridePose, float strength, bool persistent)
Parameters
boneIdx
intoverridePose
Transform2Dstrength
floatpersistent
bool
SetModificationStack(SkeletonModificationStack2D)
Sets the SkeletonModificationStack2D attached to this skeleton.
public void SetModificationStack(SkeletonModificationStack2D modificationStack)
Parameters
modificationStack
SkeletonModificationStack2D
Events
BoneSetupChanged
Emitted when the Bone2D setup attached to this skeletons changes. This is primarily used internally within the skeleton.
public event Action BoneSetupChanged