mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-15 16:45:12 +02:00
Fix call to atan2 when params are 0
This commit is contained in:
parent
abe8cfe90f
commit
760a5bfa37
1 changed files with 2 additions and 1 deletions
|
@ -709,7 +709,8 @@ Transform Avatar::calculateDisplayNameTransform(const ViewFrustum& frustum, floa
|
|||
|
||||
// Compute orientation
|
||||
glm::vec3 dPosition = frustum.getPosition() - getPosition();
|
||||
float yawRotation = glm::atan(dPosition.x, dPosition.z);
|
||||
// If x and z are 0, atan(x, z) is undefined, so default to 0 degrees
|
||||
float yawRotation = dPosition.x == 0.0f && dPosition.z == 0.0f ? 0.0f : glm::atan(dPosition.x, dPosition.z);
|
||||
glm::quat orientation = glm::quat(glm::vec3(0.0f, yawRotation, 0.0f));
|
||||
|
||||
// Set transform (The order IS important)
|
||||
|
|
Loading…
Reference in a new issue