<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Positioning Hot Spots by location]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1451&amp;type=atom" />
	<updated>2020-06-18T17:55:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1451</id>
		<entry>
			<title type="html"><![CDATA[Re: Positioning Hot Spots by location]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6388#p6388" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Unfortunately, I did not understand the description of your problem.<br />Here is the video that I have when using this script:<br /><a href="https://www.dropbox.com/s/e5tc5qm7em0ub6a/ScreenRecorderProject105.mp4?dl=0">https://www.dropbox.com/s/e5tc5qm7em0ub … 5.mp4?dl=0</a><br />Please explain your problem in more detail.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2020-06-18T17:55:01Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6388#p6388</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Positioning Hot Spots by location]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6387#p6387" />
			<content type="html"><![CDATA[<p>hi i put it in the code but the hotspot is following the camera wherever i go. i want the the hotspot stay at it&#039;s location. how can i do that?</p>]]></content>
			<author>
				<name><![CDATA[gbo10001]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1325</uri>
			</author>
			<updated>2020-06-18T16:06:25Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6387#p6387</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Positioning Hot Spots by location]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5983#p5983" />
			<content type="html"><![CDATA[<p><span class="postimg"><img src="https://infinity-code.com/sites/default/files/styles/full_post/public/images/news/2020.02.17%20-%20uPano%20-%20Positioning%20Hot%20Spots%20by%20location.jpg?itok=Dri36EyM" alt="Positioning Hot Spots by location" /></span></p><p>When you have locations where the current and target panoramas are located, using uPano API you can convert the location to pan and tilt.</p><p>Example:<br /></p><div class="codebox"><pre><code>using System;
using InfinityCode.uPano;
using InfinityCode.uPano.HotSpots;
using UnityEngine;

public class CreateHotSpotByLocation : MonoBehaviour
{
    public double panoLongitude;
    public double panoLatitude;
    public float panoAltitude;

    public double hotSpotLongitude;
    public double hotSpotLatitude;
    public float hotSpotAltitude;

    public GameObject hotSpotPrefab;
    private HotSpot hotSpot;

    private void Start()
    {
        HotSpotManager hotSpotManager = GetComponent&lt;HotSpotManager&gt;();
        hotSpot = hotSpotManager.Create(0, 0, hotSpotPrefab);
        UpdatePosition(hotSpot, hotSpotLongitude, hotSpotLatitude, hotSpotAltitude);
    }

    private void UpdatePosition(HotSpot hotSpot, double longitude, double latitude, float altitude)
    {
        double tx1, tx2, ty1, ty2;
        GeoHelper.CoordinatesToTile(panoLongitude, panoLatitude, 20, out tx1, out ty1);
        GeoHelper.CoordinatesToTile(longitude, latitude, 20, out tx2, out ty2);

        double distance = GeoHelper.Distance(panoLongitude, panoLatitude, longitude, latitude) * 1000;

        float pan = 90 + (float) MathHelper.Angle2D(tx1, ty1, tx2, ty2);
        float tilt = 0;

        float offset = altitude - panoAltitude;
        if (Math.Abs(offset) &gt; float.Epsilon)
        {
            tilt = (float)Math.Atan2(offset, distance) * Mathf.Rad2Deg;
        }

        hotSpot.SetPanTilt(pan, tilt);
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2020-02-17T09:45:29Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5983#p5983</id>
		</entry>
</feed>
