mirror of
https://github.com/overte-org/overte.git
synced 2025-08-13 06:18:39 +02:00
add max distance at which you will auto-magically look at someone else
This commit is contained in:
parent
cd2a6f0f9c
commit
d8a74a4db4
3 changed files with 5 additions and 6 deletions
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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() {
|
||||
|
|
Loading…
Reference in a new issue