fabrik_ik.tscn 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. [gd_scene load_steps=14 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="Texture2D" uid="uid://dhgpf3w8mh4ed" path="res://addons/sade/ik_look_at.png" id="7"]
  8. [ext_resource type="Script" path="res://addons/sade/ik_fabrik.gd" id="8"]
  9. [ext_resource type="Texture2D" uid="uid://dfojvg0ykx146" path="res://addons/sade/ik_fabrik.png" id="9"]
  10. [ext_resource type="Script" path="res://button_change_scene.gd" id="10"]
  11. [sub_resource type="PlaneMesh" id="1"]
  12. size = Vector2(40, 40)
  13. [sub_resource type="StandardMaterial3D" id="2"]
  14. albedo_texture = ExtResource( "1" )
  15. roughness = 0.2
  16. uv1_scale = Vector3(0.25, 0.25, 0.25)
  17. uv1_triplanar = true
  18. [sub_resource type="BoxMesh" id="3"]
  19. [sub_resource type="StandardMaterial3D" id="4"]
  20. albedo_color = Color(0, 0.191406, 0.765625, 1)
  21. roughness = 0.0
  22. [node name="FABRIK_IK" type="Node3D"]
  23. [node name="Floor" type="MeshInstance3D" parent="."]
  24. mesh = SubResource( "1" )
  25. surface_material_override/0 = SubResource( "2" )
  26. [node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
  27. 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)
  28. [node name="GodotBattleBot" parent="." instance=ExtResource( "2" )]
  29. [node name="godot_battle_bot" parent="GodotBattleBot/Armature/Skeleton3D" index="0"]
  30. surface_material_override/0 = ExtResource( "3" )
  31. [node name="Camera3D" type="Camera3D" parent="."]
  32. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.5, 11)
  33. fov = 74.0
  34. script = ExtResource( "5" )
  35. MOVEMENT_SPEED = -8.0
  36. flip_axis = true
  37. [node name="Targets" type="Node3D" parent="Camera3D"]
  38. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -8)
  39. [node name="IK_LookAt_Head" type="Node3D" parent="Camera3D/Targets"]
  40. script = ExtResource( "6" )
  41. __meta__ = {
  42. "_editor_icon": ExtResource( "7" )
  43. }
  44. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  45. bone_name = "Head"
  46. additional_rotation = Vector3(90, 0, 0)
  47. [node name="IK_FABRIK_Left_Arm" type="Node3D" parent="Camera3D/Targets"]
  48. script = ExtResource( "8" )
  49. __meta__ = {
  50. "_editor_icon": ExtResource( "9" )
  51. }
  52. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  53. bones_in_chain = PackedStringArray("Left_UpperArm", "Left_LowerArm")
  54. bones_in_chain_lengths = PackedFloat32Array(1.97, 3)
  55. chain_iterations = 10
  56. limit_chain_iterations = false
  57. use_middle_joint_target = true
  58. [node name="Target" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  59. transform = Transform3D(0.518503, 0, -0.855076, 0, 1, 0, 0.855076, 0, 0.518503, 1.13159, 0, -0.155596)
  60. [node name="IK_LookAt_LH" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm/Target"]
  61. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.343393, -0.133381, 0.836605)
  62. script = ExtResource( "6" )
  63. __meta__ = {
  64. "_editor_icon": ExtResource( "7" )
  65. }
  66. skeleton_path = NodePath("../../../../../GodotBattleBot/Armature/Skeleton3D")
  67. bone_name = "Left_Hand"
  68. additional_rotation = Vector3(0, 0, 90)
  69. position_using_additional_bone = true
  70. additional_bone_name = "Left_LowerArm"
  71. additional_bone_length = 3.0
  72. [node name="MiddleJoint" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  73. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 7.16849, 0, -5.31922)
  74. [node name="Left_UpperArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  75. 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)
  76. [node name="Left_LowerArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Left_Arm"]
  77. 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)
  78. [node name="IK_FABRIK_Right_Arm" type="Node3D" parent="Camera3D/Targets"]
  79. script = ExtResource( "8" )
  80. __meta__ = {
  81. "_editor_icon": ExtResource( "9" )
  82. }
  83. skeleton_path = NodePath("../../../GodotBattleBot/Armature/Skeleton3D")
  84. bones_in_chain = PackedStringArray("Right_UpperArm", "Right_LowerArm", "Right_Hand")
  85. bones_in_chain_lengths = PackedFloat32Array(1.97, 3, 1.2)
  86. chain_iterations = 10
  87. limit_chain_iterations = false
  88. use_middle_joint_target = true
  89. [node name="Target" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  90. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.229958, 0, 0.929313)
  91. [node name="IK_LookAt_RH" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm/Target"]
  92. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0544824, -0.133381, 0.332403)
  93. script = ExtResource( "6" )
  94. __meta__ = {
  95. "_editor_icon": ExtResource( "7" )
  96. }
  97. skeleton_path = NodePath("../../../../../GodotBattleBot/Armature/Skeleton3D")
  98. bone_name = "Right_Hand"
  99. additional_rotation = Vector3(0, 0, 90)
  100. [node name="MiddleJoint" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  101. transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.34515, 0, -3.7843)
  102. [node name="Right_UpperArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  103. 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)
  104. [node name="Right_LowerArm" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  105. 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)
  106. [node name="Right_Hand" type="Node3D" parent="Camera3D/Targets/IK_FABRIK_Right_Arm"]
  107. 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)
  108. [node name="1MeterCube" type="MeshInstance3D" parent="Camera3D/Targets"]
  109. mesh = SubResource( "3" )
  110. surface_material_override/0 = SubResource( "4" )
  111. [node name="Control" type="Control" parent="."]
  112. anchor_right = 1.0
  113. anchor_bottom = 1.0
  114. __meta__ = {
  115. "_edit_use_anchors_": false
  116. }
  117. [node name="Panel" type="Panel" parent="Control"]
  118. modulate = Color(1, 1, 1, 0.784314)
  119. anchor_top = 1.0
  120. anchor_right = 1.0
  121. anchor_bottom = 1.0
  122. offset_left = -2.0
  123. offset_top = -70.0
  124. offset_right = 4.0
  125. [node name="Label" type="Label" parent="Control/Panel"]
  126. anchor_right = 1.0
  127. anchor_bottom = 1.0
  128. offset_left = 12.0
  129. offset_top = 10.0
  130. offset_right = -18.0
  131. offset_bottom = -29.0
  132. text = "F.A.B.R.I.K IK
  133. Move mouse to move IK targets
  134. (Using 3 bones in the right hand, only 2 in the left. 3+ recommended)"
  135. [node name="LabelExtra" type="Label" parent="Control/Panel"]
  136. anchor_right = 1.0
  137. anchor_bottom = 1.0
  138. offset_left = 12.0
  139. offset_top = 80.0
  140. offset_right = -18.0
  141. offset_bottom = 58.0
  142. text = "NOTE: You will get a few errors when saving with FABRIK IK nodes in your scene
  143. This is a known bug. Please ignore the errors for now, as they do not do anything
  144. (They're just annoying. If you find a fix, please add it to the demo repository!)"
  145. __meta__ = {
  146. "_edit_use_anchors_": false
  147. }
  148. [node name="LabelLeft" type="Label" parent="Control/Panel"]
  149. anchor_left = 1.0
  150. anchor_right = 1.0
  151. offset_left = -248.0
  152. offset_top = 4.0
  153. offset_right = -135.0
  154. offset_bottom = 18.0
  155. text = "Left Hand"
  156. [node name="LabelRight" type="Label" parent="Control/Panel"]
  157. offset_left = 136.0
  158. offset_top = 5.0
  159. offset_right = 249.0
  160. offset_bottom = 19.0
  161. text = "Right Hand"
  162. [node name="ButtonNext" type="Button" parent="Control"]
  163. anchor_left = 1.0
  164. anchor_top = 1.0
  165. anchor_right = 1.0
  166. anchor_bottom = 1.0
  167. offset_left = -124.0
  168. offset_top = -60.0
  169. offset_right = -5.0
  170. offset_bottom = -10.0
  171. text = "Next scene"
  172. script = ExtResource( "10" )
  173. scene_to_change_to = "res://skeleton_ik.tscn"
  174. [node name="ButtonPrev" type="Button" parent="Control"]
  175. anchor_top = 1.0
  176. anchor_bottom = 1.0
  177. offset_left = 10.0
  178. offset_top = -60.0
  179. offset_right = 129.0
  180. offset_bottom = -10.0
  181. text = "Previous scene"
  182. script = ExtResource( "10" )
  183. __meta__ = {
  184. "_edit_use_anchors_": false
  185. }
  186. scene_to_change_to = "res://look_at_ik.tscn"
  187. [editable path="GodotBattleBot"]