Update LookingAt to be a more descriptive name.

This commit is contained in:
Jake Young
2026-05-08 12:22:45 -04:00
parent 9957166723
commit 64708a14d9
2 changed files with 28 additions and 1 deletions
+10
View File
@@ -1725,6 +1725,11 @@ void Actor::LookAt(const Vector3& worldPos, const Vector3& worldUp)
} }
Quaternion Actor::LookingAt(const Vector3& worldPos) const Quaternion Actor::LookingAt(const Vector3& worldPos) const
{
return GetLookAtDirection(worldPos);
}
Quaternion Actor::GetLookAtDirection(const Vector3& worldPos) const
{ {
const Vector3 direction = worldPos - _transform.Translation; const Vector3 direction = worldPos - _transform.Translation;
if (direction.LengthSquared() < ZeroTolerance) if (direction.LengthSquared() < ZeroTolerance)
@@ -1752,6 +1757,11 @@ Quaternion Actor::LookingAt(const Vector3& worldPos) const
} }
Quaternion Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp) const Quaternion Actor::LookingAt(const Vector3& worldPos, const Vector3& worldUp) const
{
return GetLookAtDirection(worldPos, worldUp);
}
Quaternion Actor::GetLookAtDirection(const Vector3& worldPos, const Vector3& worldUp) const
{ {
const Vector3 direction = worldPos - _transform.Translation; const Vector3 direction = worldPos - _transform.Translation;
if (direction.LengthSquared() < ZeroTolerance) if (direction.LengthSquared() < ZeroTolerance)
+18 -1
View File
@@ -897,16 +897,33 @@ public:
/// <summary> /// <summary>
/// Gets rotation of the actor oriented towards the specified world position. /// Gets rotation of the actor oriented towards the specified world position.
/// [Deprecated in v1.13]
/// </summary> /// </summary>
/// <param name="worldPos">The world position to orient towards.</param> /// <param name="worldPos">The world position to orient towards.</param>
DEPRECATED("Use GetLookAtDirection instead.")
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos) const; API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos) const;
/// <summary>
/// Gets rotation of the actor oriented towards the specified world position.
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
API_FUNCTION() Quaternion GetLookAtDirection(const Vector3& worldPos) const;
/// <summary>
/// Gets rotation of the actor oriented towards the specified world position with upwards direction.
/// [Deprecated in v1.13]
/// </summary>
/// <param name="worldPos">The world position to orient towards.</param>
/// <param name="worldUp">The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
DEPRECATED("Use GetLookAtDirection instead.")
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const;
/// <summary> /// <summary>
/// Gets rotation of the actor oriented towards the specified world position with upwards direction. /// Gets rotation of the actor oriented towards the specified world position with upwards direction.
/// </summary> /// </summary>
/// <param name="worldPos">The world position to orient towards.</param> /// <param name="worldPos">The world position to orient towards.</param>
/// <param name="worldUp">The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param> /// <param name="worldUp">The up direction that constrains up axis orientation to a plane this vector lies on. This rule might be broken if forward and up direction are nearly parallel.</param>
API_FUNCTION() Quaternion LookingAt(const Vector3& worldPos, const Vector3& worldUp) const; API_FUNCTION() Quaternion GetLookAtDirection(const Vector3& worldPos, const Vector3& worldUp) const;
public: public:
/// <summary> /// <summary>