Class SkeletonModification2D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
This resource provides an interface that can be expanded so code that operates on Bone2D nodes in a Skeleton2D can be mixed and matched together to create complex interactions.
This is used to provide Godot with a flexible and powerful Inverse Kinematics solution that can be adapted for many different uses.
public class SkeletonModification2D : Resource, IDisposable
- Inheritance
-
SkeletonModification2D
- Implements
- Derived
- Inherited Members
Constructors
SkeletonModification2D()
public SkeletonModification2D()
Properties
Enabled
If true
, the modification's _Execute(double) function will be called by the SkeletonModificationStack2D.
public bool Enabled { get; set; }
Property Value
ExecutionMode
The execution mode for the modification. This tells the modification stack when to execute the modification. Some modifications have settings that are only available in certain execution modes.
public int ExecutionMode { get; set; }
Property Value
Methods
ClampAngle(float, float, float, bool)
Takes an angle and clamps it so it is within the passed-in min
and max
range. invert
will inversely clamp the angle, clamping it to the range outside of the given bounds.
public float ClampAngle(float angle, float min, float max, bool invert)
Parameters
Returns
GetEditorDrawGizmo()
Returns whether this modification will call _DrawEditorGizmo() in the Godot editor to draw modification-specific gizmos.
public bool GetEditorDrawGizmo()
Returns
GetIsSetup()
Returns whether this modification has been successfully setup or not.
public bool GetIsSetup()
Returns
GetModificationStack()
Returns the SkeletonModificationStack2D that this modification is bound to. Through the modification stack, you can access the Skeleton2D the modification is operating on.
public SkeletonModificationStack2D GetModificationStack()
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
SetEditorDrawGizmo(bool)
Sets whether this modification will call _DrawEditorGizmo() in the Godot editor to draw modification-specific gizmos.
public void SetEditorDrawGizmo(bool drawGizmo)
Parameters
drawGizmo
bool
SetIsSetup(bool)
Manually allows you to set the setup state of the modification. This function should only rarely be used, as the SkeletonModificationStack2D the modification is bound to should handle setting the modification up.
public void SetIsSetup(bool isSetup)
Parameters
isSetup
bool
_DrawEditorGizmo()
Used for drawing editor-only modification gizmos. This function will only be called in the Godot editor and can be overridden to draw custom gizmos.
Note: You will need to use the Skeleton2D from GetSkeleton() and it's draw functions, as the SkeletonModification2D resource cannot draw on its own.
public virtual void _DrawEditorGizmo()
_Execute(double)
Executes the given modification. This is where the modification performs whatever function it is designed to do.
public virtual void _Execute(double delta)
Parameters
delta
double
_SetupModification(SkeletonModificationStack2D)
Called when the modification is setup. This is where the modification performs initialization.
public virtual void _SetupModification(SkeletonModificationStack2D modificationStack)
Parameters
modificationStack
SkeletonModificationStack2D