fabrik_ik.tscn 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. [gd_scene load_steps=12 format=3 uid="uid://lm753aby2tb6"]
  2. [ext_resource type="Texture2D" uid="uid://bw3q8aq6gfuof" path="res://addons/sade/editor_gizmo_texture.png" id="1"]
  3. [ext_resource type="PackedScene" uid="uid://ctssefekxjogg" path="res://model/godot_battle_bot.dae" id="2"]
  4. [ext_resource type="Material" path="res://model/battle_bot_color.tres" id="3"]
  5. [ext_resource type="Script" path="res://target_from_mousepos.gd" id="5"]
  6. [ext_resource type="Script" path="res://addons/sade/ik_look_at.gd" id="6"]
  7. [ext_resource type="Script" path="res://addons/sade/ik_fabrik.gd" id="8"]
  8. [ext_resource type="Script" path="res://button_change_scene.gd" id="10"]
  9. [sub_resource type="PlaneMesh" id="1"]
  10. size = Vector2(40, 40)
  11. [sub_resource type="StandardMaterial3D" id="2"]
  12. albedo_texture = ExtResource("1")
  13. roughness = 0.2
  14. uv1_scale = Vector3(0.25, 0.25, 0.25)
  15. uv1_triplanar = true
  16. [sub_resource type="BoxMesh" id="3"]
  17. [sub_resource type="StandardMaterial3D" id="4"]
  18. albedo_color = Color(0, 0.191406, 0.765625, 1)
  19. roughness = 0.0
  20. [node name="FABRIK_IK" type="Node3D"]
  21. [node name="Floor" type="MeshInstance3D" parent="."]
  22. mesh = SubResource("1")
  23. surface_material_override/0 = SubResource("2")
  24. [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
  25. transform = Transform3D(0.56827, 0.673454, -0.472789, 0, 0.574581, 0.818448, 0.822842, -0.465099, 0.326517, -9.77531, 11.5204, 11.766)
  26. [node name="GodotBattleBot" parent="." instance=ExtResource("2")]
  27. [node name="godot_battle_bot" parent="GodotBattleBot/Armature/Skeleton3D" index="0"]
  28. surface_material_override/0 = ExtResource("3")
  29. [node name="Camera3D" type="Camera3D" parent="."]
  30. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.5, 11)
  31. fov = 74.0
  32. script = ExtResource("5")
  33. MOVEMENT_SPEED = -8.0
  34. flip_axis = true
  35. [node name="Targets" type="Node3D" parent="Camera3D"]
  36. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8)
  37. [node name="IK_LookAt_Head" type="Node3D" parent="Camera3D/Targets"]
  38. script = ExtResource("6")
  39. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  40. bone_name = "Head"
  41. additional_rotation = Vector3(90, 0, 0)
  42. [node name="IK_FABRIK_Left_Arm" type="Node3D" parent="Camera3D/Targets"]
  43. script = ExtResource("8")
  44. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  45. bones_in_chain = PackedStringArray("Left_UpperArm", "Left_LowerArm")
  46. bones_in_chain_lengths = PackedFloat32Array(1.97, 3)
  47. chain_iterations = 10
  48. limit_chain_iterations = false
  49. use_middle_joint_target = true
  50. [node name="Target" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  51. transform = Transform3D(0.518503, 0, -0.855076, 0, 1, 0, 0.855076, 0, 0.518503, 1.13159, 0, -0.155596)
  52. [node name="IK_LookAt_LH" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm/Target"]
  53. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.343393, -0.133381, 0.836605)
  54. script = ExtResource("6")
  55. skeleton_path = NodePath("../../../../../GodotBattleBot/Armature/Skeleton3D")
  56. bone_name = "Left_Hand"
  57. additional_rotation = Vector3(0, 0, 90)
  58. position_using_additional_bone = true
  59. additional_bone_name = "Left_LowerArm"
  60. additional_bone_length = 3.0
  61. [node name="MiddleJoint" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  62. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.16849, 0, -5.31922)
  63. [node name="Left_UpperArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  64. transform = Transform3D(-0.120249, 0.882081, -0.455493, -0.0511926, 0.452703, 0.890191, 0.991424, 0.130363, -0.00928126, 1.53444, 0.30189, -3.23425)
  65. [node name="Left_LowerArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  66. transform = Transform3D(-0.773624, -0.0228999, 0.633231, 2.98023e-08, 0.999347, 0.03614, -0.633645, 0.0279588, -0.773119, 2.94998, 0.10378, -2.37569)
  67. [node name="IK_FABRIK_Right_Arm" type="Node3D" parent="Camera3D/Targets"]
  68. script = ExtResource("8")
  69. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  70. bones_in_chain = PackedStringArray("Right_UpperArm", "Right_LowerArm", "Right_Hand")
  71. bones_in_chain_lengths = PackedFloat32Array(1.97, 3, 1.2)
  72. chain_iterations = 10
  73. limit_chain_iterations = false
  74. use_middle_joint_target = true
  75. [node name="Target" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  76. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.229958, 0, 0.929313)
  77. [node name="IK_LookAt_RH" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm/Target"]
  78. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0544824, -0.133381, 0.332403)
  79. script = ExtResource("6")
  80. skeleton_path = NodePath("../../../../../GodotBattleBot/Armature/Skeleton3D")
  81. bone_name = "Right_Hand"
  82. additional_rotation = Vector3(0, 0, 90)
  83. [node name="MiddleJoint" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  84. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.34515, 0, -3.7843)
  85. [node name="Right_UpperArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  86. transform = Transform3D(-0.00773287, 0.890205, 0.455493, 0.0143814, -0.455361, 0.890191, 0.999866, 0.0134343, -0.00928123, -1.5334, 0.30189, -3.23425)
  87. [node name="Right_LowerArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  88. transform = Transform3D(-0.792023, 0.0165711, -0.610266, -1.49012e-08, 0.999631, 0.0271438, 0.610491, 0.0214986, -0.791732, -2.89561, 0.100755, -2.31866)
  89. [node name="Right_Hand" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  90. transform = Transform3D(-0.678336, 0.00698721, -0.734719, -2.32831e-09, 0.999955, 0.00950961, 0.734752, 0.00645071, -0.678305, -1.07914, 0.020072, 0.03791)
  91. [node name="1MeterCube" type="MeshInstance3D" parent="Camera3D/Targets"]
  92. mesh = SubResource("3")
  93. surface_material_override/0 = SubResource("4")
  94. [node name="Control" type="Control" parent="."]
  95. layout_mode = 3
  96. anchors_preset = 15
  97. anchor_right = 1.0
  98. anchor_bottom = 1.0
  99. [node name="LabelExtra" type="Label" parent="Control"]
  100. layout_mode = 1
  101. offset_right = 623.0
  102. offset_bottom = 98.0
  103. text = "NOTE: You will get a few errors when saving with FABRIK IK nodes in your scene
  104. This is a known bug. Please ignore the errors for now, as they do not do anything
  105. (They're just annoying. If you find a fix, please add it to the demo repository!)"
  106. [node name="Panel" type="Panel" parent="Control"]
  107. modulate = Color(1, 1, 1, 0.784314)
  108. layout_mode = 1
  109. anchors_preset = 12
  110. anchor_top = 1.0
  111. anchor_right = 1.0
  112. anchor_bottom = 1.0
  113. offset_left = -2.0
  114. offset_top = -79.0
  115. offset_right = 4.0
  116. grow_horizontal = 2
  117. grow_vertical = 0
  118. [node name="Label" type="Label" parent="Control/Panel"]
  119. layout_mode = 1
  120. anchors_preset = 15
  121. anchor_right = 1.0
  122. anchor_bottom = 1.0
  123. grow_horizontal = 2
  124. grow_vertical = 2
  125. text = "F.A.B.R.I.K IK
  126. Move mouse to move IK targets
  127. (Using 3 bones in the right hand, only 2 in the left. 3+ recommended)"
  128. horizontal_alignment = 1
  129. [node name="LabelLeft" type="Label" parent="Control/Panel"]
  130. layout_mode = 1
  131. anchors_preset = 1
  132. anchor_left = 1.0
  133. anchor_right = 1.0
  134. offset_left = -268.0
  135. offset_top = 4.0
  136. offset_right = -155.0
  137. offset_bottom = 27.0
  138. grow_horizontal = 0
  139. text = "Left Hand"
  140. horizontal_alignment = 1
  141. [node name="LabelRight" type="Label" parent="Control/Panel"]
  142. layout_mode = 0
  143. offset_left = 184.0
  144. offset_top = 2.0
  145. offset_right = 297.0
  146. offset_bottom = 25.0
  147. text = "Right Hand"
  148. horizontal_alignment = 1
  149. [node name="ButtonNext" type="Button" parent="Control"]
  150. layout_mode = 0
  151. anchor_left = 1.0
  152. anchor_top = 1.0
  153. anchor_right = 1.0
  154. anchor_bottom = 1.0
  155. offset_left = -124.0
  156. offset_top = -60.0
  157. offset_right = -5.0
  158. offset_bottom = -10.0
  159. text = "Next scene"
  160. script = ExtResource("10")
  161. scene_to_change_to = "res://skeleton_ik.tscn"
  162. [node name="ButtonPrev" type="Button" parent="Control"]
  163. layout_mode = 0
  164. anchor_top = 1.0
  165. anchor_bottom = 1.0
  166. offset_left = 10.0
  167. offset_top = -60.0
  168. offset_right = 129.0
  169. offset_bottom = -10.0
  170. text = "Previous scene"
  171. script = ExtResource("10")
  172. scene_to_change_to = "res://look_at_ik.tscn"
  173. [editable path="GodotBattleBot"]