Work on fixing the ik demo.

This commit is contained in:
Relintai 2024-09-30 18:35:21 +02:00
parent f5d91b4e6e
commit fa5375534b
7 changed files with 342 additions and 30 deletions

View File

@ -1,4 +1,3 @@
tool
extends Spatial extends Spatial
# A FABRIK IK chain with a middle joint helper. # A FABRIK IK chain with a middle joint helper.
@ -14,9 +13,10 @@ export(PoolRealArray) var bones_in_chain_lengths setget _set_bone_chain_lengths
export(int, "_process", "_physics_process", "_notification", "none") var update_mode = 0 setget _set_update_mode export(int, "_process", "_physics_process", "_notification", "none") var update_mode = 0 setget _set_update_mode
var target: Spatial = null var target : Spatial = null
var skeleton: Skeleton var skeleton : Skeleton
var skeleton_up : Vector3
# A dictionary holding all of the bone IDs (from the skeleton) and a dictionary holding # A dictionary holding all of the bone IDs (from the skeleton) and a dictionary holding
# all of the bone helper nodes # all of the bone helper nodes
@ -151,7 +151,7 @@ func update_skeleton():
bone_nodes[i].global_transform = get_bone_transform(i) bone_nodes[i].global_transform = get_bone_transform(i)
# If this is not the last bone in the bone chain, make it look at the next bone in the bone chain # If this is not the last bone in the bone chain, make it look at the next bone in the bone chain
if i < bone_IDs.size()-1: if i < bone_IDs.size()-1:
bone_nodes[i].look_at(get_bone_transform(i+1).origin + skeleton.global_transform.origin, Vector3.UP) bone_nodes[i].look_at(get_bone_transform(i+1).origin + skeleton.global_transform.origin, skeleton_up)
i += 1 i += 1
@ -293,7 +293,7 @@ func chain_apply_rotation():
else: else:
var b_target = target.global_transform var b_target = target.global_transform
b_target.origin = skeleton.global_transform.xform_inv(b_target.origin) b_target.origin = skeleton.global_transform.xform_inv(b_target.origin)
bone_trans = bone_trans.looking_at(b_target.origin, Vector3.UP) bone_trans = bone_trans.looking_at(b_target.origin, skeleton_up)
# A bit of a hack. Because we only have two bones, we have to use the previous # A bit of a hack. Because we only have two bones, we have to use the previous
# bone to position the last bone in the chain. # bone to position the last bone in the chain.
@ -319,7 +319,7 @@ func chain_apply_rotation():
var dir = (b_target_two.origin - b_target.origin).normalized() var dir = (b_target_two.origin - b_target.origin).normalized()
# Make this bone look towards the direction of the next bone # Make this bone look towards the direction of the next bone
bone_trans = bone_trans.looking_at(b_target.origin + dir, Vector3.UP) bone_trans = bone_trans.looking_at(b_target.origin + dir, skeleton_up)
# Set the position of the bone to the bone target. # Set the position of the bone to the bone target.
# Prior to Godot 3.2, this was not necessary, but because we can now completely # Prior to Godot 3.2, this was not necessary, but because we can now completely
@ -332,7 +332,7 @@ func chain_apply_rotation():
func get_bone_transform(bone, convert_to_world_space = true): func get_bone_transform(bone, convert_to_world_space = true):
# Get the global transform of the bone # Get the global transform of the bone
var ret: Transform = skeleton.get_bone_global_pose(bone_IDs[bones_in_chain[bone]]) var ret: Transform = skeleton.get_bone_global_pose_no_override(bone_IDs[bones_in_chain[bone]])
# If we need to convert the bone position from bone/skeleton space to world space, we # If we need to convert the bone position from bone/skeleton space to world space, we
# use the Xform of the skeleton (because bone/skeleton space is relative to the position of the skeleton node). # use the Xform of the skeleton (because bone/skeleton space is relative to the position of the skeleton node).
@ -413,6 +413,7 @@ func _set_skeleton_path(new_value):
# If it has the method "get_bone_global_pose" it is likely a Skeleton # If it has the method "get_bone_global_pose" it is likely a Skeleton
if temp.has_method("get_bone_global_pose"): if temp.has_method("get_bone_global_pose"):
skeleton = temp skeleton = temp
skeleton_up = skeleton.global_transform.xform_inv(Vector3.UP)
bone_IDs = {} bone_IDs = {}
# (Delete all of the old bone nodes and) Make all of the bone nodes for each bone in the IK chain # (Delete all of the old bone nodes and) Make all of the bone nodes for each bone in the IK chain

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=2] [gd_scene load_steps=13 format=3]
[ext_resource path="res://addons/sade/editor_gizmo_texture.png" type="Texture" id=1] [ext_resource path="res://addons/sade/editor_gizmo_texture.png" type="Texture" id=1]
[ext_resource path="res://model/godot_battle_bot.gltf" type="PackedScene" id=2] [ext_resource path="res://model/godot_battle_bot.gltf" type="PackedScene" id=2]
@ -37,6 +37,109 @@ transform = Transform( 0.56827, 0.673454, -0.472789, 0, 0.574581, 0.818448, 0.82
[node name="GodotBattleBot" parent="." instance=ExtResource( 2 )] [node name="GodotBattleBot" parent="." instance=ExtResource( 2 )]
[node name="Skeleton" parent="GodotBattleBot/Z_UP/Armature" index="0"]
bones/0/position = Vector3( 0, 0.273024, 7.74588 )
bones/0/rotation = Quaternion( 0.759715, 7.75166e-08, 9.06254e-08, 0.650256 )
bones/1/position = Vector3( -0.858803, 0.0572646, 0.105923 )
bones/1/rotation = Quaternion( 0.662256, -0.013691, 0.740854, 0.111198 )
bones/1/scale = Vector3( 0.999998, 1, 0.999999 )
bones/2/position = Vector3( -2.98023e-08, 3.3419, -3.20375e-07 )
bones/2/rotation = Quaternion( 0.0400348, -0.0480878, -0.010588, 0.997984 )
bones/2/scale = Vector3( 1, 1, 1 )
bones/3/position = Vector3( -2.80359e-08, 3.53825, 1.61034e-08 )
bones/3/rotation = Quaternion( 0.513193, 0.52962, -0.484649, 0.470374 )
bones/3/scale = Vector3( 1, 1, 1 )
bones/4/position = Vector3( 0.863247, 0.0572646, 0.105923 )
bones/4/rotation = Quaternion( 0.671069, 0.109276, 0.732881, -0.0247196 )
bones/4/scale = Vector3( 0.999997, 1, 0.999998 )
bones/5/position = Vector3( -1.49012e-08, 3.3419, 1.99303e-07 )
bones/5/rotation = Quaternion( -0.0387784, -0.051742, -0.0145302, 0.997802 )
bones/6/position = Vector3( 4.21492e-09, 3.53825, -2.17745e-08 )
bones/6/rotation = Quaternion( 0.484649, 0.470374, -0.513194, 0.529619 )
bones/6/scale = Vector3( 1, 1, 1 )
bones/7/position = Vector3( -9.64506e-15, 1.7917, 5.65778e-08 )
bones/7/rotation = Quaternion( -0.15185, -3.93786e-11, -3.62496e-08, 0.988404 )
bones/7/scale = Vector3( 1, 1, 1 )
bones/8/position = Vector3( -1.5334, 2.29565, 0.106341 )
bones/8/rotation = Quaternion( 0.694368, -0.212646, 0.677236, 0.118263 )
bones/8/scale = Vector3( 0.999999, 1, 1 )
bones/9/position = Vector3( 9.31323e-09, 1.90503, 1.91387e-07 )
bones/9/rotation = Quaternion( 0.0430889, -0.00651108, 0.00492581, 0.999038 )
bones/9/scale = Vector3( 1, 1, 1 )
bones/10/position = Vector3( -1.54338e-08, 2.97659, 1.80687e-07 )
bones/10/rotation = Quaternion( 0.0254076, 0.0314977, -0.0425505, 0.998274 )
bones/10/scale = Vector3( 1, 1, 1 )
bones/11/position = Vector3( -0.251191, 0.961984, 0.0683811 )
bones/11/rotation = Quaternion( 0.0734265, -0.0198738, 0.116597, 0.990262 )
bones/11/scale = Vector3( 1, 1, 1 )
bones/12/position = Vector3( -4.47035e-08, 0.221738, 1.02445e-08 )
bones/12/rotation = Quaternion( 0.161002, 0.714417, 0.150246, 0.664163 )
bones/12/scale = Vector3( 1, 1, 1 )
bones/13/position = Vector3( -0.0779908, 1.04339, 0.000736893 )
bones/13/rotation = Quaternion( 0.122292, 0.00257627, 0.104377, 0.986987 )
bones/13/scale = Vector3( 1, 1, 1 )
bones/14/position = Vector3( -2.98023e-08, 0.267715, -8.27014e-07 )
bones/14/rotation = Quaternion( 0.147368, 0.694839, 0.0466993, 0.702353 )
bones/14/scale = Vector3( 1, 1, 1 )
bones/15/position = Vector3( 0.0960594, 1.04882, 0.0192584 )
bones/15/rotation = Quaternion( 0.0901164, 0.0392194, 0.00840297, 0.995123 )
bones/16/position = Vector3( 1.86265e-08, 0.277596, -4.6991e-07 )
bones/16/rotation = Quaternion( 0.115872, 0.681565, 0.114615, 0.713377 )
bones/16/scale = Vector3( 1, 1, 1 )
bones/17/position = Vector3( 0.26401, 0.982311, 0.0351903 )
bones/17/rotation = Quaternion( 0.0915952, 0.0987206, -0.130385, 0.982275 )
bones/17/scale = Vector3( 1, 1, 1 )
bones/18/position = Vector3( -2.23517e-07, 0.27682, 1.3411e-07 )
bones/18/rotation = Quaternion( 0.111001, 0.648784, 0.123964, 0.742557 )
bones/18/scale = Vector3( 1, 1, 1 )
bones/19/position = Vector3( 0.408326, 0.607306, 0.0419031 )
bones/19/rotation = Quaternion( 0.104368, 0.154824, -0.245653, 0.951205 )
bones/19/scale = Vector3( 1, 1, 1 )
bones/20/position = Vector3( -2.98023e-08, 0.301735, 4.47035e-08 )
bones/20/rotation = Quaternion( -0.0481356, 0.617453, 0.0348587, 0.784359 )
bones/20/scale = Vector3( 1, 1, 1 )
bones/21/position = Vector3( 1.53444, 2.29565, 0.106341 )
bones/21/rotation = Quaternion( 0.625464, 0.10264, 0.741343, -0.220612 )
bones/21/scale = Vector3( 1, 1, 1 )
bones/22/position = Vector3( 2.98023e-08, 1.90503, 1.08033e-07 )
bones/22/rotation = Quaternion( -0.0433319, -0.0654617, 0.00180953, 0.996912 )
bones/22/scale = Vector3( 1, 1, 1 )
bones/23/position = Vector3( 1.22048e-08, 2.97659, -6.07568e-07 )
bones/23/rotation = Quaternion( -0.0240965, -0.00100487, -0.0433063, 0.998771 )
bones/24/position = Vector3( -0.246549, 0.961984, -0.083585 )
bones/24/rotation = Quaternion( -0.0826772, 0.0401178, 0.11023, 0.989649 )
bones/24/scale = Vector3( 1, 1, 1 )
bones/25/position = Vector3( -1.49012e-07, 0.221738, -1.13621e-07 )
bones/25/rotation = Quaternion( -0.119531, 0.715918, -0.184954, 0.662544 )
bones/25/scale = Vector3( 1, 1, 1 )
bones/26/position = Vector3( -0.0778003, 1.04339, -0.00549548 )
bones/26/rotation = Quaternion( -0.132841, 0.0438432, 0.0905715, 0.986016 )
bones/26/scale = Vector3( 1, 1, 1 )
bones/27/position = Vector3( 1.04308e-07, 0.267716, -1.37836e-07 )
bones/27/rotation = Quaternion( -0.0236808, 0.700911, -0.152766, 0.696294 )
bones/27/scale = Vector3( 1, 1, 1 )
bones/28/position = Vector3( 0.0970556, 1.04882, -0.01336 )
bones/28/rotation = Quaternion( -0.0904035, 0.0402447, -0.00433424, 0.995082 )
bones/28/scale = Vector3( 1, 1, 1 )
bones/29/position = Vector3( 7.68341e-09, 0.277596, -5.1083e-07 )
bones/29/rotation = Quaternion( -0.0926483, 0.681722, -0.134087, 0.713227 )
bones/29/scale = Vector3( 1, 1, 1 )
bones/30/position = Vector3( 0.265665, 0.982311, -0.019011 )
bones/30/rotation = Quaternion( -0.0656662, 0.0260568, -0.145182, 0.98688 )
bones/30/scale = Vector3( 1, 1, 1 )
bones/31/position = Vector3( 3.12924e-07, 0.276819, -7.82311e-08 )
bones/31/rotation = Quaternion( -0.102156, 0.648696, -0.131348, 0.742634 )
bones/31/scale = Vector3( 1, 1, 1 )
bones/32/position = Vector3( 0.410121, 0.607306, -0.0169033 )
bones/32/rotation = Quaternion( -0.0424852, 0.0187641, -0.263502, 0.96354 )
bones/32/scale = Vector3( 1, 1, 1 )
bones/33/position = Vector3( 1.19209e-07, 0.301735, 1.56462e-07 )
bones/33/rotation = Quaternion( -0.0440545, 0.63492, 0.039892, 0.770289 )
bones/33/scale = Vector3( 1, 1, 1 )
bones/34/position = Vector3( 1.17961e-15, 2.97461, 2.98023e-08 )
bones/34/rotation = Quaternion( -1.13845e-08, 0.997388, 0.0722371, 7.53007e-08 )
bones/34/scale = Vector3( 1, 1, 1 )
[node name="Camera" type="Camera" parent="."] [node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.5, 11 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.5, 11 )
fov = 74.0 fov = 74.0
@ -54,7 +157,6 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Head" bone_name = "Head"
additional_rotation = Vector3( 90, 0, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="IK_FABRIK_Left_Arm" type="Spatial" parent="Camera/Targets"] [node name="IK_FABRIK_Left_Arm" type="Spatial" parent="Camera/Targets"]
@ -65,7 +167,6 @@ __meta__ = {
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bones_in_chain = PoolStringArray( "Left_UpperArm", "Left_LowerArm" ) bones_in_chain = PoolStringArray( "Left_UpperArm", "Left_LowerArm" )
bones_in_chain_lengths = PoolRealArray( 1.97, 3 ) bones_in_chain_lengths = PoolRealArray( 1.97, 3 )
chain_iterations = 10
limit_chain_iterations = false limit_chain_iterations = false
use_middle_joint_target = true use_middle_joint_target = true
@ -80,8 +181,6 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Left_Hand" bone_name = "Left_Hand"
additional_rotation = Vector3( 0, 0, 90 )
position_using_additional_bone = true
additional_bone_name = "Left_LowerArm" additional_bone_name = "Left_LowerArm"
additional_bone_length = 3.0 additional_bone_length = 3.0
@ -89,10 +188,10 @@ additional_bone_length = 3.0
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.16849, 0, -5.31922 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.16849, 0, -5.31922 )
[node name="Left_UpperArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Left_Arm"] [node name="Left_UpperArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Left_Arm"]
transform = Transform( -0.66477, 0.0771345, -0.743055, -2.23517e-08, 0.994655, 0.103252, 0.747048, 0.0686391, -0.661217, 1.53444, 0.300478, -3.63533 ) transform = Transform( 0.138269, 0.566654, -0.812271, 0, 0.820149, 0.57215, 0.990395, -0.0791108, 0.113401, 1.53444, 0.30189, -3.23425 )
[node name="Left_LowerArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Left_Arm"] [node name="Left_LowerArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Left_Arm"]
transform = Transform( -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 ) transform = Transform( -0.986259, -0.122992, 0.110302, 3.72529e-09, 0.667656, 0.74447, -0.165208, 0.73424, -0.658481, 3.13461, -11.9576, -13.6748 )
[node name="IK_FABRIK_Right_Arm" type="Spatial" parent="Camera/Targets"] [node name="IK_FABRIK_Right_Arm" type="Spatial" parent="Camera/Targets"]
script = ExtResource( 8 ) script = ExtResource( 8 )
@ -102,35 +201,34 @@ __meta__ = {
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bones_in_chain = PoolStringArray( "Right_UpperArm", "Right_LowerArm", "Right_Hand" ) bones_in_chain = PoolStringArray( "Right_UpperArm", "Right_LowerArm", "Right_Hand" )
bones_in_chain_lengths = PoolRealArray( 1.97, 3, 1.2 ) bones_in_chain_lengths = PoolRealArray( 1.97, 3, 1.2 )
chain_iterations = 10
limit_chain_iterations = false limit_chain_iterations = false
use_middle_joint_target = true use_middle_joint_target = true
[node name="Target" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"] [node name="Target" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.229958, 0, 0.929313 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.902034, 0, -0.046618 )
[node name="IK_LookAt_RH" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm/Target"] [node name="IK_LookAt_RH" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm/Target"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0544824, -0.133381, 0.332403 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.251035, -0.133381, 0.332403 )
script = ExtResource( 6 ) script = ExtResource( 6 )
__meta__ = { __meta__ = {
"_editor_icon": ExtResource( 7 ) "_editor_icon": ExtResource( 7 )
} }
skeleton_path = NodePath("../../../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Right_Hand" bone_name = "Right_Hand"
additional_rotation = Vector3( 0, 0, 90 ) additional_rotation = Vector3( 0, 180, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="MiddleJoint" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"] [node name="MiddleJoint" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -6.34515, 0, -3.7843 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -6.34515, 0, -3.7843 )
[node name="Right_UpperArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"] [node name="Right_UpperArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"]
transform = Transform( -0.694982, -0.0753926, 0.715064, -7.45058e-09, 0.994488, 0.104854, -0.719028, 0.0728714, -0.691151, -1.53339, 0.300478, -3.63533 ) transform = Transform( -0.13677, -0.793967, 0.592377, 2.98023e-08, 0.597996, 0.801499, -0.990603, 0.109621, -0.0817881, -1.5334, 0.30189, -3.23425 )
[node name="Right_LowerArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"] [node name="Right_LowerArm" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"]
transform = Transform( -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 ) transform = Transform( -0.258068, 0.758367, -0.598565, 2.98023e-08, 0.619551, 0.784956, 0.966127, 0.202572, -0.159886, -2.70038, 0.463014, -1.6553 )
[node name="Right_Hand" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"] [node name="Right_Hand" type="Spatial" parent="Camera/Targets/IK_FABRIK_Right_Arm"]
transform = Transform( -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 ) transform = Transform( 0.933847, -0.293386, -0.204584, 0, 0.571985, -0.820264, 0.357673, 0.766001, 0.534147, -0.946222, 0.944532, 0.730302 )
[node name="1MeterCube" type="MeshInstance" parent="Camera/Targets"] [node name="1MeterCube" type="MeshInstance" parent="Camera/Targets"]
mesh = SubResource( 3 ) mesh = SubResource( 3 )

View File

@ -20,10 +20,13 @@ nodes/use_legacy_names=false
materials/location=0 materials/location=0
materials/storage=0 materials/storage=0
materials/keep_on_reimport=true materials/keep_on_reimport=true
meshes/octahedral_compression=true
meshes/compress=true meshes/compress=true
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/octahedral_compression=true
meshes/vertex_cache_optimization=true
meshes/storage=0 meshes/storage=0
meshes/light_baking=0
meshes/lightmap_texel_size=0.1
skins/use_named_skins=true skins/use_named_skins=true
external_files/store_in_subdir=false external_files/store_in_subdir=false
animation/import=false animation/import=false

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=9 format=2] [gd_scene load_steps=9 format=3]
[ext_resource path="res://addons/sade/editor_gizmo_texture.png" type="Texture" id=1] [ext_resource path="res://addons/sade/editor_gizmo_texture.png" type="Texture" id=1]
[ext_resource path="res://model/godot_battle_bot.gltf" type="PackedScene" id=2] [ext_resource path="res://model/godot_battle_bot.gltf" type="PackedScene" id=2]
@ -28,6 +28,109 @@ transform = Transform( 0.56827, 0.673454, -0.472789, 0, 0.574581, 0.818448, 0.82
[node name="GodotBattleBot" parent="." instance=ExtResource( 2 )] [node name="GodotBattleBot" parent="." instance=ExtResource( 2 )]
[node name="Skeleton" parent="GodotBattleBot/Z_UP/Armature" index="0"]
bones/0/position = Vector3( 0, 0.273024, 7.74588 )
bones/0/rotation = Quaternion( 0.759715, 7.75166e-08, 9.06254e-08, 0.650256 )
bones/1/position = Vector3( -0.858803, 0.0572646, 0.105923 )
bones/1/rotation = Quaternion( 0.662256, -0.013691, 0.740854, 0.111198 )
bones/1/scale = Vector3( 0.999998, 1, 0.999999 )
bones/2/position = Vector3( -2.98023e-08, 3.3419, -3.20375e-07 )
bones/2/rotation = Quaternion( 0.0400348, -0.0480878, -0.010588, 0.997984 )
bones/2/scale = Vector3( 1, 1, 1 )
bones/3/position = Vector3( -2.80359e-08, 3.53825, 1.61034e-08 )
bones/3/rotation = Quaternion( 0.513193, 0.52962, -0.484649, 0.470374 )
bones/3/scale = Vector3( 1, 1, 1 )
bones/4/position = Vector3( 0.863247, 0.0572646, 0.105923 )
bones/4/rotation = Quaternion( 0.671069, 0.109276, 0.732881, -0.0247196 )
bones/4/scale = Vector3( 0.999997, 1, 0.999998 )
bones/5/position = Vector3( -1.49012e-08, 3.3419, 1.99303e-07 )
bones/5/rotation = Quaternion( -0.0387784, -0.051742, -0.0145302, 0.997802 )
bones/6/position = Vector3( 4.21492e-09, 3.53825, -2.17745e-08 )
bones/6/rotation = Quaternion( 0.484649, 0.470374, -0.513194, 0.529619 )
bones/6/scale = Vector3( 1, 1, 1 )
bones/7/position = Vector3( -9.64506e-15, 1.7917, 5.65778e-08 )
bones/7/rotation = Quaternion( -0.15185, -3.93786e-11, -3.62496e-08, 0.988404 )
bones/7/scale = Vector3( 1, 1, 1 )
bones/8/position = Vector3( -1.5334, 2.29565, 0.106341 )
bones/8/rotation = Quaternion( 0.694368, -0.212646, 0.677236, 0.118263 )
bones/8/scale = Vector3( 0.999999, 1, 1 )
bones/9/position = Vector3( 9.31323e-09, 1.90503, 1.91387e-07 )
bones/9/rotation = Quaternion( 0.0430889, -0.00651108, 0.00492581, 0.999038 )
bones/9/scale = Vector3( 1, 1, 1 )
bones/10/position = Vector3( -1.54338e-08, 2.97659, 1.80687e-07 )
bones/10/rotation = Quaternion( 0.0254076, 0.0314977, -0.0425505, 0.998274 )
bones/10/scale = Vector3( 1, 1, 1 )
bones/11/position = Vector3( -0.251191, 0.961984, 0.0683811 )
bones/11/rotation = Quaternion( 0.0734265, -0.0198738, 0.116597, 0.990262 )
bones/11/scale = Vector3( 1, 1, 1 )
bones/12/position = Vector3( -4.47035e-08, 0.221738, 1.02445e-08 )
bones/12/rotation = Quaternion( 0.161002, 0.714417, 0.150246, 0.664163 )
bones/12/scale = Vector3( 1, 1, 1 )
bones/13/position = Vector3( -0.0779908, 1.04339, 0.000736893 )
bones/13/rotation = Quaternion( 0.122292, 0.00257627, 0.104377, 0.986987 )
bones/13/scale = Vector3( 1, 1, 1 )
bones/14/position = Vector3( -2.98023e-08, 0.267715, -8.27014e-07 )
bones/14/rotation = Quaternion( 0.147368, 0.694839, 0.0466993, 0.702353 )
bones/14/scale = Vector3( 1, 1, 1 )
bones/15/position = Vector3( 0.0960594, 1.04882, 0.0192584 )
bones/15/rotation = Quaternion( 0.0901164, 0.0392194, 0.00840297, 0.995123 )
bones/16/position = Vector3( 1.86265e-08, 0.277596, -4.6991e-07 )
bones/16/rotation = Quaternion( 0.115872, 0.681565, 0.114615, 0.713377 )
bones/16/scale = Vector3( 1, 1, 1 )
bones/17/position = Vector3( 0.26401, 0.982311, 0.0351903 )
bones/17/rotation = Quaternion( 0.0915952, 0.0987206, -0.130385, 0.982275 )
bones/17/scale = Vector3( 1, 1, 1 )
bones/18/position = Vector3( -2.23517e-07, 0.27682, 1.3411e-07 )
bones/18/rotation = Quaternion( 0.111001, 0.648784, 0.123964, 0.742557 )
bones/18/scale = Vector3( 1, 1, 1 )
bones/19/position = Vector3( 0.408326, 0.607306, 0.0419031 )
bones/19/rotation = Quaternion( 0.104368, 0.154824, -0.245653, 0.951205 )
bones/19/scale = Vector3( 1, 1, 1 )
bones/20/position = Vector3( -2.98023e-08, 0.301735, 4.47035e-08 )
bones/20/rotation = Quaternion( -0.0481356, 0.617453, 0.0348587, 0.784359 )
bones/20/scale = Vector3( 1, 1, 1 )
bones/21/position = Vector3( 1.53444, 2.29565, 0.106341 )
bones/21/rotation = Quaternion( 0.625464, 0.10264, 0.741343, -0.220612 )
bones/21/scale = Vector3( 1, 1, 1 )
bones/22/position = Vector3( 2.98023e-08, 1.90503, 1.08033e-07 )
bones/22/rotation = Quaternion( -0.0433319, -0.0654617, 0.00180953, 0.996912 )
bones/22/scale = Vector3( 1, 1, 1 )
bones/23/position = Vector3( 1.22048e-08, 2.97659, -6.07568e-07 )
bones/23/rotation = Quaternion( -0.0240965, -0.00100487, -0.0433063, 0.998771 )
bones/24/position = Vector3( -0.246549, 0.961984, -0.083585 )
bones/24/rotation = Quaternion( -0.0826772, 0.0401178, 0.11023, 0.989649 )
bones/24/scale = Vector3( 1, 1, 1 )
bones/25/position = Vector3( -1.49012e-07, 0.221738, -1.13621e-07 )
bones/25/rotation = Quaternion( -0.119531, 0.715918, -0.184954, 0.662544 )
bones/25/scale = Vector3( 1, 1, 1 )
bones/26/position = Vector3( -0.0778003, 1.04339, -0.00549548 )
bones/26/rotation = Quaternion( -0.132841, 0.0438432, 0.0905715, 0.986016 )
bones/26/scale = Vector3( 1, 1, 1 )
bones/27/position = Vector3( 1.04308e-07, 0.267716, -1.37836e-07 )
bones/27/rotation = Quaternion( -0.0236808, 0.700911, -0.152766, 0.696294 )
bones/27/scale = Vector3( 1, 1, 1 )
bones/28/position = Vector3( 0.0970556, 1.04882, -0.01336 )
bones/28/rotation = Quaternion( -0.0904035, 0.0402447, -0.00433424, 0.995082 )
bones/28/scale = Vector3( 1, 1, 1 )
bones/29/position = Vector3( 7.68341e-09, 0.277596, -5.1083e-07 )
bones/29/rotation = Quaternion( -0.0926483, 0.681722, -0.134087, 0.713227 )
bones/29/scale = Vector3( 1, 1, 1 )
bones/30/position = Vector3( 0.265665, 0.982311, -0.019011 )
bones/30/rotation = Quaternion( -0.0656662, 0.0260568, -0.145182, 0.98688 )
bones/30/scale = Vector3( 1, 1, 1 )
bones/31/position = Vector3( 3.12924e-07, 0.276819, -7.82311e-08 )
bones/31/rotation = Quaternion( -0.102156, 0.648696, -0.131348, 0.742634 )
bones/31/scale = Vector3( 1, 1, 1 )
bones/32/position = Vector3( 0.410121, 0.607306, -0.0169033 )
bones/32/rotation = Quaternion( -0.0424852, 0.0187641, -0.263502, 0.96354 )
bones/32/scale = Vector3( 1, 1, 1 )
bones/33/position = Vector3( 1.19209e-07, 0.301735, 1.56462e-07 )
bones/33/rotation = Quaternion( -0.0440545, 0.63492, 0.039892, 0.770289 )
bones/33/scale = Vector3( 1, 1, 1 )
bones/34/position = Vector3( 1.17961e-15, 2.97461, 2.98023e-08 )
bones/34/rotation = Quaternion( -1.13845e-08, 0.997388, 0.0722371, 7.53007e-08 )
bones/34/scale = Vector3( 1, 1, 1 )
[node name="Camera" type="Camera" parent="."] [node name="Camera" type="Camera" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.501, 11 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 11.501, 11 )
fov = 74.0 fov = 74.0
@ -44,7 +147,6 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Head" bone_name = "Head"
additional_rotation = Vector3( 90, 0, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="IK_LookAt_LeftArm" type="Spatial" parent="Camera/Targets"] [node name="IK_LookAt_LeftArm" type="Spatial" parent="Camera/Targets"]
@ -54,6 +156,8 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Left_UpperArm" bone_name = "Left_UpperArm"
look_at_axis = 0
additional_rotation = Vector3( -90, 0, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="IK_LookAt_RightArm" type="Spatial" parent="Camera/Targets"] [node name="IK_LookAt_RightArm" type="Spatial" parent="Camera/Targets"]
@ -63,7 +167,8 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Right_UpperArm" bone_name = "Right_UpperArm"
additional_rotation = Vector3( 0, 0, 180 ) look_at_axis = 0
additional_rotation = Vector3( -90, 0, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="Control" type="Control" parent="."] [node name="Control" type="Control" parent="."]

View File

@ -18,12 +18,15 @@ nodes/custom_script=""
nodes/storage=0 nodes/storage=0
nodes/use_legacy_names=false nodes/use_legacy_names=false
materials/location=0 materials/location=0
materials/storage=0 materials/storage=1
materials/keep_on_reimport=true materials/keep_on_reimport=true
meshes/octahedral_compression=true
meshes/compress=true meshes/compress=true
meshes/ensure_tangents=true meshes/ensure_tangents=true
meshes/storage=0 meshes/octahedral_compression=true
meshes/vertex_cache_optimization=true
meshes/storage=1
meshes/light_baking=0
meshes/lightmap_texel_size=0.1
skins/use_named_skins=true skins/use_named_skins=true
external_files/store_in_subdir=false external_files/store_in_subdir=false
animation/import=true animation/import=true

Binary file not shown.

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=12 format=2] [gd_scene load_steps=12 format=3]
[ext_resource path="res://skeleton_ik_runner.gd" type="Script" id=1] [ext_resource path="res://skeleton_ik_runner.gd" type="Script" id=1]
[ext_resource path="res://addons/sade/ik_look_at.png" type="Texture" id=2] [ext_resource path="res://addons/sade/ik_look_at.png" type="Texture" id=2]
@ -69,7 +69,6 @@ __meta__ = {
} }
skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton") skeleton_path = NodePath("../../../GodotBattleBot/Z_UP/Armature/Skeleton")
bone_name = "Head" bone_name = "Head"
additional_rotation = Vector3( 90, 0, 0 )
additional_bone_length = 1 additional_bone_length = 1
[node name="1MeterCube" type="MeshInstance" parent="Camera/Targets"] [node name="1MeterCube" type="MeshInstance" parent="Camera/Targets"]
@ -84,6 +83,109 @@ transform = Transform( -0.0217688, 0.998559, -0.0490576, 0.992503, 0.0274873, 0.
[node name="GodotBattleBot" parent="." instance=ExtResource( 4 )] [node name="GodotBattleBot" parent="." instance=ExtResource( 4 )]
[node name="Skeleton" parent="GodotBattleBot/Z_UP/Armature" index="0"]
bones/0/position = Vector3( 0, 0.273024, 7.74588 )
bones/0/rotation = Quaternion( 0.759715, 7.75166e-08, 9.06254e-08, 0.650256 )
bones/1/position = Vector3( -0.858803, 0.0572646, 0.105923 )
bones/1/rotation = Quaternion( 0.662256, -0.013691, 0.740854, 0.111198 )
bones/1/scale = Vector3( 0.999998, 1, 0.999999 )
bones/2/position = Vector3( -2.98023e-08, 3.3419, -3.20375e-07 )
bones/2/rotation = Quaternion( 0.0400348, -0.0480878, -0.010588, 0.997984 )
bones/2/scale = Vector3( 1, 1, 1 )
bones/3/position = Vector3( -2.80359e-08, 3.53825, 1.61034e-08 )
bones/3/rotation = Quaternion( 0.513193, 0.52962, -0.484649, 0.470374 )
bones/3/scale = Vector3( 1, 1, 1 )
bones/4/position = Vector3( 0.863247, 0.0572646, 0.105923 )
bones/4/rotation = Quaternion( 0.671069, 0.109276, 0.732881, -0.0247196 )
bones/4/scale = Vector3( 0.999997, 1, 0.999998 )
bones/5/position = Vector3( -1.49012e-08, 3.3419, 1.99303e-07 )
bones/5/rotation = Quaternion( -0.0387784, -0.051742, -0.0145302, 0.997802 )
bones/6/position = Vector3( 4.21492e-09, 3.53825, -2.17745e-08 )
bones/6/rotation = Quaternion( 0.484649, 0.470374, -0.513194, 0.529619 )
bones/6/scale = Vector3( 1, 1, 1 )
bones/7/position = Vector3( -9.64506e-15, 1.7917, 5.65778e-08 )
bones/7/rotation = Quaternion( -0.15185, -3.93786e-11, -3.62496e-08, 0.988404 )
bones/7/scale = Vector3( 1, 1, 1 )
bones/8/position = Vector3( -1.5334, 2.29565, 0.106341 )
bones/8/rotation = Quaternion( 0.694368, -0.212646, 0.677236, 0.118263 )
bones/8/scale = Vector3( 0.999999, 1, 1 )
bones/9/position = Vector3( 9.31323e-09, 1.90503, 1.91387e-07 )
bones/9/rotation = Quaternion( 0.0430889, -0.00651108, 0.00492581, 0.999038 )
bones/9/scale = Vector3( 1, 1, 1 )
bones/10/position = Vector3( -1.54338e-08, 2.97659, 1.80687e-07 )
bones/10/rotation = Quaternion( 0.0254076, 0.0314977, -0.0425505, 0.998274 )
bones/10/scale = Vector3( 1, 1, 1 )
bones/11/position = Vector3( -0.251191, 0.961984, 0.0683811 )
bones/11/rotation = Quaternion( 0.0734265, -0.0198738, 0.116597, 0.990262 )
bones/11/scale = Vector3( 1, 1, 1 )
bones/12/position = Vector3( -4.47035e-08, 0.221738, 1.02445e-08 )
bones/12/rotation = Quaternion( 0.161002, 0.714417, 0.150246, 0.664163 )
bones/12/scale = Vector3( 1, 1, 1 )
bones/13/position = Vector3( -0.0779908, 1.04339, 0.000736893 )
bones/13/rotation = Quaternion( 0.122292, 0.00257627, 0.104377, 0.986987 )
bones/13/scale = Vector3( 1, 1, 1 )
bones/14/position = Vector3( -2.98023e-08, 0.267715, -8.27014e-07 )
bones/14/rotation = Quaternion( 0.147368, 0.694839, 0.0466993, 0.702353 )
bones/14/scale = Vector3( 1, 1, 1 )
bones/15/position = Vector3( 0.0960594, 1.04882, 0.0192584 )
bones/15/rotation = Quaternion( 0.0901164, 0.0392194, 0.00840297, 0.995123 )
bones/16/position = Vector3( 1.86265e-08, 0.277596, -4.6991e-07 )
bones/16/rotation = Quaternion( 0.115872, 0.681565, 0.114615, 0.713377 )
bones/16/scale = Vector3( 1, 1, 1 )
bones/17/position = Vector3( 0.26401, 0.982311, 0.0351903 )
bones/17/rotation = Quaternion( 0.0915952, 0.0987206, -0.130385, 0.982275 )
bones/17/scale = Vector3( 1, 1, 1 )
bones/18/position = Vector3( -2.23517e-07, 0.27682, 1.3411e-07 )
bones/18/rotation = Quaternion( 0.111001, 0.648784, 0.123964, 0.742557 )
bones/18/scale = Vector3( 1, 1, 1 )
bones/19/position = Vector3( 0.408326, 0.607306, 0.0419031 )
bones/19/rotation = Quaternion( 0.104368, 0.154824, -0.245653, 0.951205 )
bones/19/scale = Vector3( 1, 1, 1 )
bones/20/position = Vector3( -2.98023e-08, 0.301735, 4.47035e-08 )
bones/20/rotation = Quaternion( -0.0481356, 0.617453, 0.0348587, 0.784359 )
bones/20/scale = Vector3( 1, 1, 1 )
bones/21/position = Vector3( 1.53444, 2.29565, 0.106341 )
bones/21/rotation = Quaternion( 0.625464, 0.10264, 0.741343, -0.220612 )
bones/21/scale = Vector3( 1, 1, 1 )
bones/22/position = Vector3( 2.98023e-08, 1.90503, 1.08033e-07 )
bones/22/rotation = Quaternion( -0.0433319, -0.0654617, 0.00180953, 0.996912 )
bones/22/scale = Vector3( 1, 1, 1 )
bones/23/position = Vector3( 1.22048e-08, 2.97659, -6.07568e-07 )
bones/23/rotation = Quaternion( -0.0240965, -0.00100487, -0.0433063, 0.998771 )
bones/24/position = Vector3( -0.246549, 0.961984, -0.083585 )
bones/24/rotation = Quaternion( -0.0826772, 0.0401178, 0.11023, 0.989649 )
bones/24/scale = Vector3( 1, 1, 1 )
bones/25/position = Vector3( -1.49012e-07, 0.221738, -1.13621e-07 )
bones/25/rotation = Quaternion( -0.119531, 0.715918, -0.184954, 0.662544 )
bones/25/scale = Vector3( 1, 1, 1 )
bones/26/position = Vector3( -0.0778003, 1.04339, -0.00549548 )
bones/26/rotation = Quaternion( -0.132841, 0.0438432, 0.0905715, 0.986016 )
bones/26/scale = Vector3( 1, 1, 1 )
bones/27/position = Vector3( 1.04308e-07, 0.267716, -1.37836e-07 )
bones/27/rotation = Quaternion( -0.0236808, 0.700911, -0.152766, 0.696294 )
bones/27/scale = Vector3( 1, 1, 1 )
bones/28/position = Vector3( 0.0970556, 1.04882, -0.01336 )
bones/28/rotation = Quaternion( -0.0904035, 0.0402447, -0.00433424, 0.995082 )
bones/28/scale = Vector3( 1, 1, 1 )
bones/29/position = Vector3( 7.68341e-09, 0.277596, -5.1083e-07 )
bones/29/rotation = Quaternion( -0.0926483, 0.681722, -0.134087, 0.713227 )
bones/29/scale = Vector3( 1, 1, 1 )
bones/30/position = Vector3( 0.265665, 0.982311, -0.019011 )
bones/30/rotation = Quaternion( -0.0656662, 0.0260568, -0.145182, 0.98688 )
bones/30/scale = Vector3( 1, 1, 1 )
bones/31/position = Vector3( 3.12924e-07, 0.276819, -7.82311e-08 )
bones/31/rotation = Quaternion( -0.102156, 0.648696, -0.131348, 0.742634 )
bones/31/scale = Vector3( 1, 1, 1 )
bones/32/position = Vector3( 0.410121, 0.607306, -0.0169033 )
bones/32/rotation = Quaternion( -0.0424852, 0.0187641, -0.263502, 0.96354 )
bones/32/scale = Vector3( 1, 1, 1 )
bones/33/position = Vector3( 1.19209e-07, 0.301735, 1.56462e-07 )
bones/33/rotation = Quaternion( -0.0440545, 0.63492, 0.039892, 0.770289 )
bones/33/scale = Vector3( 1, 1, 1 )
bones/34/position = Vector3( 1.17961e-15, 2.97461, 2.98023e-08 )
bones/34/rotation = Quaternion( -1.13845e-08, 0.997388, 0.0722371, 7.53007e-08 )
bones/34/scale = Vector3( 1, 1, 1 )
[node name="Control" type="Control" parent="."] [node name="Control" type="Control" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0