MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / GetRotationFromNormal

Method GetRotationFromNormal

Source/Engine/Core/Math/Quaternion.cpp:566–573  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

564}
565
566Quaternion Quaternion::GetRotationFromNormal(const Vector3& normal, const Transform& reference)
567{
568 Float3 up = reference.GetUp();
569 const Real dot = Vector3::Dot(normal, up);
570 if (Math::NearEqual(Math::Abs(dot), 1))
571 up = reference.GetRight();
572 return Quaternion::LookRotation(normal, up);
573}

Callers 1

Calls 6

DotFunction · 0.85
LookRotationFunction · 0.85
GetUpMethod · 0.80
GetRightMethod · 0.80
NearEqualFunction · 0.70
AbsFunction · 0.70

Tested by

no test coverage detected