You are not logged in.

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

1

Wednesday, April 6th 2011, 6:43pm

Directional hotspot

I know we have directional sound but is it possible to apply this to a hotspot image?
Example: I have a hotspot image in a pano that I want to alpha fade to 0.1 as the user pans towards it and fades back in as the user moves away from it.
It would also be nice if it faded back in after about 5 seconds on an 'onidle' action.

If anyone can point me in the direction of an example or of a basic source code for this I'll be very grateful.

Thanks.

VN2011

Professional

Posts: 1,336

Location: Duluth MN

  • Send private message

2

Wednesday, April 6th 2011, 6:47pm

something like this? this was a test i did last year the panos appear and dispear as you approach the windows to display the view.

http://www.virtualnorthland.com/panos/wells/1.html

<events onviewchange="show_hotspots_in_range()" />

<action name="show_hotspots_in_range">
set(i,0);
loop_hotspots(0);
</action>

<action name="loop_hotspots">
test_hotspot_in_range(get(hotspot[%1].name));
inc(i);
if (i LT hotspot.count, loop_hotspots( get(i) ) );
</action>

<action name="test_hotspot_in_range">
sub(hdistance, view.hlookat, hotspot[%1].ath);
mod(hdistance,hdistance,360);
if(hdistance GT 180, sub(hdistance,hdistance,360));
if(hdistance LT -180, add(hdistance,hdistance,360));
sub(vdistance, view.vlookat, hotspot[%1].atv);
mod(vdistance,vdistance,360);
if(vdistance GT 180, sub(vdistance,vdistance,360));
if(vdistance LT -180, add(vdistance,vdistance,360));
if(hdistance LT 0, mul(hdistance,hdistance,-1));
if(vdistance LT 0, mul(vdistance,vdistance,-1));
if(hdistance GT 40, set(hdistance,40) );
if(vdistance GT 40, set(vdistance,40) );
div(hdistance,hdistance,40);
div(vdistance,vdistance,40);
add(distance2,hdistance,vdistance);
sub(hotspot[%1].alpha,1.0,distance2);
if(hotspot[%1].alpha LT 0.0, set(hotspot[%1].alpha,0.0) );
</action>

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

3

Wednesday, April 6th 2011, 7:26pm

Thanks VN, that's exactly what I'm looking for *thumbup*
Except in reverse.... I need the hotspot to dissapear when looking at it.
I've tried reversing the alpha values in the action but it's obviously a little more complex than that.

This post has been edited 1 times, last edit by "Kev-in-spain" (Apr 6th 2011, 7:57pm)


michel

Professional

Posts: 1,153

Location: ANDORRA

Occupation: TV

  • Send private message

4

Thursday, April 7th 2011, 4:53pm

Hi Kev-in-spain,

Here a thread about your request:
appear fadein/fadeout POV driven

Quoted

Except in reverse....
Here a modified code:

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<krpano version="1.0.8">
	
	<preview type="grid(cube,32,32,256,0x000000,0x778899,0x000000);" details="8" />

	<events onviewchange="show_hotspots_in_range()" />

	<action name="show_hotspots_in_range">
		set(i,0);
		loop_hotspots(0);
	</action>

	<action name="loop_hotspots">
		test_hotspot_in_range(get(hotspot[%1].name));
		inc(i);
		if (i LT hotspot.count, loop_hotspots( get(i) ) );
	</action>

	<action name="test_hotspot_in_range">
		sub(hdistance, view.hlookat, hotspot[%1].ath);
		mod(hdistance,hdistance,360);
		if(hdistance GT 180, sub(hdistance,hdistance,360));
		if(hdistance LT -180, add(hdistance,hdistance,360));
		sub(vdistance, view.vlookat, hotspot[%1].atv);
		mod(vdistance,vdistance,360);
		if(vdistance GT 180, sub(vdistance,vdistance,360));
		if(vdistance LT -180, add(vdistance,vdistance,360));
		if(hdistance LT 0, mul(hdistance,hdistance,-1));
		if(vdistance LT 0, mul(vdistance,vdistance,-1));
		if(hdistance GT 50, set(hdistance,50) );
		if(vdistance GT 50, set(vdistance,50) );
		div(hdistance,hdistance,50);
		div(vdistance,vdistance,50);
		add(distance2,hdistance,vdistance);
		sub(distance2,0.3);
		mul(distance2,2);
		add(hotspot[%1].alpha,0,distance2);
	</action>

	<hotspot name="hs1"
			 keep="false"
			 visible="true" enabled="true" handcursor="true" capture="true" children="true"
			 zorder="0"
			 fillcolor 	="0xbbbbbb" fillalpha 	="1" borderwidth 	="2.0" bordercolor 	="0xffffff" borderalpha 	="0.50"
			 fillcolorhover="0xffffff" fillalphahover="1" borderwidthhover="4.0" bordercolorhover="0xffffff" borderalphahover="0.80"
			 fadeintime="0.150" fadeouttime="0.300" fadeincurve="1.100" fadeoutcurve="0.700"
			 onover=""
			 onhover="set(hotspot[hs1].alpha,1)"
			 onout="action(show_hotspots_in_range);"
			 ondown=""
			 onup=""
			 onclick=""
			 flying="0"
			 ath="0"
			 atv="0"
		>
		<point ath="-10" atv="-10" />
		<point ath="-10" atv="10" />
		<point ath="10" atv=" 10" />
		<point ath="10" atv="-10" />
	</hotspot>

</krpano>


Hope this help....

SAlut.

Me debes una cerveza... *smile*

Kev-in-spain

Intermediate

  • "Kev-in-spain" started this thread

Posts: 152

Location: Barcelona

Occupation: VR Photographer

  • Send private message

5

Friday, April 8th 2011, 4:49pm

Thanks Michel, that works a treat.

Here's what it was for: http://www.projectsolutions.es/demos/hyundai/i30/tour.html
Spin round 180º and the head restraint fades.
Also, there are 3 example hotspots for more info on certain areas. They all work fine on my desktop but on the iphone only one will perfom it's function and it will only work once until the pano is reloaded.
Any idea why that would happen?
Me debes una cerveza... *smile*
Yep.... I've only been a member of the forum for a few weeks and I'm accumulating quite a 'beer dept' already!
All I can say is, Si alguna vez estás aquí en España... mi nevera es su nevera! *thumbup*

Gracias