<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=2273</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=2273&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Issue with: "Screen position out of view frustum" in Navigation exampl.]]></description>
		<lastBuildDate>Wed, 15 May 2024 22:51:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9536#p9536</link>
			<description><![CDATA[<p>Thanks for the stack trace.<br />I have tested and the infinity comes from Input.mousePosition (Unity API).<br />It looks like some bug in Unity Engine.<br />On my side I can&#039;t fix this bug, only add an extra check to OnlineMapsControlBase.GetInputPosition to prevent exceptions.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Wed, 15 May 2024 22:51:32 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9536#p9536</guid>
		</item>
		<item>
			<title><![CDATA[Re: Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9533#p9533</link>
			<description><![CDATA[<p>I also noticed that these errors do not occur in Unity version 2022.3.11f1, suggesting that the issue might be specific to the Unity version I am currently using. </p><p>Here is the full stack trace from the exception:<br /></p><div class="codebox"><pre><code>Screen position out of view frustum (screen pos inf, -inf) (Camera rect 0 0 1024 2048)
0x00007ff60aaf8e5d (Unity) StackWalker::GetCurrentCallstack
0x00007ff60aafdf29 (Unity) StackWalker::ShowCallstack
0x00007ff60bae2a21 (Unity) GetStacktrace
0x00007ff60c19cebe (Unity) DebugStringToFile
0x00007ff60a405be5 (Unity) Camera::ScreenPointToRay
0x00007ff609a0cf9f (Unity) Camera_CUSTOM_ScreenPointToRay_Injected
0x00000237b72e1faa (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Camera:ScreenPointToRay_Injected (UnityEngine.Camera,UnityEngine.Vector2&amp;,UnityEngine.Camera/MonoOrStereoscopicEye,UnityEngine.Ray&amp;)
0x00000237b72e1e7b (Mono JIT Code) UnityEngine.Camera:ScreenPointToRay (UnityEngine.Vector2,UnityEngine.Camera/MonoOrStereoscopicEye)
0x00000237b72e1db3 (Mono JIT Code) UnityEngine.Camera:ScreenPointToRay (UnityEngine.Vector3,UnityEngine.Camera/MonoOrStereoscopicEye)
0x00000237b72e1ca3 (Mono JIT Code) UnityEngine.Camera:ScreenPointToRay (UnityEngine.Vector3)
0x00000237b72e150b (Mono JIT Code) OnlineMapsTileSetControl:HitTest (UnityEngine.Vector2) (at .../Assets/Infinity Code/Online maps/Scripts/Controls/3D/OnlineMapsTileSetControl.cs:464)
0x00000237b72e0fd7 (Mono JIT Code) OnlineMapsControlBase:HitTest () (at .../Assets/Infinity Code/Online maps/Scripts/Controls/Base/OnlineMapsControlBase.cs:622)
0x00000237b72e0c8b (Mono JIT Code) OnlineMapsControlBase:UpdateZoom () (at  .../Assets/Infinity Code/Online maps/Scripts/Controls/Base/OnlineMapsControlBase.cs:1313)
0x00000237b72e07e3 (Mono JIT Code) OnlineMapsControlBase:ProcessInteractions () (at .../Assets/Infinity Code/Online maps/Scripts/Controls/Base/OnlineMapsControlBase.cs:1067)
0x00000237b72e0633 (Mono JIT Code) OnlineMapsControlBase:Update () (at .../Assets/Infinity Code/Online maps/Scripts/Controls/Base/OnlineMapsControlBase.cs:1144)
0x00000237b723f628 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ff825e24c1e (mono-2.0-bdwgc) mono_jit_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/mini/mini-runtime.c:3445)
0x00007ff825d5d254 (mono-2.0-bdwgc) do_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3068)
0x00007ff825d5d3cc (mono-2.0-bdwgc) mono_runtime_invoke (at C:/build/output/Unity-Technologies/mono/mono/metadata/object.c:3115)
0x00007ff60aa11ba4 (Unity) scripting_method_invoke
0x00007ff60a9ef914 (Unity) ScriptingInvocation::Invoke
0x00007ff60a9d7104 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff60a9d722a (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff60a46a1fb (Unity) BaseBehaviourManager::CommonUpdate&lt;BehaviourManager&gt;
0x00007ff60a47177a (Unity) BehaviourManager::Update
0x00007ff60a6a6e7d (Unity) `InitPlayerLoopCallbacks&#039;::`2&#039;::UpdateScriptRunBehaviourUpdateRegistrator::Forward
0x00007ff60a685f8c (Unity) ExecutePlayerLoop
0x00007ff60a686100 (Unity) ExecutePlayerLoop
0x00007ff60a68c995 (Unity) PlayerLoop
0x00007ff60b66228f (Unity) PlayerLoopController::InternalUpdateScene
0x00007ff60b66f0bd (Unity) PlayerLoopController::UpdateSceneIfNeededFromMainLoop
0x00007ff60b66d3a1 (Unity) Application::TickTimer
0x00007ff60bae86ca (Unity) MainMessageLoop
0x00007ff60baed5a0 (Unity) WinMain
0x00007ff60ced0aae (Unity) __scrt_common_main_seh
0x00007ff8cd47257d (KERNEL32) BaseThreadInitThunk
0x00007ff8cdd4aa48 (ntdll) RtlUserThreadStart</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (aurox8)]]></author>
			<pubDate>Mon, 13 May 2024 15:05:39 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9533#p9533</guid>
		</item>
		<item>
			<title><![CDATA[Re: Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9532#p9532</link>
			<description><![CDATA[<p>Add this line to the beginning of the method and the problem will be solved:<br /></p><div class="codebox"><pre><code>if (float.IsInfinity(position.x) || float.IsInfinity(position.y)) return false;</code></pre></div><p>If possible, please send me the full stack trace of the exception so I can check why this is happening.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Mon, 13 May 2024 11:44:38 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9532#p9532</guid>
		</item>
		<item>
			<title><![CDATA[Re: Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9531#p9531</link>
			<description><![CDATA[<p>Hello,</p><p>Thank you for your suggestions. I&#039;ve implemented additional logging and checks in the HitTest method to catch invalid screen positions before calling ScreenPointToRay. Here&#039;s the updated method:</p><div class="codebox"><pre><code>    protected override bool HitTest(Vector2 position)
    {
        try
        {
#if NGUI
        if (UICamera.Raycast(position)) return false;
#endif
            Rect rect = currentCamera.rect;
            if (rect.width == 0 || rect.height == 0) return false;
            if (position.x &lt; 0 || position.y &lt; 0 || position.x &gt; Screen.width || position.y &gt; Screen.height)
            {
                Debug.Log($&quot;HitTest error! Position: {position.x}, {position.y}&quot;);
            }
            return cl.Raycast(currentCamera.ScreenPointToRay(position), out lastRaycastHit, OnlineMapsUtils.maxRaycastDistance);
        } 
        catch (Exception e)
        {
            Debug.Log($&quot;HitTest error! Position: {position.x}, {position.y}&quot;);
            return false;
        }
    }</code></pre></div><p>With these changes, the console now outputs the following when the error occurs:<br /></p><div class="codebox"><pre><code>HitTest error! Position: Infinity, Infinity</code></pre></div><p>It appears the position sometimes becomes infinite, which likely causes the out-of-view frustum error. However, even with these checks, the issue persists and the try/catch block isn&#039;t catching exceptions as expected, perhaps due to the nature of errors coming from lower-level or native Unity code.</p><p>Could you advise on any further steps I might take to handle or prevent Infinity positions or suggest any modifications that could help resolve this error?</p>]]></description>
			<author><![CDATA[null@example.com (aurox8)]]></author>
			<pubDate>Mon, 13 May 2024 07:51:16 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9531#p9531</guid>
		</item>
		<item>
			<title><![CDATA[Re: Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9528#p9528</link>
			<description><![CDATA[<p>Hello.</p><p>This error usually happens when the screen width or height is zero.<br />But HitTest method has a check for this case.</p><p>Try wrapping the contents of the OnlineMapsTileSetControl:HitTest method in try/catch, and log the value of the position parameter when the exception happens.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Fri, 10 May 2024 18:47:42 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9528#p9528</guid>
		</item>
		<item>
			<title><![CDATA[Issue with: "Screen position out of view frustum" in Navigation exampl]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=9527#p9527</link>
			<description><![CDATA[<p>Hello,</p><p>I&#039;m encountering a persistent error when trying out the &quot;Navigation&quot; example scene in Online Maps v3 (v3.9.3.1) in Unity editor 2022.3.28f1 on the Android platform. The issue arises specifically with a screen position error related to the camera&#039;s view frustum. Here&#039;s the error message I receive:<br /></p><div class="codebox"><pre><code>Screen position out of view frustum (screen pos inf, -inf) (Camera rect 0 0 1080 2340)</code></pre></div><p>This error is followed by a series of call stacks that seem to involve Camera::ScreenPointToRay and related methods. Here is a part of the call stack:<br /></p><div class="codebox"><pre><code>0x00007ff7ab708e5d (Unity) StackWalker::GetCurrentCallstack
0x00007ff7ab70df29 (Unity) StackWalker::ShowCallstack
0x00007ff7ac6f2a21 (Unity) GetStacktrace
...
0x00000230acf3b5eb (Mono JIT Code) OnlineMapsTileSetControl:HitTest (UnityEngine.Vector2) (Infinity Code/Online maps/Scripts/Controls/3D/OnlineMapsTileSetControl.cs:458)</code></pre></div><p>I have checked my camera settings and scene setup but haven&#039;t found any discrepancies that might cause this. Could anyone please help me understand what might be going wrong or how to resolve this error?</p>]]></description>
			<author><![CDATA[null@example.com (aurox8)]]></author>
			<pubDate>Fri, 10 May 2024 11:05:56 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=9527#p9527</guid>
		</item>
	</channel>
</rss>
