<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=877&amp;type=atom" />
	<updated>2018-10-06T18:31:39Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=877</id>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4014#p4014" />
			<content type="html"><![CDATA[<p>Excellent. Many thanks!)</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-10-06T18:31:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4014#p4014</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4013#p4013" />
			<content type="html"><![CDATA[<p>I think I understand what you are trying to do.</p><p>Unity has a vertical field of view.<br />So let&#039;s supose that for Screen Height is 1080, the scale should be equal to 1.<br />When starting the application and resizing the screen, set scale = 1080 / New Screen Height.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-10-06T17:09:29Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4013#p4013</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4012#p4012" />
			<content type="html"><![CDATA[<p>Sent a project to you in PM</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-10-06T16:30:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4012#p4012</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4011#p4011" />
			<content type="html"><![CDATA[<p>At a screen resolution of 1080x1920, object number 2 needs to set the scale to 0.6, and then both objects will have the same size for the UI canvas</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-10-06T16:27:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4011#p4011</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4010#p4010" />
			<content type="html"><![CDATA[<p>The project has a CanvasMapObj prefab, there is a picture in it.<br />Copies of this prefab: # 1 is in the canvas, and # 2 is inside the card.</p><p><span style="color: #FF0000">URL removed. Please do not post asset on the forum.</span></p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-10-06T16:24:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4010#p4010</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3991#p3991" />
			<content type="html"><![CDATA[<p>Please send to support (support@infinity-code.com) a scene (as a package), that shows the problem.<br />I will check it out and give you advice how to fix this.</p><p>I do not need your working project. <br />I need ANY scene where I can check it out.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-10-03T19:02:04Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3991#p3991</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3990#p3990" />
			<content type="html"><![CDATA[<p>I return to this issue. This does not work.</p><p>Each zoom has a different scale. I need the object on which the &quot;Canvas&quot; with the &quot;World Space&quot; mode, on any zoom, be of such a scale that it is exactly the same size as the object, but is in the Canvas hierarchy.<br />In NGUI, this is done using the ScreenHeight / ScreenWidth coefficient. But the map also takes into account &quot;Distance a camera&quot;.</p><p>Help!)</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-10-02T15:15:02Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3990#p3990</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3806#p3806" />
			<content type="html"><![CDATA[<p>In the end, we have to multiply the result by 2 more. Thank you!)</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-21T00:11:43Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3806#p3806</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3805#p3805" />
			<content type="html"><![CDATA[<p>[image]<br /><a href="https://pp.userapi.com/c849136/v849136625/57a96/gdW_0Whupgg.jpg">https://pp.userapi.com/c849136/v8491366 … Whupgg.jpg</a><br />[/image]</p><p>There are objects on the map. When the object is beyond the boundaries of sight of the camera, it is attached to the edge of the screen, passing in the Canvas UI.<br />The picture shows that the objects that are visible to the camera are markers on the map and their scale is ~2 times larger than it should be.<br />This screenshot is made at a distance of the camera = 1000, with a screen resolution of 720 x 1480</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-20T19:33:18Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3805#p3805</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3803#p3803" />
			<content type="html"><![CDATA[<p>I tested your code and it works correctly.<br />Except that it returns a negative value.</p><p>Why should it be -40? <br />This can be any value that the marker occupies on the screen when scale = 1.<br />If you move the camera very close to the map, it will show you very big value.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-08-20T16:08:03Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3803#p3803</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3802#p3802" />
			<content type="html"><![CDATA[<p>I did this.<br />When the camera is installed at the distance of 1610, the resolution 720х1480, I have to get a result, which is sent to the input(the value markerHeight). I pass 40 and get -77. Must be -40, right?</p><p>What&#039;s wrong?</p><br /><div class="codebox"><pre><code>        public void CalculateScaleByResolution() {
            if (OnlineMaps.instance == null) {
                return;
            }
            float lon = 38;
            float lat = 45;
            int zoom = OnlineMaps.instance.zoom;
            OnlineMaps.instance.projection.CoordinatesToTile(lon, lat, zoom, out double tx, out double ty);
            float markerHeight = JourneyObject.instance.sizeElement;
            double ty2 = ty - markerHeight / 256;

            OnlineMaps.instance.projection.TileToCoordinates(tx, ty2, zoom, out double lon2, out double lat2);

            var res1 = OnlineMapsControlBase.instance.GetScreenPosition(new Vector2(lon, lat));
            var res2 = OnlineMapsControlBase.instance.GetScreenPosition(new Vector2((float)lon2, (float)lat2));

            Debug.Log(&quot;res1 = &quot; + res1);
            Debug.Log(&quot;res2 = &quot; + res2);

            res1 -= res2;
            Debug.Log(&quot;res3 = &quot; + res1);

            var val = markerHeight / res1.y;
            Debug.Log(&quot;val = &quot; + val);
        }</code></pre></div>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-20T13:27:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3802#p3802</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3801#p3801" />
			<content type="html"><![CDATA[<p>Thank you very much!<br />You are a miracle!</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-20T12:04:41Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3801#p3801</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3800#p3800" />
			<content type="html"><![CDATA[<p>1. Get the tile position of the marker.<br />If you use regular markers:<br />OnlineMapsMarkerBase.GetTilePosition<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsMarkerBase.html#a23d0083576dae410a5ff417f668a7e68">http://infinity-code.com/doxygen/online … 7f668a7e68</a><br />If you are using custom marker engine:<br />OnlineMaps.instance.projection.CoordinatesToTile</p><p>2. Subtract from Tile Y the height of the marker texture in pixels divided by 256.<br />double ty2 = ty - markerHeight / 256.</p><p>3. Convert the new tile position to geographical coordinates.<br />OnlineMaps.instance.projection.TileToCoordinates</p><p>4. Convert the original and new coordinates to the screen positions.<br />OnlineMapsControlBase.GetScreenPosition<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsControlBase.html#ae62dc7dc9d365e0fab178fb35214c35b">http://infinity-code.com/doxygen/online … b35214c35b</a></p><p>5. Subtract the second screen position from the first screen position to calculate the screen height of the marker when scale = 1.</p><p>6. Use this value to calculate the required scale.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-08-20T11:39:30Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3800#p3800</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3799#p3799" />
			<content type="html"><![CDATA[<p>For &quot;Canvas / Render Mode - World Space&quot; you need to set &quot;scale&quot; in the &quot;transform&quot;</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-20T11:17:41Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3799#p3799</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: The scale of the canvas in the "World Space" mode as in the "Overlay"]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3798#p3798" />
			<content type="html"><![CDATA[<p>The height of the camera - &quot;Camera Distance&quot; to &quot;OnlineMapsTileSetControl&quot;.<br />Sorry I wasn&#039;t accurate.</p>]]></content>
			<author>
				<name><![CDATA[NovaEiz]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=756</uri>
			</author>
			<updated>2018-08-20T11:16:17Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3798#p3798</id>
		</entry>
</feed>
