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.

1

Saturday, October 19th 2019, 4:24pm

Compass layer

HI,

I have a compass copied from krpano example with minor mods:


Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<!-- compass background layer -->
<layer name="compass1" 
url="compass_bg.png" align="rightbottom" x="10" y="10" keep="true" 
children="false" scalechildren="true" destscale="1.0" 
onclick="switch(destscale,1.0,0.5);tween(scale,get(destscale));">

<!-- compass plate -->
<layer name="compass1_plate" url="buscard.png" align="center" zorder="1" /> 

<!-- compass pointer -->
<layer name="compass1_pointer" url="agocor.png" align="center" zorder="2" />

	</layer>
	
	<!-- view changing event -->
	<events name="compass_events" onviewchange="compass_update_rotate();" />

	<!-- update the rotation values -->
	
<action name="compass_update_rotate">
set(global_heading, 180);
calc(layer[compass1_pointer].rotate, view.hlookat - global_heading);
</action>



The compass pointer does not rotate on viewchange.

Am I missing something?

Thank you for any help.

Giuseppe

spacerywirtualne

Professional

Posts: 912

Location: Poland, Europe

Occupation: krpano developer : virtual tours

  • Send private message

2

Saturday, October 19th 2019, 11:01pm

<events name="compass_events" keep="true" onviewchange="compass_update_rotate();" />


Check what happens if you add the green code.


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

facebook page :: youtube

cms4vr team *thumbsup*

3

Sunday, October 20th 2019, 8:13pm

Piotr,
It works: thank you very much!
Best regards,

Giuseppe