Table of Contents

Class SkeletonModification2DJiggle

A modification that jiggles Bone2D nodes as they move towards a target.

Inheritance
SkeletonModification2DJiggle

Remarks

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

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.

var damping : float = 0.75

Property Value

float

Remarks

gravity

The default amount of gravity applied to the Jiggle joints, if they are not overridden.

var gravity : Vector2 = Vector2(0, 6)

Property Value

Vector2

Remarks

jiggle_data_chain_length

The amount of Jiggle joints in the Jiggle modification.

var jiggle_data_chain_length : int = 0

Property Value

int

Remarks

  • void set_jiggle_data_chain_length(int value)
  • int get_jiggle_data_chain_length

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.

var mass : float = 0.75

Property Value

float

Remarks

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.

var stiffness : float = 3.0

Property Value

float

Remarks

  • void set_stiffness(float value)
  • float get_stiffness

target_nodepath

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.

var target_nodepath : NodePath = NodePath("")

Property Value

NodePath

Remarks

use_gravity

Whether the gravity vector, gravity, should be applied to the Jiggle joints, assuming they are not overriding the default settings.

var use_gravity : bool = false

Property Value

bool

Remarks

  • void set_use_gravity(bool value)
  • bool get_use_gravity

Methods

get_collision_mask

Qualifiers: const

Returns the collision mask used by the Jiggle modifier when collisions are enabled.

int get_collision_mask

get_jiggle_joint_bone2d_node(int)

Qualifiers: const

Returns the Bone2D node assigned to the Jiggle joint at joint_idx.

NodePath get_jiggle_joint_bone2d_node(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_bone_index(int)

Qualifiers: const

Returns the index of the Bone2D node assigned to the Jiggle joint at joint_idx.

int get_jiggle_joint_bone_index(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_damping(int)

Qualifiers: const

Returns the amount of damping of the Jiggle joint at joint_idx.

float get_jiggle_joint_damping(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_gravity(int)

Qualifiers: const

Returns a Vector2 representing the amount of gravity the Jiggle joint at joint_idx is influenced by.

Vector2 get_jiggle_joint_gravity(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_mass(int)

Qualifiers: const

Returns the amount of mass of the jiggle joint at joint_idx.

float get_jiggle_joint_mass(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_override(int)

Qualifiers: const

Returns a boolean that indicates whether the joint at joint_idx is overriding the default Jiggle joint data defined in the modification.

bool get_jiggle_joint_override(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_stiffness(int)

Qualifiers: const

Returns the stiffness of the Jiggle joint at joint_idx.

float get_jiggle_joint_stiffness(int joint_idx)

Parameters

joint_idx int

get_jiggle_joint_use_gravity(int)

Qualifiers: const

Returns a boolean that indicates whether the joint at joint_idx is using gravity or not.

bool get_jiggle_joint_use_gravity(int joint_idx)

Parameters

joint_idx int

get_use_colliders

Qualifiers: const

Returns whether the jiggle modifier is taking physics colliders into account when solving.

bool get_use_colliders

set_collision_mask(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.

void set_collision_mask(int collision_mask)

Parameters

collision_mask int

set_jiggle_joint_bone2d_node(int, NodePath)

Sets the Bone2D node assigned to the Jiggle joint at joint_idx.

void set_jiggle_joint_bone2d_node(int joint_idx, NodePath bone2d_node)

Parameters

joint_idx int
bone2d_node NodePath

set_jiggle_joint_bone_index(int, int)

Sets the bone index, bone_idx, 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.

void set_jiggle_joint_bone_index(int joint_idx, int bone_idx)

Parameters

joint_idx int
bone_idx int

set_jiggle_joint_damping(int, float)

Sets the amount of damping of the Jiggle joint at joint_idx.

void set_jiggle_joint_damping(int joint_idx, float damping)

Parameters

joint_idx int
damping float

set_jiggle_joint_gravity(int, Vector2)

Sets the gravity vector of the Jiggle joint at joint_idx.

void set_jiggle_joint_gravity(int joint_idx, Vector2 gravity)

Parameters

joint_idx int
gravity Vector2

set_jiggle_joint_mass(int, float)

Sets the of mass of the Jiggle joint at joint_idx.

void set_jiggle_joint_mass(int joint_idx, float mass)

Parameters

joint_idx int
mass float

set_jiggle_joint_override(int, bool)

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.

void set_jiggle_joint_override(int joint_idx, bool override)

Parameters

joint_idx int
override bool

set_jiggle_joint_stiffness(int, float)

Sets the of stiffness of the Jiggle joint at joint_idx.

void set_jiggle_joint_stiffness(int joint_idx, float stiffness)

Parameters

joint_idx int
stiffness float

set_jiggle_joint_use_gravity(int, bool)

Sets whether the Jiggle joint at joint_idx should use gravity.

void set_jiggle_joint_use_gravity(int joint_idx, bool use_gravity)

Parameters

joint_idx int
use_gravity bool

set_use_colliders(bool)

If true, the Jiggle modifier will take colliders into account, keeping them from entering into these collision objects.

void set_use_colliders(bool use_colliders)

Parameters

use_colliders bool