mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-08 04:27:37 +02:00
billboard is now using a general formula to calculate the rotation, where we don't assume y is up. Added dependency on the avatar.
This commit is contained in:
parent
30a5b00b6e
commit
059c5c1806
1 changed files with 2 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
||||||
// interface/src/ui/overlays
|
// interface/src/ui/overlays
|
||||||
//
|
//
|
||||||
// Created by Zander Otavka on 8/7/15.
|
// Created by Zander Otavka on 8/7/15.
|
||||||
|
// Modified by Daniela Fontes on 24/10/17.
|
||||||
// Copyright 2014 High Fidelity, Inc.
|
// Copyright 2014 High Fidelity, Inc.
|
||||||
//
|
//
|
||||||
// Distributed under the Apache License, Version 2.0.
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
@ -33,7 +34,7 @@ bool Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offse
|
||||||
if (isFacingAvatar()) {
|
if (isFacingAvatar()) {
|
||||||
glm::vec3 billboardPos = transform.getTranslation();
|
glm::vec3 billboardPos = transform.getTranslation();
|
||||||
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
glm::vec3 cameraPos = qApp->getCamera().getPosition();
|
||||||
|
// use the referencial from the avatar, y isn't always up
|
||||||
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation()*Vectors::UP;
|
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation()*Vectors::UP;
|
||||||
|
|
||||||
glm::quat rotation(conjugate(toQuat(glm::lookAt(billboardPos, cameraPos, avatarUP))));
|
glm::quat rotation(conjugate(toQuat(glm::lookAt(billboardPos, cameraPos, avatarUP))));
|
||||||
|
|
Loading…
Reference in a new issue