You are not logged in.

  • "360gradenfotografie" started this thread

Posts: 71

Location: Tilburg, The Netherlands

  • Send private message

1

Wednesday, April 15th 2020, 7:59pm

Fetch ath/atv of pointing direction VR controller

With mouse and touch events it's easy to fetch clicks anywhere on the canvas and convert to ath/atv:

Source code

1
2
3
4
5
<events name="click" keep="true" onclick="on_click()" />

<action name="on_click">
  screentosphere(mouse.x,mouse.y,click_ath,click_atv);
</action>


Now, I would like to do the same with VR controllers. Is that possible?

  • "360gradenfotografie" started this thread

Posts: 71

Location: Tilburg, The Netherlands

  • Send private message

2

Wednesday, April 15th 2020, 9:30pm

Figured it out! The following code puts a hotspot on the location the VR controller clicked.

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<events name="click" keep="true" webvr_onvrcontrollerbutton="vrclick();" />
		
<action name="vrclick" scope="local">
	if(!caller.target,

		if(caller.vrbuttonstate == 'down',

			addhotspot(auto, hs);
			spacetosphere(caller.dx,caller.dy,caller.dz, hs.ath,hs.atv,depth);
			set(hs, keep=true, scale=0.01, distorted=true, enabled=false, capture=false, alpha=1, autoalpha=true, depth=off,
				onloaded='tween(alpha,0);tween(scale,.4)', url='%CURRENTXML%/graphics/click.png'
			);
			
		);

	);
</action>

Tuur

Sage

Posts: 3,839

Location: Netherlands

Occupation: Krpano custom coding / Virtual Tours / Photography / Musician / Recording engineer

  • Send private message

3

Wednesday, April 15th 2020, 9:54pm

Hi,

Nice you found it so quick.
Didn't use spacetosphere yet.
Thought about something like this, but didn't yet tried.
Thanks for sharing!

Tuur *thumbsup*

Scott Witte

Intermediate

Posts: 382

Location: Milwaukee, WI USA

Occupation: Professional Photographer

  • Send private message

4

Thursday, April 16th 2020, 6:05am

I echo the thanks for sharing! This could be useful.