From f98e714f60367322f41f6f81a9f68f34bddf03bb Mon Sep 17 00:00:00 2001 From: Roxie Linden Date: Tue, 3 Oct 2023 16:04:32 -0700 Subject: hook up listen from avatar vs camera --- indra/newview/llvoicewebrtc.cpp | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/indra/newview/llvoicewebrtc.cpp b/indra/newview/llvoicewebrtc.cpp index 8d929fd36a..3584fa31b2 100644 --- a/indra/newview/llvoicewebrtc.cpp +++ b/indra/newview/llvoicewebrtc.cpp @@ -2175,6 +2175,27 @@ Json::Value LLWebRTCVoiceClient::getPositionAndVolumeUpdateJson(bool force) if ((mSpatialCoordsDirty || force) && inSpatialChannel()) { + LLVector3d earPosition; + LLQuaternion earRot; + switch (mEarLocation) + { + case earLocCamera: + default: + earPosition = mCameraPosition; + earRot = mCameraRot; + break; + + case earLocAvatar: + earPosition = mAvatarPosition; + earRot = mAvatarRot; + break; + + case earLocMixed: + earPosition = mAvatarPosition; + earRot = mCameraRot; + break; + } + root["sp"] = Json::objectValue; root["sp"]["x"] = (int) (mAvatarPosition[0] * 100); root["sp"]["y"] = (int) (mAvatarPosition[1] * 100); @@ -2186,14 +2207,14 @@ Json::Value LLWebRTCVoiceClient::getPositionAndVolumeUpdateJson(bool force) root["sh"]["w"] = (int) (mAvatarRot[3] * 100); root["lp"] = Json::objectValue; - root["lp"]["x"] = (int) (mCameraPosition[0] * 100); - root["lp"]["y"] = (int) (mCameraPosition[1] * 100); - root["lp"]["z"] = (int) (mCameraPosition[2] * 100); + root["lp"]["x"] = (int) (earPosition[0] * 100); + root["lp"]["y"] = (int) (earPosition[1] * 100); + root["lp"]["z"] = (int) (earPosition[2] * 100); root["lh"] = Json::objectValue; - root["lh"]["x"] = (int) (mCameraRot[0] * 100); - root["lh"]["y"] = (int) (mCameraRot[1] * 100); - root["lh"]["z"] = (int) (mCameraRot[2] * 100); - root["lh"]["w"] = (int) (mCameraRot[3] * 100); + root["lh"]["x"] = (int) (earRot[0] * 100); + root["lh"]["y"] = (int) (earRot[1] * 100); + root["lh"]["z"] = (int) (earRot[2] * 100); + root["lh"]["w"] = (int) (earRot[3] * 100); mSpatialCoordsDirty = false; } -- cgit v1.2.3