PhysicalBone2D
Inherits: RigidBody2D < PhysicsBody2D < CollisionObject2D < Entity2D < CanvasItem < Entity < Object
Description
Section titled “Description”A RigidBody2D-derived node used to make Bone2Ds in a Skeleton2D react to physics.
The PhysicalBone2D node is a RigidBody2D-based node that can be used to make Bone2Ds in a Skeleton2D react to physics.
Note: To make the Bone2Ds visually follow the PhysicalBone2D node, use a SkeletonModification2DPhysicalBones modification on the Skeleton2D parent.
Note: The PhysicalBone2D node does not automatically create a Joint2D node to keep PhysicalBone2D nodes together. They must be created manually. For most cases, you want to use a PinJoint2D node. The PhysicalBone2D node will automatically configure the Joint2D node once it’s been added as a child node.
Properties
Section titled “Properties”| Type | Name | Default |
|---|---|---|
| bool | auto_configure_joint |
true |
| int | bone2d_index |
-1 |
| EntityPath | bone2d_nodepath |
EntityPath("") |
| bool | follow_bone_when_simulating |
false |
| bool | simulate_physics |
false |
Methods
Section titled “Methods”| Returns | Method |
|---|---|
| Joint2D | get_joint() const |
| bool | is_simulating_physics() const |
Property descriptions
Section titled “Property descriptions”auto_configure_joint
bool auto_configure_joint = true
If true, the PhysicalBone2D will automatically configure the first Joint2D child node. The automatic configuration is limited to setting up the node properties and positioning the Joint2D.
bone2d_index
int bone2d_index = -1
The index of the Bone2D that this PhysicalBone2D should simulate.
bone2d_nodepath
EntityPath bone2d_nodepath = EntityPath("")
The EntityPath to the Bone2D that this PhysicalBone2D should simulate.
follow_bone_when_simulating
bool follow_bone_when_simulating = false
If true, the PhysicalBone2D will keep the transform of the bone it is bound to when simulating physics.
simulate_physics
bool simulate_physics = false
If true, the PhysicalBone2D will start simulating using physics. If false, the PhysicalBone2D will follow the transform of the Bone2D node.
Note: To have the Bone2Ds visually follow the PhysicalBone2D, use a SkeletonModification2DPhysicalBones modification on the Skeleton2D node with the Bone2D nodes.
Method descriptions
Section titled “Method descriptions”get_joint
Joint2D get_joint() const
Returns the first Joint2D child node, if one exists. This is mainly a helper function to make it easier to get the Joint2D that the PhysicalBone2D is autoconfiguring.
is_simulating_physics
bool is_simulating_physics() const
Returns a boolean that indicates whether the PhysicalBone2D is running and simulating using the Orblit 2D physics engine. When true, the PhysicalBone2D node is using physics.
