SkeletonModification2DJiggle¶
Inherits: SkeletonModification2D < Resource < RefCounted < Object
A modification that jiggles Bone2D nodes as they move towards a target.
Description¶
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.
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
Property Descriptions¶
float damping
Default |
|
Setter |
set_damping(value) |
Getter |
get_damping() |
The default amount of dampening applied to the Jiggle joints, if they are not overridden. Higher values lead to more of the calculated velocity being applied.
Vector2 gravity
Default |
|
Setter |
set_gravity(value) |
Getter |
get_gravity() |
The default amount of gravity applied to the Jiggle joints, if they are not overridden.
int jiggle_data_chain_length
Default |
|
Setter |
set_jiggle_data_chain_length(value) |
Getter |
get_jiggle_data_chain_length() |
The amount of Jiggle joints in the Jiggle modification.
float mass
Default |
|
Setter |
set_mass(value) |
Getter |
get_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.
float stiffness
Default |
|
Setter |
set_stiffness(value) |
Getter |
get_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.
NodePath target_nodepath
Default |
|
Setter |
set_target_node(value) |
Getter |
get_target_node() |
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.
bool use_gravity
Default |
|
Setter |
set_use_gravity(value) |
Getter |
get_use_gravity() |
Whether the gravity vector, gravity, should be applied to the Jiggle joints, assuming they are not overriding the default settings.
Method Descriptions¶
int get_collision_mask ( ) const
Returns the collision mask used by the Jiggle modifier when collisions are enabled.
Returns the Bone2D node assigned to the Jiggle joint at joint_idx
.
Returns the index of the Bone2D node assigned to the Jiggle joint at joint_idx
.
Returns the amount of damping of the Jiggle joint at joint_idx
.
Returns a Vector2 representing the amount of gravity the Jiggle joint at joint_idx
is influenced by.
Returns the amount of mass of the jiggle joint at joint_idx
.
Returns a boolean that indicates whether the joint at joint_idx
is overriding the default Jiggle joint data defined in the modification.
Returns the stiffness of the Jiggle joint at joint_idx
.
Returns a boolean that indicates whether the joint at joint_idx
is using gravity or not.
bool get_use_colliders ( ) const
Returns whether the jiggle modifier is taking physics colliders into account when solving.
void set_collision_mask ( int collision_mask )
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.
Sets the Bone2D node assigned to the Jiggle joint at joint_idx
.
Sets the bone index, bone_index
, of the Jiggle joint at joint_idx
. When possible, this will also update the bone2d_node
of the Jiggle joint based on data provided by the linked skeleton.
Sets the amount of dampening of the Jiggle joint at joint_idx
.
Sets the gravity vector of the Jiggle joint at joint_idx
.
Sets the of mass of the Jiggle joint at joint_idx
.
Sets whether the Jiggle joint at joint_idx
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.
Sets the of stiffness of the Jiggle joint at joint_idx
.
Sets whether the Jiggle joint at joint_idx
should use gravity.
void set_use_colliders ( bool use_colliders )
If true
, the Jiggle modifier will take colliders into account, keeping them from entering into these collision objects.