<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=GetCameraPos</id>
	<title>GetCameraPos - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://g1r-mp.com/wiki/index.php?action=history&amp;feed=atom&amp;title=GetCameraPos"/>
	<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=GetCameraPos&amp;action=history"/>
	<updated>2026-09-19T06:22:40Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://g1r-mp.com/wiki/index.php?title=GetCameraPos&amp;diff=798&amp;oldid=prev</id>
		<title>QCherry: Document scripted camera API and events available from G1R:MP 0.1.3</title>
		<link rel="alternate" type="text/html" href="https://g1r-mp.com/wiki/index.php?title=GetCameraPos&amp;diff=798&amp;oldid=prev"/>
		<updated>2026-09-08T23:50:47Z</updated>

		<summary type="html">&lt;p&gt;Document scripted camera API and events available from G1R:MP 0.1.3&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= getCameraPos =&lt;br /&gt;
&amp;lt;div style=&amp;quot;background:#fff5f5; border:1px solid #d13b3b; border-left:5px solid #d13b3b; color:#111111; padding:0.85rem 1rem; margin:0.75rem 0 1rem;&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; font-weight:bold; letter-spacing:0.04em;&amp;quot;&amp;gt;AVAILABLE FROM UPDATE 0.1.3&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;color:#111111; margin-top:0.25rem;&amp;quot;&amp;gt;This function is available in G1R:MP 0.1.3 and later. The contract below includes the compatibility guarantees introduced in that update.&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Returns the last acknowledged camera position cached for this client resource.&lt;br /&gt;
&lt;br /&gt;
== Syntax ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot;&amp;gt;&lt;br /&gt;
table|false getCameraPos()&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Parameters ==&lt;br /&gt;
This function does not accept parameters.&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
A table &amp;lt;code&amp;gt;{x,y,z}&amp;lt;/code&amp;gt; in metres, or &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; when no ready acknowledged camera state is available.&lt;br /&gt;
&lt;br /&gt;
== Examples ==&lt;br /&gt;
Client-side: request a fresh snapshot and read it inside the matching callback.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;lua&amp;quot; line&amp;gt;&lt;br /&gt;
-- Client-side: run after the local world and player camera are ready.&lt;br /&gt;
local query&lt;br /&gt;
addEventHandler(&amp;quot;onClientCameraCommandResult&amp;quot;, resourceRoot,&lt;br /&gt;
    function(requestId, ok, phase, errorText, stateJson)&lt;br /&gt;
        if requestId ~= query then return end&lt;br /&gt;
        query = nil&lt;br /&gt;
        if not ok or phase ~= &amp;quot;state&amp;quot; then&lt;br /&gt;
            outputDebugString(&amp;quot;Camera query failed: &amp;quot; .. tostring(errorText), 2)&lt;br /&gt;
            return&lt;br /&gt;
        end&lt;br /&gt;
        local state = getCameraState()&lt;br /&gt;
        if not state or not state.ready then return end&lt;br /&gt;
        local position = getCameraPos()&lt;br /&gt;
        if position then outputDebugString((&amp;quot;Camera: %.2f %.2f %.2f&amp;quot;):format(position.x, position.y, position.z)) end&lt;br /&gt;
    end)&lt;br /&gt;
query = requestCameraState()&lt;br /&gt;
if not query then outputDebugString(&amp;quot;Camera query was not queued&amp;quot;, 2) end&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
* Client-side resource scripts only. Equivalent PascalCase spelling: &amp;lt;code&amp;gt;GetCameraPos&amp;lt;/code&amp;gt;. There is no server-side version.&lt;br /&gt;
* This getter reads a per-resource cache, not the engine synchronously. [[requestCameraState]] refreshes it asynchronously without taking camera ownership.&lt;br /&gt;
* A validated response updates the cache before [[onClientCameraCommandResult]] is dispatched. The cache is invalidated on lifecycle/connection changes.&lt;br /&gt;
* A command&amp;#039;s immediate applied/completed snapshot can precede the next rendered camera update. Request state after another frame or short timer to observe the updated view. See [[Scripted camera]] for field meanings and timing.&lt;br /&gt;
&lt;br /&gt;
[[Category:Lua Functions]]&lt;br /&gt;
[[Category:Client Functions]]&lt;br /&gt;
[[Category:Camera Functions]]&lt;/div&gt;</summary>
		<author><name>QCherry</name></author>
	</entry>
</feed>