Files
stickman/master_rig.tscn
T
ryan 273090993e feat: Implement facing profiles and bend direction toggles in test harness
- Added functionality for skeleton IK bone switches, allowing users to dynamically change the bend direction of joints via a context menu.
- Introduced facing profiles (LEFT, RIGHT, FORWARD) that modify the bend direction of limbs based on the selected profile.
- Implemented body part z-ordering based on the facing profile, ensuring correct rendering order of limbs relative to the torso.
- Added a coordinates display panel that shows the position and rotation of the Skeleton2D and its bones, as well as IK target positions.
- Created a new script to generate a walk animation for the stickman rig, including keyframe tracks for various IK targets.
- Updated documentation to reflect the new features and their specifications.
2026-08-23 22:21:23 -04:00

401 lines
15 KiB
Plaintext

[gd_scene format=3 uid="uid://dr5ef3l2var2s"]
[sub_resource type="GDScript" id="GDScript_f0s26"]
script/source = "@tool
extends Node2D
@export var radius : float = 100.0:
set(value):
radius = value
queue_redraw()
@export var color : Color = Color.WHITE:
set(value):
color = value
queue_redraw()
func _draw():
draw_circle(Vector2(0,0), radius, color)
"
[sub_resource type="SkeletonModification2DTwoBoneIK" id="SkeletonModification2DTwoBoneIK_yvxej"]
target_nodepath = NodePath("../IK_Targets/Right_Hand")
flip_bend_direction = true
joint_one_bone_idx = 4
joint_one_bone2d_node = NodePath("Torso/RightUpperArm")
joint_two_bone_idx = 5
joint_two_bone2d_node = NodePath("Torso/RightUpperArm/RightLowerArm")
[sub_resource type="SkeletonModification2DTwoBoneIK" id="SkeletonModification2DTwoBoneIK_f0s26"]
target_nodepath = NodePath("../IK_Targets/Left_Hand")
flip_bend_direction = true
joint_one_bone_idx = 2
joint_one_bone2d_node = NodePath("Torso/LeftUpperArm")
joint_two_bone_idx = 3
joint_two_bone2d_node = NodePath("Torso/LeftUpperArm/LeftLowerArm")
[sub_resource type="SkeletonModification2DTwoBoneIK" id="SkeletonModification2DTwoBoneIK_ylko5"]
target_nodepath = NodePath("../IK_Targets/Right_Leg")
joint_one_bone_idx = 8
joint_one_bone2d_node = NodePath("Torso/RightUpperLeg")
joint_two_bone_idx = 9
joint_two_bone2d_node = NodePath("Torso/RightUpperLeg/RightLowerLeg")
[sub_resource type="SkeletonModification2DTwoBoneIK" id="SkeletonModification2DTwoBoneIK_2leu7"]
target_nodepath = NodePath("../IK_Targets/Left_Leg")
joint_one_bone_idx = 6
joint_one_bone2d_node = NodePath("Torso/LeftUpperLeg")
joint_two_bone_idx = 7
joint_two_bone2d_node = NodePath("Torso/LeftUpperLeg/LeftLowerLeg")
[sub_resource type="SkeletonModification2DLookAt" id="SkeletonModification2DLookAt_j4hao"]
bone_index = 1
bone2d_node = NodePath("Torso/Head")
target_nodepath = NodePath("../IK_Targets/Head")
enable_constraint = true
constraint_angle_min = 54.99998
constraint_angle_max = 304.9999
constraint_angle_invert = true
constraint_in_localspace = true
[sub_resource type="SkeletonModificationStack2D" id="SkeletonModificationStack2D_j4hao"]
modification_count = 5
modifications/0 = SubResource("SkeletonModification2DTwoBoneIK_yvxej")
modifications/1 = SubResource("SkeletonModification2DTwoBoneIK_f0s26")
modifications/2 = SubResource("SkeletonModification2DTwoBoneIK_ylko5")
modifications/3 = SubResource("SkeletonModification2DTwoBoneIK_2leu7")
modifications/4 = SubResource("SkeletonModification2DLookAt_j4hao")
[sub_resource type="Animation" id="Animation_2leu7"]
length = 0.001
[sub_resource type="Animation" id="Animation_ylko5"]
length = 0.8
loop_mode = 1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("IK_Targets/Torso:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(0, 10), Vector2(0, -15), Vector2(0, 10), Vector2(0, -15), Vector2(0, 10)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("IK_Targets/Head:position")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(100, -614), Vector2(100, -639), Vector2(100, -614), Vector2(100, -639), Vector2(100, -614)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("IK_Targets/Right_Leg:position")
tracks/2/interp = 2
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(110, 390), Vector2(0, 397), Vector2(-110, 380), Vector2(-20, 320), Vector2(110, 390)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("IK_Targets/Left_Leg:position")
tracks/3/interp = 2
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(-110, 380), Vector2(-20, 320), Vector2(110, 390), Vector2(0, 397), Vector2(-110, 380)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("IK_Targets/Right_Hand:position")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(-90, 110), Vector2(0, 115), Vector2(90, 110), Vector2(0, 115), Vector2(-90, 110)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("IK_Targets/Left_Hand:position")
tracks/5/interp = 2
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.2, 0.4, 0.6, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1),
"update": 0,
"values": [Vector2(90, 110), Vector2(0, 115), Vector2(-90, 110), Vector2(0, 115), Vector2(90, 110)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_t75yq"]
_data = {
&"RESET": SubResource("Animation_2leu7"),
&"walk_right": SubResource("Animation_ylko5")
}
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_6rw38"]
[node name="Master" type="Node2D" unique_id=319103476]
[node name="Body" type="Node2D" parent="." unique_id=327811712]
[node name="Head" type="Node2D" parent="Body" unique_id=864822355]
position = Vector2(-0.03859164, -453.50787)
rotation = 0.00055408623
scale = Vector2(0.9999996, 0.9999996)
script = SubResource("GDScript_f0s26")
[node name="Body" type="Line2D" parent="Body" unique_id=1290443463]
position = Vector2(9.313226e-10, 10.000001)
rotation = -3.1415925
points = PackedVector2Array(0, 0, 0, 400)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="LeftUpperLeg" type="Line2D" parent="Body" unique_id=199373156]
position = Vector2(1.6098846e-05, 10.000002)
rotation = 0.4947604
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="RightUpperLeg" type="Line2D" parent="Body" unique_id=1396556308]
position = Vector2(-2.3252098e-05, 10.000022)
rotation = -0.49392816
scale = Vector2(0.99999994, 0.99999994)
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="LeftLowerLeg" type="Line2D" parent="Body" unique_id=1590485904]
position = Vector2(-94.96416, 186.0165)
rotation = 0.0051915743
scale = Vector2(0.99999994, 0.99999994)
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="RightLowerLeg" type="Line2D" parent="Body" unique_id=29203948]
position = Vector2(94.817635, 186.09546)
rotation = -0.0034907677
scale = Vector2(0.9999998, 0.9999998)
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="LeftUpperArm" type="Line2D" parent="Body" unique_id=744524157]
position = Vector2(9.313226e-10, -238)
rotation = 1.6184965
points = PackedVector2Array(0, 0, 0, 175)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="RightUpperArm" type="Line2D" parent="Body" unique_id=1593646765]
position = Vector2(9.313226e-10, -238)
rotation = -1.6184964
points = PackedVector2Array(0, 0, 0, 175)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="LeftLowerArm" type="Line2D" parent="Body" unique_id=2142117097]
position = Vector2(-167.80888, -246.01059)
rotation = 3.1406152
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="RightLowerArm" type="Line2D" parent="Body" unique_id=1200980480]
position = Vector2(167.80891, -246.01057)
rotation = -3.1406155
points = PackedVector2Array(0, 0, 0, 200)
width = 16.0
default_color = Color(0.445488, 0.445488, 0.445488, 1)
[node name="Skeleton2D" type="Skeleton2D" parent="." unique_id=1854735445]
rotation = -0.0006991282
modification_stack = SubResource("SkeletonModificationStack2D_j4hao")
[node name="Torso" type="Bone2D" parent="Skeleton2D" unique_id=744339938]
position = Vector2(-0.006991281, 9.999998)
rotation = 0.0006991282
rest = Transform2D(0.99999976, 0.00069912814, -0.00069912814, 0.99999976, 0, 0)
[node name="Head" type="Bone2D" parent="Skeleton2D/Torso" unique_id=1487357366]
position = Vector2(-0.12882307, -391.5079)
rotation = 0.00055408623
scale = Vector2(0.9999996, 0.9999996)
rest = Transform2D(0.9998273, 0.0005539903, -0.0005539903, 0.9998273, -0.12882307, -391.5079)
auto_calculate_length_and_angle = false
length = 90.0
bone_angle = -90.0
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/Head" unique_id=396112729]
position = Vector2(0.050337255, -72.00002)
remote_path = NodePath("../../../../Body/Head")
[node name="RayCast_Aim" type="RayCast2D" parent="Skeleton2D/Torso/Head" unique_id=2000000004]
position = Vector2(0, -90)
target_position = Vector2(500, 0)
[node name="LeftUpperArm" type="Bone2D" parent="Skeleton2D/Torso" unique_id=1840957808]
position = Vector2(0, -248)
rotation = 0.047700156
rest = Transform2D(0.9988364, 0.04768082, -0.04768082, 0.9988364, 0, -248)
auto_calculate_length_and_angle = false
length = 168.0
bone_angle = -180.0
[node name="LeftLowerArm" type="Bone2D" parent="Skeleton2D/Torso/LeftUpperArm" unique_id=721380545]
position = Vector2(-168, 0)
rotation = -0.04867762
rest = Transform2D(0.9987903, -0.04865717, 0.04865717, 0.9987903, -168, 0)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = -90.0
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/LeftUpperArm/LeftLowerArm" unique_id=1189277122]
position = Vector2(3.0517578e-05, 1.9073486e-06)
rotation = 3.1415927
remote_path = NodePath("../../../../../Body/LeftLowerArm")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/LeftUpperArm" unique_id=1110605862]
rotation = 1.5707964
remote_path = NodePath("../../../../Body/LeftUpperArm")
[node name="RightUpperArm" type="Bone2D" parent="Skeleton2D/Torso" unique_id=36616186]
position = Vector2(0, -248)
rotation = -0.047700036
rest = Transform2D(0.9988364, -0.047680702, 0.047680702, 0.9988364, 0, -248)
auto_calculate_length_and_angle = false
length = 168.00006
bone_angle = 0.0
[node name="RightLowerArm" type="Bone2D" parent="Skeleton2D/Torso/RightUpperArm" unique_id=1018820563]
position = Vector2(168, 0)
rotation = -1.522119
rest = Transform2D(0.048656836, -0.9987903, 0.9987903, 0.048656836, 168, 0)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = 0.0
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/RightUpperArm/RightLowerArm" unique_id=1282597655]
rotation = -1.5707964
remote_path = NodePath("../../../../../Body/RightLowerArm")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/RightUpperArm" unique_id=975221467]
rotation = -1.5707964
remote_path = NodePath("../../../../Body/RightUpperArm")
[node name="LeftUpperLeg" type="Bone2D" parent="Skeleton2D/Torso" unique_id=180737371]
position = Vector2(-9.536743e-07, 0)
rotation = 0.4947604
rest = Transform2D(0.88005984, 0.47480857, -0.47480857, 0.88005984, -9.536743e-07, 0)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = 90.0
[node name="LeftLowerLeg" type="Bone2D" parent="Skeleton2D/Torso/LeftUpperLeg" unique_id=81288294]
position = Vector2(0, 200)
rotation = 1.0812275
rest = Transform2D(0.4702357, 0.8825176, -0.8825176, 0.4702357, 0, 200)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = 0.0
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/LeftUpperLeg/LeftLowerLeg" unique_id=1673135542]
rotation = -1.5707964
remote_path = NodePath("../../../../../Body/LeftLowerLeg")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/LeftUpperLeg" unique_id=62385944]
position = Vector2(1.5258789e-05, -7.6293945e-06)
remote_path = NodePath("../../../../Body/LeftUpperLeg")
[node name="RightUpperLeg" type="Bone2D" parent="Skeleton2D/Torso" unique_id=1125756606]
rotation = -0.49392816
scale = Vector2(0.99999994, 0.99999994)
rest = Transform2D(0.8800552, -0.47482592, 0.47482592, 0.8800552, 0, 0)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = 90.0
[node name="RightLowerLeg" type="Bone2D" parent="Skeleton2D/Torso/RightUpperLeg" unique_id=1819999778]
position = Vector2(0, 200)
rotation = 2.0612338
scale = Vector2(0.9999999, 0.9999999)
rest = Transform2D(-0.47026652, 0.8825017, -0.8825017, -0.47026652, 0, 200)
auto_calculate_length_and_angle = false
length = 200.0
bone_angle = 0.0
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/RightUpperLeg/RightLowerLeg" unique_id=278100224]
rotation = -1.5707964
remote_path = NodePath("../../../../../Body/RightLowerLeg")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso/RightUpperLeg" unique_id=1607553157]
position = Vector2(-3.0517578e-05, 7.6293945e-06)
remote_path = NodePath("../../../../Body/RightUpperLeg")
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="Skeleton2D/Torso" unique_id=968328845]
rotation = 3.1415927
remote_path = NodePath("../../../Body/Body")
[node name="RayCast_Ground" type="RayCast2D" parent="." unique_id=2000000003]
position = Vector2(0, 350)
[node name="IK_Targets" type="Node2D" parent="." unique_id=1089334064]
[node name="Right_Hand" type="Marker2D" parent="IK_Targets" unique_id=1785254130]
position = Vector2(-90, 110)
[node name="Left_Hand" type="Marker2D" parent="IK_Targets" unique_id=1085197042]
position = Vector2(90, 110)
[node name="Right_Leg" type="Marker2D" parent="IK_Targets" unique_id=720679106]
position = Vector2(110, 390)
[node name="Left_Leg" type="Marker2D" parent="IK_Targets" unique_id=63598929]
position = Vector2(-110, 380)
[node name="RayCast_LeftLeg" type="RayCast2D" parent="IK_Targets" unique_id=2000000001]
position = Vector2(-96, 200)
target_position = Vector2(0, 200)
[node name="RayCast_RightLeg" type="RayCast2D" parent="IK_Targets" unique_id=2000000002]
position = Vector2(96, 200)
target_position = Vector2(0, 200)
[node name="Head" type="Marker2D" parent="IK_Targets" unique_id=1347666160]
position = Vector2(100, -614)
[node name="Torso" type="Marker2D" parent="IK_Targets" unique_id=809821395]
position = Vector2(0, 10)
[node name="RemoteTransform2D" type="RemoteTransform2D" parent="IK_Targets/Torso" unique_id=1659291279]
remote_path = NodePath("../../../Skeleton2D/Torso")
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=679147993]
libraries/ = SubResource("AnimationLibrary_t75yq")
[node name="AnimationTree" type="AnimationTree" parent="." unique_id=1526237266]
active = false
tree_root = SubResource("AnimationNodeStateMachine_6rw38")
anim_player = NodePath("../AnimationPlayer")