Add StkRigAdapter for runtime skeleton fitting and shape mounting
- Implemented StkRigAdapter class to adapt a master rig to a loaded .stk dictionary. - Added methods for fitting bone lengths, recalibrating IK targets, and mounting vector shapes. - Defined constants for default proportions and bone paths. - Included error handling for missing nodes and invalid data structures.
This commit is contained in:
+19
-4
@@ -53,7 +53,7 @@ bone_index = 1
|
||||
bone2d_node = NodePath("Torso/Head")
|
||||
target_nodepath = NodePath("../IK_Targets/Head")
|
||||
enable_constraint = true
|
||||
constraint_angle_min = 54.999985
|
||||
constraint_angle_min = 54.99998
|
||||
constraint_angle_max = 304.9999
|
||||
constraint_angle_invert = true
|
||||
constraint_in_localspace = true
|
||||
@@ -73,7 +73,7 @@ modifications/4 = SubResource("SkeletonModification2DLookAt_j4hao")
|
||||
[node name="Head" type="Node2D" parent="Body" unique_id=864822355]
|
||||
position = Vector2(-0.038591623, -463.50787)
|
||||
rotation = 0.000554086
|
||||
scale = Vector2(0.99999994, 0.99999994)
|
||||
scale = Vector2(0.9999999, 0.9999999)
|
||||
script = SubResource("GDScript_f0s26")
|
||||
|
||||
[node name="Body" type="Line2D" parent="Body" unique_id=1290443463]
|
||||
@@ -151,7 +151,7 @@ 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.000554086
|
||||
scale = Vector2(0.99999994, 0.99999994)
|
||||
scale = Vector2(0.9999999, 0.9999999)
|
||||
rest = Transform2D(0.9998273, 0.0005539903, -0.0005539903, 0.9998273, -0.12882307, -391.5079)
|
||||
auto_calculate_length_and_angle = false
|
||||
length = 90.0
|
||||
@@ -161,6 +161,10 @@ bone_angle = -90.0
|
||||
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
|
||||
@@ -238,7 +242,7 @@ remote_path = NodePath("../../../../Body/LeftUpperLeg")
|
||||
rotation = -0.4947779
|
||||
rest = Transform2D(0.8800552, -0.47482592, 0.47482592, 0.8800552, 0, 0)
|
||||
auto_calculate_length_and_angle = false
|
||||
length = 200.0
|
||||
length = 90.0
|
||||
bone_angle = 90.0
|
||||
|
||||
[node name="RightLowerLeg" type="Bone2D" parent="Skeleton2D/Torso/RightUpperLeg" unique_id=1819999778]
|
||||
@@ -261,6 +265,9 @@ remote_path = NodePath("../../../../Body/RightUpperLeg")
|
||||
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]
|
||||
@@ -275,6 +282,14 @@ position = Vector2(96, 376)
|
||||
[node name="Left_Leg" type="Marker2D" parent="IK_Targets" unique_id=63598929]
|
||||
position = Vector2(-96, 376)
|
||||
|
||||
[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(0, -624)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user