You are not logged in.

1

Wednesday, June 21st 2017, 8:05pm

Tired with spheretoscreen. Need help!

Hi! Urgently pls!

look at this:

Source code

1
2
3
4
5
6
7
8
9
<action name="qqq">
addhotspot(tempspot);
set(hotspot[tempspot].ath, view.hlookat);
set(hotspot[tempspot].atv, view.vlookat);
showlog();
spheretoscreen(view.hlookat, view.vlookat, x, y);
trace(x);
spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);
trace(x);</action>



return after call:

Source code

1
2
INFO: 640.0000098550727
INFO: NaN



WHY???????? *cursing*

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

3

Wednesday, June 21st 2017, 9:07pm

First, use the correct syntax.

not

set(hotspot[tempspot].ath, view.hlookat);
set(hotspot[tempspot].atv, view.vlookat);


but

copy(hotspot[tempspot].ath, view.hlookat);
copy(hotspot[tempspot].atv, view.vlookat);



Source code

1
2
3
4
5
6
7
8
9
<action name="qqq">
addhotspot(tempspot);
copy(hotspot[tempspot].ath, view.hlookat);
copy(hotspot[tempspot].atv, view.vlookat);
showlog();
spheretoscreen(view.hlookat, view.vlookat, x, y);
trace('x: ',get(x));
spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);
trace('x: ',get(x));</action>




Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

4

Wednesday, June 21st 2017, 10:35pm

Thanks! You are right

Can you please help me with something like this:

Source code

1
2
3
4
5
6
7
8
9
<action name="qqq">
addhotspot(tempspot);
set(hotspot[tempspot].ath, %1);
set(hotspot[tempspot].atv, %2);
showlog();
spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);
trace('x: ',get(x));

</action>


passing arguments are numbers.

jordi

Professional

Posts: 583

Location: Barcelona

Occupation: creating ideas & coding them

  • Send private message

5

Thursday, June 22nd 2017, 8:26am

You just need to call the action like this

Source code

1
qqq(10, 20); 


then this 10 and 20 will be the %1 and %2 in your action

you don't need to make

Source code

1
trace('x: ',get(x));

just

Source code

1
trace('x: ',x);
everpano.com step beyond 360

6

Thursday, June 22nd 2017, 8:49am

trace() here is just for debugging
looks like spheretoscreen(h,v,x,y) return correct values ONLY when h and v are undocumented 'coordinates' type variables
if they are 'Number' type then x and y is NaN





Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

7

Thursday, June 22nd 2017, 9:38am

hi)

Documentation says:

Notes:
  • The x,y,h,v parameters must be variable names, using values is not possible!


Read here: https://krpano.com/docu/actions/#screentosphere
Regards,

Alexey

spacerywirtualne

Professional

Posts: 1,117

Location: Poland, Europe

Occupation: krpano developer : virtual tours : the cms4vr owner

  • Send private message

8

Thursday, June 22nd 2017, 11:25am

you don't need to make


Source code
1
trace('x: ',get(x));

just

Source code
1
trace('x: ',x);
Sometimes yes and sometimes not... With GET is safety.

Best regards
Piotr
Your own professional, online cloud tool for creating virtual tours - www.cms4vr.com

facebook page :: youtube :: wiki.cms4vr.com

cms4vr team *thumbsup*

9

Thursday, June 22nd 2017, 11:39am

Alexey Tkachenko, I read it and know it!

please answer me what is wrong with example in the my post at Yesterday, 10:35pm

I have list of coordinates wich I created manually and they can not be copied from somewhere else

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

10

Thursday, June 22nd 2017, 11:52am

This code works fine for me:

Source code

1
addhotspot(tempspot);		set(hotspot[tempspot].url, 'skin/vtourskin_hotspot.png');		copy(hotspot[tempspot].ath, view.hlookat);		copy(hotspot[tempspot].atv, view.vlookat);		showlog();		spheretoscreen(view.hlookat, view.vlookat, x, y);		trace(x);		spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);		trace(x);



Both traces return 640.

seems that the hotspot needs some url to be defined.

EDIT: this code works also:

Source code

1
addhotspot(tempspot);				copy(hotspot[tempspot].ath, view.hlookat);		copy(hotspot[tempspot].atv, view.vlookat);		showlog();		spheretoscreen(view.hlookat, view.vlookat, x, y);		trace(x);		spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);		trace(x);



So url doesn't matter here...
Regards,

Alexey

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

11

Thursday, June 22nd 2017, 11:59am

