mirror of
https://github.com/orange-cpp/omath.git
synced 2026-02-13 07:03:25 +00:00
unreal engine fix
This commit is contained in:
@@ -62,17 +62,16 @@ namespace omath::unreal_engine
|
|||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static float calc_direct_pitch_angle(const Vector3<float>& origin, const Vector3<float>& view_to) noexcept
|
static float calc_direct_pitch_angle(const Vector3<float>& origin, const Vector3<float>& view_to) noexcept
|
||||||
{
|
{
|
||||||
const auto distance = origin.distance_to(view_to);
|
const auto direction = (view_to - origin).normalized();
|
||||||
const auto delta = view_to - origin;
|
|
||||||
|
|
||||||
return angles::radians_to_degrees(std::asin(delta.z / distance));
|
return angles::radians_to_degrees(std::asin(direction.z));
|
||||||
}
|
}
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
static float calc_direct_yaw_angle(const Vector3<float>& origin, const Vector3<float>& view_to) noexcept
|
static float calc_direct_yaw_angle(const Vector3<float>& origin, const Vector3<float>& view_to) noexcept
|
||||||
{
|
{
|
||||||
const auto delta = view_to - origin;
|
const auto direction = (view_to - origin).normalized();
|
||||||
|
|
||||||
return angles::radians_to_degrees(std::atan2(delta.y, delta.x));
|
return angles::radians_to_degrees(std::atan2(direction.y, direction.x));
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
} // namespace omath::unreal_engine
|
} // namespace omath::unreal_engine
|
||||||
|
|||||||
Reference in New Issue
Block a user