Is there a plugin that can get the coordinates of a hotspot within a VR scene?


  • Hello,
    Is there a plugin that can get the coordinates of a hotspot within a VR scene? If you look at the image I attached, there is a red dot in the center. I want to click on this dot and have the x, y coordinates of that location copied to the clipboard, but I don't know how to do it. So, is there a plugin with this functionality?

    When clicking on the red dot, I would like values like ath="-164.88" atv="23.10" to be copied.

  • Quote

    When clicking on the red dot, I would like values like ath="-164.88" atv="23.10" to be copied.

    I assume you mean a 360 photo scene?
    First include the copy_to_clipboard.xml in your project, it could be in the plugins folder.

    <include url="plugins/copy_to_clipboard.xml" />

    Then add something like this to the onclick of the hotspots, or as an onclick.addevent in your hotspot style perhaps..
    onclick="DoCopy(*ath,*atv);"

    And this action makes it all happen.

    Code
        <action name="DoCopy" scope="local" args="ath,atv">
            tmp = 'ath="' + ath + '" atv="' + atv + '"';
            copy_to_clipboard(*tmp);
        </action>    

    If you need the x and y, indexofrefraction is your friend *g*


    and perhaps you do mean VR then the spacetosphere can be another friend..
    krpano.com - Documentation - Actions / Scripting Reference

    Hope it helps,
    Tuur*thumbsup*

  • I have a question: do you have VR for mobile or for oculus quest? as there will be different approaches.
    For mobile solutions above described will be true, but for glasses already not, as there is a separate position of the head, and both controllers. and they all have their own coordinates.


  • I’m not very proficient in English, so I’m using a translator, but I’m having trouble understanding what it means. This code is what I’m currently working on. I want to make it so that when you click on center_line.png, the ath and atv values are copied to the clipboard. And after copying, I would like it to display “Copy completed”. This code is being used as an include in tour.xml from the center.xml file.

  • Hi,

    Align must be center..

    .. i think you need the ath and atv in de pano of the center(??)

    Try with the code from indexofrefraction. The result is in the log.

    Or include that copy plugin, use my DoCopy action

    Code
    <events name="coord" keep="true" onclick="screentosphere(mouse.x, mouse.y, toh, tov);DoCopy(*toh,*tov);" />

    or perhaps instead of mouse.x and mouse.y use plugin[center_line].x and plugin[center_line].y

    *question*

    Tuur*thumbsup*

  • Code
    <include url="plugins/copy_to_clipboard.xml" />
    <events name="coord" keep="true" onclick="coord()" />
    <action name="coord" scope="local">
    screentosphere(mouse.x, mouse.y, local.ath, local.atv);
    calc(local.clip, 'ath="' + ath + '" atv="' + atv + '"');
    copy_to_clipboard(get(clip));    
    trace(clip);            
    </action>   

    needs this:

    krpano.com - Plugins - XML Extensions

  • Code
    <include url="plugins/copy_to_clipboard.xml" />
    <events name="coord" keep="true" onclick="coord()" />
    <action name="coord" scope="local">
    screentosphere(mouse.x, mouse.y, local.ath, local.atv);
    calc(local.clip, 'ath="' + ath + '" atv="' + atv + '"');
    copy_to_clipboard(get(clip));    
    trace(clip);            
    </action>   

    needs this:

    https://krpano.com/plugins/xmlextensions/#copy_to_clipboard


    Is this the right way to do it? I think I don’t understand. I tried as you told me, but there is no response. Below is the code of the files I am working on. Am I missing something? *question*

    tour.xml


    skin/options_on.xml


    plugins/copy_to_clipboard.xml

  • the plugin must be in the plugins folder

    if you click anywhere in the panorama you should see the coordinates in the log

    (and they should be in the clipboard)


    your "centermidle" values are invalid, it should be "center"

    I was stupid. As you told me, I tried again and found the coordinates. It's not the location value of the red dot, but the location value of the mouse click.
    I want to know how I can get the location value copied when I click on the red dot (center_line.png).

    <plugin name="center_line" url="center_line.png" align="center" keep="true" scale="1"/>

    And I think it would be nice to have a notification when the location value is copied.
    It doesn't apply well.

    The method of copying when clicking with the mouse is very inconvenient because it is forced to move when clicking because of the GArrows plug-in.

  • <plugin name="center_line" url="center_line.png" align="center" keep="true" scale="1" onclick="DoCopy(*ath,*atv);"/>

    <events name="coord" keep="true" onclick="screentosphere(plugin[center_line].x, plugin[center_line].y, toh, tov);DoCopy(*toh,*tov);" />

    <action name="DoCopy" scope="local" args="ath,atv">

    tmp = 'ath="' + ath + '" atv="' + atv + '"';

    copy_to_clipboard(*tmp);

    </action>

    I tried again. When I click center_line.png, it copies like asath="null" atv="null".
    OTL

  • hm maybe better try the code from post #10

    bc the line below does nothing ...

    screentosphere(plugin[center_line].x, plugin[center_line].y ... (these are not screen coordinates)

    it should be mouse.x, mouse.y

    EDIT : dunno what you want to do, but the code from #10 is to click at any point in the panorama,
    get the ath/atv coordinates in the clipboard, so that you can use them to set a hotspots position.

  • Quote

    I was stupid. As you told me, I tried again and found the coordinates. It's not the location value of the red dot, but the location value of the mouse click.
    I want to know how I can get the location value copied when I click on the red dot (center_line.png).

    Can you provide a link to the virtual tour itself with this example so we understand what this red dot is and how it behaves?

    If it's just a hotspot, and you need its coordinates as "ath" and "atv", then you need to add an "onclick" event on that hotspot:

    Code
    <plugin name='...'
    	onclick="DoCopy(*ath,*atv)"
    	...
    />

    If you need to get "ath" and "atv" of the center of the screen, where the view is currently pointing, then you need to take the values from the "view" object:

    Code
    <events name="docopy" keep="true" 
    	onclick="DoCopy('view',*view.hlookat,*view.vlookat)"
    	... 
    />
  • Quote

    Are there any plugins that you already make and sell?

    we first need to understand what exactly you want to end up with)))) because I haven't yet understood the goal you're trying to achieve))

    whether to get the position of the hotspot in the scene when clicking on it, or the position of the view at the current moment)))

  • we first need to understand what exactly you want to end up with)))) because I haven't yet understood the goal you're trying to achieve))

    whether to get the position of the hotspot in the scene when clicking on it, or the position of the view at the current moment)))

    I solved this a little while ago.
    I applied the various hints that you guys gave me and it works well.
    Check the code here.
    But there's still one thing that's not working.
    How do I display the word "copy" when I click on a red dot?


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!