SkeletonModification2DJiggle
实验性: This class may be changed or removed in future versions.
继承: SkeletonModification2D
< Resource
< RefCounted
< Object
A modification that jiggles Bone2D
nodes as they move towards a target.
描述
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.
属性
float | damping |
Vector2 | gravity |
int | jiggle_data_chain_length |
float | mass |
float | stiffness |
NodePath | target_nodepath |
bool | use_gravity |
方法
属性说明
float
damping = 0.75
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.
Vector2
gravity = Vector2(0, 6)
The default amount of gravity applied to the Jiggle joints, if they are not overridden.
int
jiggle_data_chain_length = 0
The amount of Jiggle joints in the Jiggle modification.
float
mass = 0.75
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 = 3.0
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 = 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.
bool
use_gravity = false
Whether the gravity vector, gravity
, should be applied to the Jiggle joints, assuming they are not overriding the default settings.
方法说明
int
get_collision_mask ( ) const1
Returns the collision mask used by the Jiggle modifier when collisions are enabled.
NodePath
get_jiggle_joint_bone2d_node ( joint_idx: int
) const1
Returns the Bone2D
node assigned to the Jiggle joint at joint_idx
.
int
get_jiggle_joint_bone_index ( joint_idx: int
) const1
Returns the index of the Bone2D
node assigned to the Jiggle joint at joint_idx
.
float
get_jiggle_joint_damping ( joint_idx: int
) const1
Returns the amount of damping of the Jiggle joint at joint_idx
.
Vector2
get_jiggle_joint_gravity ( joint_idx: int
) const1
Returns a Vector2
representing the amount of gravity the Jiggle joint at joint_idx
is influenced by.
float
get_jiggle_joint_mass ( joint_idx: int
) const1
Returns the amount of mass of the jiggle joint at joint_idx
.
bool
get_jiggle_joint_override ( joint_idx: int
) const1
Returns a boolean that indicates whether the joint at joint_idx
is overriding the default Jiggle joint data defined in the modification.
float
get_jiggle_joint_stiffness ( joint_idx: int
) const1
Returns the stiffness of the Jiggle joint at joint_idx
.
bool
get_jiggle_joint_use_gravity ( joint_idx: int
) const1
Returns a boolean that indicates whether the joint at joint_idx
is using gravity or not.
bool
get_use_colliders ( ) const1
Returns whether the jiggle modifier is taking physics colliders into account when solving.
void
set_collision_mask ( 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_jiggle_joint_bone2d_node ( joint_idx: int
, bone2d_node: NodePath
)
Sets the Bone2D
node assigned to the Jiggle joint at joint_idx
.
void
set_jiggle_joint_bone_index ( joint_idx: int
, bone_idx: 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_damping ( joint_idx: int
, damping: float
)
Sets the amount of damping of the Jiggle joint at joint_idx
.
void
set_jiggle_joint_gravity ( joint_idx: int
, gravity: Vector2
)
Sets the gravity vector of the Jiggle joint at joint_idx
.
void
set_jiggle_joint_mass ( joint_idx: int
, mass: float
)
Sets the of mass of the Jiggle joint at joint_idx
.
void
set_jiggle_joint_override ( joint_idx: int
, override: 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_stiffness ( joint_idx: int
, stiffness: float
)
Sets the of stiffness of the Jiggle joint at joint_idx
.
void
set_jiggle_joint_use_gravity ( joint_idx: int
, use_gravity: bool
)
Sets whether the Jiggle joint at joint_idx
should use gravity.
void
set_use_colliders ( use_colliders: bool
)
If true
, the Jiggle modifier will take colliders into account, keeping them from entering into these collision objects.
本方法通常需要用户覆盖才能生效。
本方法无副作用,不会修改该实例的任何成员变量。
本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。
本方法用于构造某个类型。
调用本方法无需实例,可直接使用类名进行调用。
本方法描述的是使用本类型作为左操作数的有效运算符。
这个值是由下列位标志构成位掩码的整数。
无返回值。