mirror of
https://github.com/Relintai/pandemonium_demo_projects.git
synced 2024-12-21 13:56:50 +01:00
Fix ik_look_at.gd.
This commit is contained in:
parent
dfd8abe5fe
commit
f5d91b4e6e
@ -1,4 +1,3 @@
|
||||
tool
|
||||
extends Spatial
|
||||
|
||||
export(NodePath) var skeleton_path setget _set_skeleton_path
|
||||
@ -78,20 +77,19 @@ func update_skeleton():
|
||||
return
|
||||
|
||||
# get the bone's global transform pose.
|
||||
var rest = skeleton_to_use.get_bone_global_pose(bone)
|
||||
|
||||
var rest : Transform = skeleton_to_use.get_bone_global_pose_no_override(bone)
|
||||
# Convert our position relative to the skeleton's transform.
|
||||
var target_pos = skeleton_to_use.global_transform.xform_inv(global_transform.origin)
|
||||
var target_pos : Vector3 = skeleton_to_use.global_transform.xform_inv(global_transform.origin)
|
||||
|
||||
# Call helper's look_at function with the chosen up axis.
|
||||
if look_at_axis == 0:
|
||||
rest = rest.looking_at(target_pos, Vector3.RIGHT)
|
||||
rest = rest.looking_at(target_pos, skeleton_to_use.global_transform.xform_inv(Vector3.RIGHT))
|
||||
elif look_at_axis == 1:
|
||||
rest = rest.looking_at(target_pos, Vector3.UP)
|
||||
rest = rest.looking_at(target_pos, skeleton_to_use.global_transform.xform_inv(Vector3.UP))
|
||||
elif look_at_axis == 2:
|
||||
rest = rest.looking_at(target_pos, Vector3.FORWARD)
|
||||
rest = rest.looking_at(target_pos, skeleton_to_use.global_transform.xform_inv(Vector3.FORWARD))
|
||||
else:
|
||||
rest = rest.looking_at(target_pos, Vector3.UP)
|
||||
rest = rest.looking_at(target_pos, skeleton_to_use.global_transform.xform_inv(Vector3.UP))
|
||||
if debug_messages:
|
||||
print(name, " - IK_LookAt: Unknown look_at_axis value!")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user