Class SkeletonModification2DJiggle
- Namespace
- Godot
- Assembly
- GodotSharp.dll
This modification moves a series of bones, typically called a bone chain, towards a target. What makes this modification special is that it calculates the velocity and acceleration for each bone in the bone chain, and runs a very light physics-like calculation using the inputted values. This allows the bones to overshoot the target and "jiggle" around. It can be configured to act more like a spring, or sway around like cloth might.
This modification is useful for adding additional motion to things like hair, the edges of clothing, and more. It has several settings to that allow control over how the joint moves when the target moves.
Note: The Jiggle modifier has jiggle_joints
, which are the data objects that hold the data for each joint in the Jiggle chain. This is different from than Bone2D nodes! Jiggle joints hold the data needed for each Bone2D in the bone chain used by the Jiggle modification.
public class SkeletonModification2DJiggle : SkeletonModification2D, IDisposable
- Inheritance
-
SkeletonModification2DJiggle
- Implements
- Inherited Members
Constructors
SkeletonModification2DJiggle()
public SkeletonModification2DJiggle()
Properties
Damping
The default amount of damping applied to the Jiggle joints, if they are not overridden. Higher values lead to more of the calculated velocity being applied.
public float Damping { get; set; }
Property Value
Gravity
The default amount of gravity applied to the Jiggle joints, if they are not overridden.
public Vector2 Gravity { get; set; }
Property Value
JiggleDataChainLength
The amount of Jiggle joints in the Jiggle modification.
public int JiggleDataChainLength { get; set; }
Property Value
Mass
The default amount of mass assigned to the Jiggle joints, if they are not overridden. Higher values lead to faster movements and more overshooting.
public float Mass { get; set; }
Property Value
Stiffness
The default amount of stiffness assigned to the Jiggle joints, if they are not overridden. Higher values act more like springs, quickly moving into the correct position.
public float Stiffness { get; set; }
Property Value
TargetNodePath
The NodePath to the node that is the target for the Jiggle modification. This node is what the Jiggle chain will attempt to rotate the bone chain to.
public NodePath TargetNodePath { get; set; }
Property Value
UseGravity
Whether the gravity vector, Gravity, should be applied to the Jiggle joints, assuming they are not overriding the default settings.
public bool UseGravity { get; set; }
Property Value
Methods
GetCollisionMask()
Returns the collision mask used by the Jiggle modifier when collisions are enabled.
public int GetCollisionMask()
Returns
GetJiggleJointBone2DNode(int)
Returns the Bone2D node assigned to the Jiggle joint at jointIdx
.
public NodePath GetJiggleJointBone2DNode(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointBoneIndex(int)
Returns the index of the Bone2D node assigned to the Jiggle joint at jointIdx
.
public int GetJiggleJointBoneIndex(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointDamping(int)
Returns the amount of damping of the Jiggle joint at jointIdx
.
public float GetJiggleJointDamping(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointGravity(int)
Returns a Vector2 representing the amount of gravity the Jiggle joint at jointIdx
is influenced by.
public Vector2 GetJiggleJointGravity(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointMass(int)
Returns the amount of mass of the jiggle joint at jointIdx
.
public float GetJiggleJointMass(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointOverride(int)
Returns a boolean that indicates whether the joint at jointIdx
is overriding the default Jiggle joint data defined in the modification.
public bool GetJiggleJointOverride(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointStiffness(int)
Returns the stiffness of the Jiggle joint at jointIdx
.
public float GetJiggleJointStiffness(int jointIdx)
Parameters
jointIdx
int
Returns
GetJiggleJointUseGravity(int)
Returns a boolean that indicates whether the joint at jointIdx
is using gravity or not.
public bool GetJiggleJointUseGravity(int jointIdx)
Parameters
jointIdx
int
Returns
GetUseColliders()
Returns whether the jiggle modifier is taking physics colliders into account when solving.
public bool GetUseColliders()
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
SetCollisionMask(int)
Sets the collision mask that the Jiggle modifier will use when reacting to colliders, if the Jiggle modifier is set to take colliders into account.
public void SetCollisionMask(int collisionMask)
Parameters
collisionMask
int
SetJiggleJointBone2DNode(int, NodePath)
Sets the Bone2D node assigned to the Jiggle joint at jointIdx
.
public void SetJiggleJointBone2DNode(int jointIdx, NodePath bone2DNode)
Parameters
SetJiggleJointBoneIndex(int, int)
Sets the bone index, boneIdx
, of the Jiggle joint at jointIdx
. When possible, this will also update the bone2d_node
of the Jiggle joint based on data provided by the linked skeleton.
public void SetJiggleJointBoneIndex(int jointIdx, int boneIdx)
Parameters
SetJiggleJointDamping(int, float)
Sets the amount of damping of the Jiggle joint at jointIdx
.
public void SetJiggleJointDamping(int jointIdx, float damping)
Parameters
SetJiggleJointGravity(int, Vector2)
Sets the gravity vector of the Jiggle joint at jointIdx
.
public void SetJiggleJointGravity(int jointIdx, Vector2 gravity)
Parameters
SetJiggleJointMass(int, float)
Sets the of mass of the Jiggle joint at jointIdx
.
public void SetJiggleJointMass(int jointIdx, float mass)
Parameters
SetJiggleJointOverride(int, bool)
Sets whether the Jiggle joint at jointIdx
should override the default Jiggle joint settings. Setting this to true
will make the joint use its own settings rather than the default ones attached to the modification.
public void SetJiggleJointOverride(int jointIdx, bool @override)
Parameters
SetJiggleJointStiffness(int, float)
Sets the of stiffness of the Jiggle joint at jointIdx
.
public void SetJiggleJointStiffness(int jointIdx, float stiffness)
Parameters
SetJiggleJointUseGravity(int, bool)
Sets whether the Jiggle joint at jointIdx
should use gravity.
public void SetJiggleJointUseGravity(int jointIdx, bool useGravity)
Parameters
SetUseColliders(bool)
If true
, the Jiggle modifier will take colliders into account, keeping them from entering into these collision objects.
public void SetUseColliders(bool useColliders)
Parameters
useColliders
bool