diff options
author | Brad Linden <brad@lindenlab.com> | 2023-08-23 12:26:14 -0700 |
---|---|---|
committer | Brad Linden <brad@lindenlab.com> | 2023-08-23 12:26:14 -0700 |
commit | c6d5f11f63dfa0ac65a2afebf88b3078f571e044 (patch) | |
tree | 63fd8081ce450fd426ea717adc04d09b0da4b713 /indra/newview/llagentcamera.cpp | |
parent | ef33902f220df35727ba54ee8bc3ed02bc53d6be (diff) | |
parent | d454512050e636a19e4b7545515dea4f4b1bbf0d (diff) |
Merge remote-tracking branch 'origin/main' into DRTVWR-559
Diffstat (limited to 'indra/newview/llagentcamera.cpp')
-rw-r--r-- | indra/newview/llagentcamera.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 826a4ba761..29642d3f45 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -401,10 +401,15 @@ LLVector3 LLAgentCamera::calcFocusOffset(LLViewerObject *object, LLVector3 origi // if is avatar - don't do any funk heuristics to position the focal point // see DEV-30589 - if (object->isAvatar() || (object->isAnimatedObject() && object->getControlAvatar())) + if ((object->isAvatar() && !object->isRoot()) || (object->isAnimatedObject() && object->getControlAvatar())) { return original_focus_point - obj_pos; } + if (object->isAvatar()) + { + LLVOAvatar* av = object->asAvatar(); + return original_focus_point - av->getCharacterPosition(); + } LLQuaternion inv_obj_rot = ~obj_rot; // get inverse of rotation LLVector3 object_extents = object->getScale(); @@ -1765,13 +1770,24 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) LL_WARNS() << "Null avatar drawable!" << LL_ENDL; return LLVector3d::zero; } + head_offset.clearVec(); + F32 fixup; + if (gAgentAvatarp->hasPelvisFixup(fixup)) + { + head_offset[VZ] -= fixup; + } + if (gAgentAvatarp->isSitting()) + { + head_offset.mdV[VZ] += 0.1; + } + if (gAgentAvatarp->isSitting() && gAgentAvatarp->getParent()) { gAgentAvatarp->updateHeadOffset(); - head_offset.mdV[VX] = gAgentAvatarp->mHeadOffset.mV[VX]; - head_offset.mdV[VY] = gAgentAvatarp->mHeadOffset.mV[VY]; - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ] + 0.1f; + head_offset.mdV[VX] += gAgentAvatarp->mHeadOffset.mV[VX]; + head_offset.mdV[VY] += gAgentAvatarp->mHeadOffset.mV[VY]; + head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ]; const LLMatrix4& mat = ((LLViewerObject*) gAgentAvatarp->getParent())->getRenderMatrix(); camera_position_global = gAgent.getPosGlobalFromAgent ((gAgentAvatarp->getPosition()+ @@ -1779,11 +1795,7 @@ LLVector3d LLAgentCamera::calcCameraPositionTargetGlobal(BOOL *hit_limit) } else { - head_offset.mdV[VZ] = gAgentAvatarp->mHeadOffset.mV[VZ]; - if (gAgentAvatarp->isSitting()) - { - head_offset.mdV[VZ] += 0.1; - } + head_offset.mdV[VZ] += gAgentAvatarp->mHeadOffset.mV[VZ]; camera_position_global = gAgent.getPosGlobalFromAgent(gAgentAvatarp->getRenderPosition());//frame_center_global; head_offset = head_offset * gAgentAvatarp->getRenderRotation(); camera_position_global = camera_position_global + head_offset; |