Re-add isFacingAvatar to true and delete rotation of the grabbermoveup tool.

This commit is contained in:
Daniela 2017-10-23 19:11:32 +01:00
parent 32b5776743
commit f15038c54f
2 changed files with 10 additions and 15 deletions

View file

@ -13,6 +13,7 @@
#include <Application.h>
#include <Transform.h>
#include "avatar/AvatarManager.h"
void Billboardable::setProperties(const QVariantMap& properties) {
auto isFacingAvatar = properties["isFacingAvatar"];
@ -32,10 +33,11 @@ bool Billboardable::pointTransformAtCamera(Transform& transform, glm::quat offse
if (isFacingAvatar()) {
glm::vec3 billboardPos = transform.getTranslation();
glm::vec3 cameraPos = qApp->getCamera().getPosition();
glm::vec3 look = cameraPos - billboardPos;
float elevation = -asinf(look.y / glm::length(look));
float azimuth = atan2f(look.x, look.z);
glm::quat rotation(glm::vec3(elevation, azimuth, 0));
glm::vec3 avatarUP = DependencyManager::get<AvatarManager>()->getMyAvatar()->getOrientation()*Vectors::UP;
glm::quat rotation(conjugate(toQuat(glm::lookAt(billboardPos, cameraPos, avatarUP))));
transform.setRotation(rotation);
transform.postRotate(offsetRotation);
return true;

View file

@ -203,14 +203,7 @@ SelectionManager = (function() {
print("ERROR: entitySelectionTool.update got exception: " + JSON.stringify(e));
}
}
//update overlay to face Avatar
if ((!activeTool) || isActiveTool(grabberMoveUp)) {
Overlays.editOverlay(grabberMoveUp, {
rotation: Quat.lookAt(grabberMoveUpPosition, Camera.position, Quat.getUp(MyAvatar.orientation))
});
}
};
return that;
@ -467,6 +460,7 @@ SelectionDisplay = (function() {
visible: false,
size: 0.1,
scale: 0.1,
isFacingAvatar: true,
drawInFront: true
});
@ -2113,8 +2107,7 @@ SelectionDisplay = (function() {
z: position.z + (grabberMoveUpOffset + worldTop) * upVec.z
};
Overlays.editOverlay(grabberMoveUp, {
visible: (!activeTool) || isActiveTool(grabberMoveUp),
rotation: Quat.lookAt(grabberMoveUpPosition, Camera.position, upVec)
visible: (!activeTool) || isActiveTool(grabberMoveUp)
});
Overlays.editOverlay(baseOfEntityProjectionOverlay, {
@ -2463,7 +2456,7 @@ SelectionDisplay = (function() {
var vector = Vec3.subtract(newIntersection, lastXYPick);
// project vector onto avatar up vector
// we want the avatar referential not the camera.
// we want the avatar referential not the camera.
var avatarUpVector = Quat.getUp(MyAvatar.orientation);
var dotVectorUp = Vec3.dot(vector, avatarUpVector);
vector = Vec3.multiply(dotVectorUp, avatarUpVector);