okay, now it's clear: if the hotspot is out of view, then spheretoscreen will return Nan:

In this case I got Nan (view.hlookat was 0 at tour startup):

Source code

1
addhotspot(tempspot);	set(hotspot[tempspot].ath, -90);	copy(hotspot[tempspot].atv, view.vlookat);	showlog();	spheretoscreen(view.hlookat, view.vlookat, x, y);	trace(x);	spheretoscreen(hotspot[tempspot].ath, hotspot[tempspot].atv, x, y);	trace(x);
Regards,

Alexey

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

12

Thursday, June 22nd 2017, 12:02pm

I also remember this thread: https://krpano.com/forum/wbb/index.php?p…53966#post53966

Maybe it will help somehow or make things clear with spheretoscreen.
Regards,

Alexey

13

Thursday, June 22nd 2017, 5:22pm

to be sure that coordinates are not out of view


Source code

1
2
3
4
5
6
7
8
9
10
<events onclick="qqq();" />
<action name="qqq">
showlog();
set(hhh, view.hlookat);
set(vvv, view.vlookat);
spheretoscreen(view.hlookat, view.vlookat, x, y);
trace(x);
spheretoscreen(hhh, vvv, x, y);
trace(x);
</action>



return

Source code

1
2
INFO: 640.0000006207051
INFO: NaN

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

14

Friday, June 23rd 2017, 8:43am

Your code is wrong.

You may eiher use

Source code

1
copy(hhh, view.hlookat);		copy(vvv, view.vlookat);



or

Source code

1
set(hhh, get(view.hlookat));



In this case your code works , I've just tested.
Regards,

Alexey

15

Friday, June 23rd 2017, 12:07pm

Алексей, спасибо огромное, попробовал! да, такие примеры работают. тут сказывается недостаток моей квалификации в krpano ((

Но моя проблем в том, что я не могу взять (get) или скопировать (copy) значение переменной типа хотспотовских atv, ath или view.hlookat и view.vlookat

Попробую объяснить подробнее

У панорамы есть активные зоны. Каждая такая зона представлена парой
значений, описывающих сферические координаты ее центра (hhh и vvv). При вращении панорамы используем getlooktodistance чтобы вычислить расстояния от направления просмотра панорамы до активных зон (используем для определения hhh, vvv, view.hlookat и
view.vlookat). Поворачиваемся в сторону активной зоны, определяем, что она находится в допустимом
радиусе (направление просмотра панорамы
находится в пределах допустимого радиуса вокруг центра зоны), а вот в этом месте как раз необходимо при помощи spheretoscreen по значениям hhh и vvv определить координаты центра активной зоны на экране!!! А оно не работает ни с spheretoscreen(hhh,vvv,xxx,yyy) ни с spheretoscreen(get(hhh),get(vvv),xxx,yyy)!

единственное что пришло на ум - это использовать "заплатку" в виде создания хотспота, но тут уже смотрите начало моего поста))) сейчас попробую этот вариант и отпишусь дополнительно. Но как бы было хорошо не использовать такие заплатки

тяжко изъясняться на ломанном английском )

Alexey Tkachenko

Professional

Posts: 770

Location: Russian Federation

Occupation: Interpreting, Building virtual tours

  • Send private message

16

Friday, June 23rd 2017, 1:23pm

примерно понятна суть, но удобнее разбираться на конкретном примере. Если что, можно в ЛС писать.
Regards,

Alexey

17

Friday, June 23rd 2017, 2:00pm

все! сделал! спасибо!!!!

мне потребовалось выводить HTML блок средствами jquery поверх панорамы.
конкретно в JS работает такая конструкция

Source code

1
2
3
krpano.set("hhh", $(this).attr('hlookat'));
krpano.set("vvv", $(this).attr('vlookat'));
krpano.call("spheretoscreen(hhh, vvv, xxx, yyy);");


ну и далее krpano.get("yyy") и krpano.get("xxx") возвращают правильные значения!

внутри action работает следующее

Source code

1
2
3
4
5
6
7
<action name="qqq3">
showlog();
set(hhh, 50);
set(vvv, 50);
lookat(get(hhh), get(vvv));
delayedcall(1, spheretoscreen(hhh, vvv, x, y); trace('x: ', x););
</action>


задержка здесь для того чтобы lookat успел устаканиться

спасибо за то что еще раз напомнили про copy и get :)

This post has been edited 2 times, last edit by "sblack" (Jun 23rd 2017, 2:31pm)