You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

Mudin

Beginner

  • "Mudin" started this thread

Posts: 27

Location: South Korea

Occupation: VR Developer

  • Send private message

1

Tuesday, May 17th 2016, 9:57am

lookto 3d hotspot

Hello,

I have a question, sorry if it was asked already.
i am using looktohotspot() to look the clicked hotspot.

But now my all hotspots' ath=0 and atv =0. Stilll their positions are different from each other cuz I am using ox,oy and ty.
in this case, looktohotspot() is looking to the same point (0,0).

is there any way to lookto moved/translated hotspot?

Thank you

This post has been edited 1 times, last edit by "Mudin" (May 18th 2016, 7:53am)


Mudin

Beginner

  • "Mudin" started this thread

Posts: 27

Location: South Korea

Occupation: VR Developer

  • Send private message

2

Wednesday, May 18th 2016, 8:55am

Hi,
I am using hotspot for showing floor plan and markers. (see the image below)

My source code is here:

Quoted


<scene name="floor_plan" title="Floor Plan">
<preview type="grid(cube,32,32,512,0x002211,0x000011,0x00ff11);"/>
<view maxpixelzoom="1.0" fovmax="150" limitview="auto" hlookat="0" vlookat="0"/>
<style name="floor_plan_style" distorted="true" enabled="false" zorder="1" width="512" height="512" alpha="0.7"/>
<hotspot name="fp_1" style="floor_plan_style" ath="0" atv="0" url="/uploads/test/projects/6/21/hotpots/floor_plan2.jpg"/>
<style name="marker" distorted="true" enabled="true" capture="false" alpha="1.0" zorder="3" onover="tween(scale,0.45);" onout="tween(scale,0.4);" scale="0.4" ath="0" atv="0" edge="bottom"/>
<hotspot name="m_257" style="marker" ox="-150" oy="-80" url="/uploads/test/gallery/157/marker.png" onclick="js(pvrPlayer.fire('m_click',257))"/>
<hotspot name="m_259" style="marker" ox="0" oy="20" url="/uploads/test/gallery/159/marker.png" onclick="js(pvrPlayer.fire('m_click',259))"/>
<hotspot name="m_258" style="marker" ox="190" oy="-60" url="/uploads/test/gallery/159/marker.png" onclick="js(pvrPlayer.fire('m_click',258))"/>
<hotspot name="m_260" style="marker" ox="-165" oy="130" url="/uploads/test/gallery/159/marker.png" onclick="js(pvrPlayer.fire('m_click',260))"/>
<hotspot name="m_263" style="marker" ox="3.375" oy="132.5625" url="/uploads/test/gallery/119/marker.png" onclick="js(pvrPlayer.fire('m_click',263))"/>
</scene>
in js :

Quoted


pvrPlayer.on('m_click', function (ev) {
var id=ev.data;
pvrPlayer.krpano.call("looktohotspot(m_"+id+",10)"); // always looking to center since all marker hotspots' ath = 0 and atv = 0
pvrPlayer.krpano.call('loadscene(s_' + markers[id].scene_id + ',KEEPVIEW,ZOOMBLEND(1))'); // opens linked scene
pvrPlayer.krpano.call('skin_view_littleplanet_no_effect();'); //change to little planet view without effect, animation
pvrPlayer.krpano.call('skin_view_normal();'); // change back to normal view with animation to feel it is comign
});
How can I find the fake ath, atv for each marker hotspots which are moved by using ox, oy, ty?

I hope this will be good for showing floor plan in the scene, even in vr mode.
Kindly help me for this.
Thanks,
Mudin
Mudin has attached the following image:
  • Screen Shot 2016-05-18 at 3.20.28 PM.png

Timescale

Trainee

Posts: 120

Location: Netherlands

Occupation: Archaeologist, Timescale R&D

  • Send private message

3

Wednesday, May 18th 2016, 12:46pm

I think I have an idea what you are doing, but I'm not sure why you are taking this approach..Anyway.


I think converting is possible, but why don't you make it easier on yourself and simply focus on the mouse coordinates when you clicked something? You can translaste the mouse X and Y to ATH and ATV and move to that position with something like.

Source code

1
2
screentosphere(mouse.x, mouse.y, new_ath, new_atv);
lookto(ath,atv,30, smooth(50,50,50));

Mudin

Beginner

  • "Mudin" started this thread

Posts: 27

Location: South Korea

Occupation: VR Developer

  • Send private message

4

Wednesday, May 18th 2016, 2:32pm

Thank you for your reply,

Yeah you are right!
But the reason why I chose this approach is ..
Even we click the floor plan, it should 'lookto' nearest hotspot of the clicked position and open its scene.

I need to convert mouse(ath,atv) to floor plan(ox,oy),
Then I can find the nearest marker and convert its (ox,oy) to (ath,atv).
And I can lookto to this (ath,atv) before open it.

If you have better idea, I will appreciate it.

Thanks

Mudin

This post has been edited 1 times, last edit by "Mudin" (May 21st 2016, 1:35pm)


Timescale

Trainee

Posts: 120

Location: Netherlands

Occupation: Archaeologist, Timescale R&D

  • Send private message

5

Wednesday, May 18th 2016, 3:39pm

So let me get this straight...

When you click anywhere on the
floor plan, you want to invoke an action that cycles through all the
hotspots to find the nearest one and center on that one?

I'll have to think a bit how that could be make elegantly.

Do you perhaps have a link to a demo?

Mudin

Beginner

  • "Mudin" started this thread

Posts: 27

Location: South Korea

Occupation: VR Developer

  • Send private message

6

Thursday, May 19th 2016, 3:41am

Hello,

Yes you are right, that's what I am trying to do!

And also floor plan enable is false, it doesnt call 'onclick'.

Quoted


<style name="floor_plan_style" distorted="true" enabled="false" zorder="1" width="512" height="512" alpha="0.7"/>
<hotspot name="fp_1" style="floor_plan_style" ath="0" atv="0" url="floor_plan.jpg" onclick="js(pvrPlayer.fire('f_click'))"/>
If it is 'true', it calls the js, and I may know that the floor_plan is clicked even in vr mode.
But in this case, since it is big hotspot, it doesnt let me change view, i always have to use out of it for moving.
This is one more issue I got now *smile* .

And Sorry, currently I don't have online demo link.

Thank you very much for your help.

Mudin