From 60d8647a32db1dd54ffde742e157b54b183592a7 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Tue, 16 May 2023 02:00:51 +0300 Subject: SL-19602 Alt-Zoom overcompensates for z pelvis fixup Alt zoom was pointing near ground instead of agent's actual position --- indra/newview/llagentcamera.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'indra/newview/llagentcamera.cpp') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 77131efd75..2cf86cb001 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(); -- cgit v1.2.3 From 6f8b812ecd73bf25d44445e1b791f9e1b01f429f Mon Sep 17 00:00:00 2001 From: Alexander Gavriliuk Date: Wed, 21 Jun 2023 15:01:59 +0200 Subject: SL-19692 Z Offset is applied twice in Mouselook --- indra/newview/llagentcamera.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'indra/newview/llagentcamera.cpp') diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 2cf86cb001..d2fe570069 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1764,13 +1764,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()+ @@ -1778,11 +1789,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; -- cgit v1.2.3