WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-09-2016, 09:10 AM
cly3d cly3d is offline
Member
 
Join Date: Feb 2014
Posts: 4
Reticle cursor for Oculus - how do I create it?

Hey all,
I'm back to looking into Vizard and seeing if it might be a better fit for a project than Unity - the reason is a large point cloud, which Openscenegraph probably handles better.

Anyway... I'm completely not good at Python, but have managed quite a bit from cutting and pasting bits from the example scripts to get things working. (adding joystick movement to the Rift demo for exanple)

However, what I want to do is:
- Can I attach the built-in cross hair from the Duck demo, to the Oculus rift, such that it shows where you are 'looking at'

- And, similar to many Google Cardboard demos... a wait to click, where the crosshair simulates a mousedown (click) on an object if the person gazes at the object for about 1.5 seconds.

I'd appreciate some help on this.
Best Regards
Reply With Quote
  #2  
Old 04-11-2016, 07:35 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
You can set the reference frame of the crosshair to viz.RF_VIEW:

Code:
crosshair = viz.addTexQuad(texture=viz.add('crosshair.png'),pos=[0,0,3],scale=[0.5]*3)
crosshair.setReferenceFrame(viz.RF_VIEW)
I'll post a simple example soon that uses the pick command to track the objects looked at.
Reply With Quote
  #3  
Old 04-11-2016, 03:36 PM
cly3d cly3d is offline
Member
 
Join Date: Feb 2014
Posts: 4
Thankyou for replying Jeff.
I'll add these two lines of code and see how things go, this evening.

An example of picking on gaze would be great to have.
Best Regards.
Reply With Quote
  #4  
Old 04-12-2016, 10:02 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
The following example has the crosshair fixed to the center of the screen. If were using an eye tracker the crosshair should follow the eye movements instead:

Code:
import viz
import vizact

viz.go()

GAZE_TIME_EVENT = viz.getEventID('GAZE_TIME_EVENT')

viz.clearcolor(viz.SLATE)

soccerball = viz.addChild('soccerball.osgb',pos=[-1,1.8,2])
basketball = viz.addChild('basketball.osgb',pos=[0,1.8,2])
volleyball = viz.addChild('volleyball.osgb',pos=[1,1.8,2])

crosshair = viz.addTexQuad(texture=viz.add('crosshair.png'),pos=[0,0,3],scale=[0.5]*3)
crosshair.setReferenceFrame(viz.RF_VIEW)
crosshair.disable(viz.DEPTH_TEST)
crosshair.drawOrder(10)

class GazeTime(viz.EventClass):

	def __init__(self,gazeTime=1.5):
		
		viz.EventClass.__init__(self)
		self.gazeTime = gazeTime
		self.gazeObject = None
		self.startTime = 0
		self.callback(viz.UPDATE_EVENT,self.checkGazeTime) 

	def checkGazeTime(self,e):

		node = viz.pick(pos=[0.5,0.5])
		if node != self.gazeObject:
			self.gazeObject = node
			self.startTime = viz.tick()
			print 'started looking at', self.gazeObject
			
		else:
			time = viz.tick() - self.startTime
			if time > self.gazeTime:
				viz.sendEvent(GAZE_TIME_EVENT, self.gazeObject)
				self.startTime = viz.tick()

GazeTime()

def onGazeTime(gazeObject):
	if gazeObject == soccerball:
		print 'gaze fixed on soccerball for 1.5 seconds'
	elif gazeObject == basketball:
		print 'gaze fixed on basketball for 1.5 seconds'
	elif gazeObject == volleyball:
		print 'gaze fixed on volleyball for 1.5 seconds'
	
viz.callback(GAZE_TIME_EVENT,onGazeTime)
Reply With Quote
Reply

Tags
gaze behavior, oculus, oculus rift, reticle


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Create object with position relative to user head, but cannot be obstructed by others Notch Vizard 2 03-03-2014 07:16 AM
Create a clipping box pswaney Vizard 1 03-01-2013 12:19 PM
how to create and use CFG files shahramy Vizard 0 05-05-2010 01:47 AM
Create Button or Text Chrissy2009 Vizard 1 07-15-2009 05:34 PM
How to create a sky? guxmy01 Vizard 1 05-28-2008 12:07 PM


All times are GMT -7. The time now is 09:23 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC