Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Vector3.UP as a default value for look_at's up vector #45575

Merged
merged 1 commit into from
Feb 17, 2021

Conversation

aaronfranke
Copy link
Member

Vector3.UP is the most common argument to use for look_at, so it would be a nice idea to have it as the default argument.

Some statistics from the Godot demo projects, 10 out of 13 use Vector3.UP, or 4 out of 5 if we exclude the IK demo:

$ grep -RIni "look_at("
3d/ik/addons/sade/ik_fabrik.gd:154:                             bone_nodes[i].look_at(get_bone_transform(i+1).origin + skeleton.global_transform.origin, Vector3.UP)
3d/navmesh/navmesh.gd:55:                       robot.look_at(look_at_point, Vector3.UP)
viewport/gui_in_3d/gui_3d.gd:167:               node_area.look_at(look, Vector3.UP)

$ grep -RIni "looking_at("
3d/platformer/enemy/enemy.gd:64:                get_node("Armature").set_transform(Transform().looking_at(-dir, up))
3d/ik/addons/sade/ik_fabrik.gd:286:                             bone_trans = bone_trans.looking_at(b_target.origin + dir, Vector3.UP)
3d/ik/addons/sade/ik_fabrik.gd:296:                             bone_trans = bone_trans.looking_at(b_target.origin, Vector3.UP)
3d/ik/addons/sade/ik_fabrik.gd:322:                     bone_trans = bone_trans.looking_at(b_target.origin + dir, Vector3.UP)
3d/ik/addons/sade/ik_look_at.gd:87:             rest = rest.looking_at(target_pos, Vector3.RIGHT)
3d/ik/addons/sade/ik_look_at.gd:89:             rest = rest.looking_at(target_pos, Vector3.UP)
3d/ik/addons/sade/ik_look_at.gd:91:             rest = rest.looking_at(target_pos, Vector3.FORWARD)
3d/ik/addons/sade/ik_look_at.gd:93:             rest = rest.looking_at(target_pos, Vector3.UP)
3d/waypoints/waypoint.gd:70:            var look = camera_transform.looking_at(parent_translation, Vector3.UP)
misc/matrix_transform/marker/AxisMarker3D.gd:15:        holder.transform = holder.transform.looking_at(translation, Vector3.UP)

@akien-mga akien-mga merged commit 1d14c22 into godotengine:master Feb 17, 2021
@akien-mga
Copy link
Member

Thanks!

@akien-mga akien-mga added this to the 4.0 milestone Feb 17, 2021
@aaronfranke aaronfranke deleted the look-up branch February 17, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants