mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
checking edge case of if input vectors are zero
This commit is contained in:
parent
87d26a9d86
commit
ed7f008517
1 changed files with 8 additions and 6 deletions
|
@ -41,12 +41,14 @@ bool Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offse
|
|||
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
||||
// use the referencial from the avatar, y isn't always up
|
||||
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getWorldOrientation()*Vectors::UP;
|
||||
|
||||
glm::quat rotation(conjugate(toQuat(glm::lookAt(cameraPos, billboardPos, avatarUP))));
|
||||
|
||||
transform.setRotation(rotation);
|
||||
transform.postRotate(offsetRotation);
|
||||
return true;
|
||||
glm::vec3 zeroPos{ 0.0f, 0.0f, 0.0f };
|
||||
if (!(glm::all(glm::equal(cameraPos, zeroPos)) || glm::all(glm::equal(billboardPos, zeroPos)) ||
|
||||
glm::all(glm::equal(avatarUP, zeroPos)))) {
|
||||
glm::quat rotation(conjugate(toQuat(glm::lookAt(cameraPos, billboardPos, avatarUP))));
|
||||
transform.setRotation(rotation);
|
||||
transform.postRotate(offsetRotation);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue