Sie sind nicht angemeldet.

1

Mittwoch, 15. April 2020, 19:59

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:

Quellcode

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?

2

Mittwoch, 15. April 2020, 21:30

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

Quellcode

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

Erleuchteter

Beiträge: 3 839

Wohnort: Netherlands

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

  • Nachricht senden

3

Mittwoch, 15. April 2020, 21:54

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

Fortgeschrittener

Beiträge: 382

Wohnort: Milwaukee, WI USA

Beruf: Professional Photographer

  • Nachricht senden

4

Donnerstag, 16. April 2020, 06:05

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

Ähnliche Themen