summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2026-09-15 14:37:32 +0300
committerGitHub <noreply@github.com>2026-09-15 14:37:32 +0300
commit509deb7996ad8aef91f51b97cbd74c92c8faa800 (patch)
tree8b58f8c9569d160fac6931e33b8f23d322cc313d
parent7412083c86a2d47b70f93a6395792a67255bbf33 (diff)
#5663 add LEAP API to request camera position and orientation
-rw-r--r--indra/newview/llagentlistener.cpp20
-rw-r--r--indra/newview/llagentlistener.h1
2 files changed, 21 insertions, 0 deletions
diff --git a/indra/newview/llagentlistener.cpp b/indra/newview/llagentlistener.cpp
index 2c4ec1fc59..f0b508592e 100644
--- a/indra/newview/llagentlistener.cpp
+++ b/indra/newview/llagentlistener.cpp
@@ -208,6 +208,15 @@ LLAgentListener::LLAgentListener(LLAgent &agent)
"avatar render position is used as the point",
&LLAgentListener::getAgentScreenPos,
llsd::map("reply", LLSD()));
+
+ add("getCamera",
+ "Send information about the viewer camera's current state on [\"reply\"]:\n"
+ "[\"position\"]: array of [x, y, z] camera position in agent coordinates\n"
+ "[\"rotation\"]: array of [x, y, z, w] camera rotation quaternion\n"
+ "[\"fov\"]: vertical field of view, in radians\n"
+ "[\"focus_position\"]: array of [x, y, z] camera focus position in agent coordinates",
+ &LLAgentListener::getCamera,
+ llsd::map("reply", LLSD()));
}
void LLAgentListener::requestTeleport(LLSD const & event_data) const
@@ -849,3 +858,14 @@ void LLAgentListener::getAgentScreenPos(LLSD const& event_data)
response["x"] = screen_pos.mX;
response["y"] = screen_pos.mY;
}
+
+void LLAgentListener::getCamera(LLSD const& event_data)
+{
+ Response response(LLSD(), event_data);
+ LLViewerCamera* camera = LLViewerCamera::getInstance();
+
+ response["position"] = ll_sd_from_vector3(camera->getOrigin());
+ response["rotation"] = ll_sd_from_quaternion(camera->getQuaternion());
+ response["fov"] = camera->getView();
+ response["focus_position"] = ll_sd_from_vector3(mAgent.getPosAgentFromGlobal(gAgentCamera.getFocusGlobal()));
+}
diff --git a/indra/newview/llagentlistener.h b/indra/newview/llagentlistener.h
index 031fc75e46..fa08822998 100644
--- a/indra/newview/llagentlistener.h
+++ b/indra/newview/llagentlistener.h
@@ -70,6 +70,7 @@ private:
void getNearbyObjectsList(LLSD const& event_data);
void getAttachedObjectsList(LLSD const& event_data);
void getAgentScreenPos(LLSD const& event_data);
+ void getCamera(LLSD const& event_data);
LLViewerObject * findObjectClosestTo( const LLVector3 & position, bool sit_target = false ) const;