SkeletonModification2DPhysicalBones
Inherits: SkeletonModification2D < Resource < RefCounted < Object
Description
Section titled “Description”A modification that applies the transforms of PhysicalBone2D nodes to Bone2D nodes.
This modification takes the transforms of PhysicalBone2D nodes and applies them to Bone2D nodes. This allows the Bone2D nodes to react to physics thanks to the linked PhysicalBone2D nodes.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| int | physical_bone_chain_length |
0 |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| void | fetch_physical_bones() |
| EntityPath | get_physical_bone_node(joint_idx: int) const |
| void | set_physical_bone_node(joint_idx: int, physicalbone2d_node: EntityPath) |
| void | start_simulation(bones: Array[StringName] = []) |
| void | stop_simulation(bones: Array[StringName] = []) |
Property descriptions
Section titled “Property descriptions”physical_bone_chain_length
int physical_bone_chain_length = 0
The number of PhysicalBone2D nodes linked in this modification.
Method descriptions
Section titled “Method descriptions”fetch_physical_bones
void fetch_physical_bones()
Empties the list of PhysicalBone2D nodes and populates it with all PhysicalBone2D nodes that are children of the Skeleton2D.
get_physical_bone_node
EntityPath get_physical_bone_node(joint_idx: int) const
Returns the PhysicalBone2D node at joint_idx.
set_physical_bone_node
void set_physical_bone_node(joint_idx: int, physicalbone2d_node: EntityPath)
Sets the PhysicalBone2D node at joint_idx.
Note: This is just the index used for this modification, not the bone index used in the Skeleton2D.
start_simulation
void start_simulation(bones: Array[StringName] = [])
Tell the PhysicalBone2D nodes to start simulating and interacting with the physics world.
Optionally, an array of bone names can be passed to this function, and that will cause only PhysicalBone2D nodes with those names to start simulating.
stop_simulation
void stop_simulation(bones: Array[StringName] = [])
Tell the PhysicalBone2D nodes to stop simulating and interacting with the physics world.
Optionally, an array of bone names can be passed to this function, and that will cause only PhysicalBone2D nodes with those names to stop simulating.
