WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 10-30-2016, 05:30 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
viewpoint direction

Dear Jeff,
Is there a way to get participant's head direction in angles (degrees), which are not euler rotation ones, from some module or from the Oculus itself?
I'm basically trying to know the direction in degrees (not have to be degrees but i want to be able to understand there meaning) participant's are looking at and based on that i would like to know what they are looking at at the scene.

Thanks.
Reply With Quote
  #2  
Old 10-31-2016, 11:38 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
It sounds like you maybe looking for the yaw component of the euler angle. The following example shows the yaw, pitch, and roll values every frame:

Code:
import viz
import vizact
import vizinfo

viz.go()

info = vizinfo.InfoPanel('Head Ori Data')
yaw = info.addLabelItem('yaw',viz.addText(''))
pitch = info.addLabelItem('pitch',viz.addText(''))
roll = info.addLabelItem('roll',viz.addText(''))

viz.add('dojo.osgb')

def updateInfo():
	ori = viz.MainView.getEuler()
	yaw.message('{:.2f}'.format(ori[0]))
	pitch.message('{:.2f}'.format(ori[1]))
	roll.message('{:.2f}'.format(ori[2]))

vizact.onupdate(0,updateInfo)

Last edited by Jeff; 10-31-2016 at 11:43 AM.
Reply With Quote
  #3  
Old 11-01-2016, 01:49 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
Hi Jeff,
I thought that myself but in an earlier post i asked you a question regarding the yaw of the euler angles and based on that i understood that i cannot use this so i guess i have some miss understanding, so i will ask again.
I asked you this: if i'm looking on the same thing from different positions in the scene, will i get the same euler angle? your answer was no. So, if i don't get the same euler angle for specific thing in the scene, how can i be able to conclude that from different positions i'm looking at the same thing, based on yaw?

I would appreciate a clarify and thank you for your efforts to solve my issue.
Reply With Quote
  #4  
Old 11-01-2016, 05:39 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Vizard's built-in functions for determining what objects are in view include the window.pickRect command and window.pick command. You can use the viz.intersect command to see if a line segment intersects objects in the scene.

The yaw rotation of the viewpoint or tracker is not enough information to determine what object(s) are in view. You would also need the object and viewpoint positions to determine this. And if the user is looking up or down the object might be in line with their yaw rotation but not be in view. There is not a built-in function but you could probably use commands from the Python math library or Vizard's vizmat library to help do these calculations on your own. However I'm not sure why you would go this route since the pickRect and pick commands are an easy way to determine what objects are in view.

Last edited by Jeff; 11-01-2016 at 05:42 PM.
Reply With Quote
  #5  
Old 11-02-2016, 04:54 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
Dear Jeff,
Is there a way to get the nodes that in the center of the view from pick command? since it gave me an error of "object is not iterable" when trying to use this like pickRect command.

Here is a sample code:

def objectOfInterest(normPos):

picked=viz.MainWindow.pick(normPos)
for node in picked:
if node==triangle:
print "triangle view"

Thanks.
Reply With Quote
  #6  
Old 11-02-2016, 01:33 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here's an example that performs the pick command on the center of the window:

Code:
import viz
import vizact

viz.go()

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(parent=viz.SCREEN,texture=viz.add('crosshair.png'),pos=[0.5,0.5,0])

def pickObject():
	node = viz.pick(pos=[0.5,0.5])
	if node == soccerball:
		print 'soccerball'
	elif node == basketball:
		print 'basketball'
	elif node == volleyball:
		print 'volleyball'
	else:
		print 'none'
	
vizact.onupdate(0,pickObject)
Also, the gazetime example script in this thread maybe helpful.
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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
Regarding Viconnect viewpoint rajnishv Precision Position Tracker (PPT) 3 03-20-2017 11:03 PM
Regarding viewpoint with vizconfig,addFloatRangeItem&Storing viewpoint in PREFERENCES rajnishv Vizard 0 06-27-2016 03:57 AM
Draw Vector in viewpoint lookat direction Chrissy2009 Vizard 2 05-30-2009 12:50 AM
VRML Viewpoint error bstankie Vizard 1 03-11-2003 02:10 PM


All times are GMT -7. The time now is 10:37 PM.


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