mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-19 00:43:27 +00:00
added ability to get view angles from view matrix
This commit is contained in:
@@ -83,6 +83,12 @@ namespace omath::projection
|
||||
{
|
||||
}
|
||||
|
||||
[[nodiscard]]
|
||||
static ViewAnglesType calc_view_angles_from_view_matrix(const Mat4X4Type& view_matrix) noexcept
|
||||
{
|
||||
const Vector3<float> forward_vector = {view_matrix[2, 0], view_matrix[2, 1], view_matrix[2, 2]};
|
||||
return TraitClass::calc_look_at_angle({}, forward_vector);
|
||||
}
|
||||
void look_at(const Vector3<float>& target)
|
||||
{
|
||||
m_view_angles = TraitClass::calc_look_at_angle(m_origin, target);
|
||||
|
||||
Reference in New Issue
Block a user