Merge pull request #16255 from luiscuenca/lookAtFixes

BUGZ-1599: Free camera fixes
This commit is contained in:
Shannon Romano 2019-09-27 09:16:30 -07:00 committed by GitHub
commit 7e74753a71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View file

@ -198,7 +198,7 @@
"to": "Actions.DeltaPitch",
"filters":
[
{ "type": "scale", "scale": 0.3 }
{ "type": "scale", "scale": 0.2 }
]
},
@ -207,7 +207,7 @@
"to": "Actions.DeltaPitch",
"filters":
[
{ "type": "scale", "scale": 0.3 }
{ "type": "scale", "scale": 0.2 }
]
},

View file

@ -2709,7 +2709,11 @@ void MyAvatar::updateMotors() {
if (_motionBehaviors & AVATAR_MOTION_ACTION_MOTOR_ENABLED) {
if (_characterController.getState() == CharacterController::State::Hover ||
_characterController.computeCollisionMask() == BULLET_COLLISION_MASK_COLLISIONLESS) {
if (qApp->getCamera().getMode() == CAMERA_MODE_LOOK_AT || qApp->getCamera().getMode() == CAMERA_MODE_SELFIE) {
motorRotation = getLookAtRotation();
} else {
motorRotation = getMyHead()->getHeadOrientation();
}
} else {
// non-hovering = walking: follow camera twist about vertical but not lift
// we decompose camera's rotation and store the twist part in motorRotation
@ -3632,8 +3636,7 @@ void MyAvatar::updateOrientation(float deltaTime) {
glm::vec3 targetPoint = eyesPosition + glm::normalize(cameraVector);
const float LOOKAT_MIX_ALPHA = 0.25f;
if (getDriveKey(TRANSLATE_Y) == 0.0f) {
if (!isFlying() || !hasDriveInput()) {
// Approximate the head's look at vector to the camera look at vector with some delay.
float mixAlpha = LOOKAT_MIX_ALPHA * timeScale;
if (mixAlpha > 1.0f) {