add max distance at which you will auto-magically look at someone else

This commit is contained in:
Philip Rosedale 2014-11-20 18:34:06 -06:00
parent cd2a6f0f9c
commit d8a74a4db4
3 changed files with 5 additions and 6 deletions

View file

@ -107,7 +107,6 @@ function addButterfly() {
animationIsPlaying: true,
modelURL: "https://s3-us-west-1.amazonaws.com/highfidelity-public/models/content/butterfly/butterfly.fbx"
};
//properties.position.z = properties.position.z + 1;
butterflies.push(new defineButterfly(Entities.addEntity(properties), properties.position));
}

View file

@ -932,13 +932,15 @@ void MyAvatar::updateLookAtTargetAvatar() {
float smallestAngleTo = glm::radians(Application::getInstance()->getCamera()->getFieldOfView()) / 2.0f;
const float KEEP_LOOKING_AT_CURRENT_ANGLE_FACTOR = 1.3f;
const float GREATEST_LOOKING_AT_DISTANCE = 10.0f;
int howManyLookingAtMe = 0;
foreach (const AvatarSharedPointer& avatarPointer, Application::getInstance()->getAvatarManager().getAvatarHash()) {
Avatar* avatar = static_cast<Avatar*>(avatarPointer.data());
bool isCurrentTarget = avatar->getIsLookAtTarget();
float distanceTo = glm::length(avatar->getHead()->getEyePosition() - cameraPosition);
avatar->setIsLookAtTarget(false);
if (!avatar->isMyAvatar() && avatar->isInitialized()) {
if (!avatar->isMyAvatar() && avatar->isInitialized() && (distanceTo < GREATEST_LOOKING_AT_DISTANCE * getScale())) {
float angleTo = glm::angle(lookForward, glm::normalize(avatar->getHead()->getEyePosition() - cameraPosition));
if (angleTo < (smallestAngleTo * (isCurrentTarget ? KEEP_LOOKING_AT_CURRENT_ANGLE_FACTOR : 1.0f))) {
_lookAtTargetAvatar = avatarPointer;

View file

@ -109,10 +109,8 @@ void Faceshift::update() {
_longTermAverageEyePitch = glm::mix(eulers.x, _longTermAverageEyePitch, LONG_TERM_AVERAGE_SMOOTHING);
_longTermAverageEyeYaw = glm::mix(eulers.y, _longTermAverageEyeYaw, LONG_TERM_AVERAGE_SMOOTHING);
}
//_estimatedEyePitch = eulers.x - _longTermAverageEyePitch;
//_estimatedEyeYaw = eulers.y - _longTermAverageEyeYaw;
_estimatedEyePitch = 0.0; // eulers.x;
_estimatedEyeYaw = 0.0; // eulers.y;
_estimatedEyePitch = eulers.x - _longTermAverageEyePitch;
_estimatedEyeYaw = eulers.y - _longTermAverageEyeYaw;
}
void Faceshift::reset() {