WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rating: Thread Rating: 8 votes, 5.00 average. Display Modes
  #1  
Old 08-31-2007, 07:24 AM
Elittdogg Elittdogg is offline
Member
 
Join Date: Aug 2007
Posts: 77
Question Head motion tracking/Viewpoint

I'm very stuck stuck right now, so any help would be greatly appreciated.

Basically, I need to be able to get the program to display an image of a wall and while using FOB (Flock of Birds) to track head movement, I need the viewpoint to change along with the head movement. In other words, if I'm looking at the center of the wall and I need to look at the top left corner, I need to figure out how to get the viewpoint to change with my head movement.

So far this is what I have:

import viz

tex1 = viz.add('wall.jpg')
quad = viz.add(viz.TEXQUAD)
quad.translate(0,1,8)
quad.scale(12.8, 10.24)
quad.texture(tex1)

...

viz.reset(viz.HEAD_POS|viz.HEAD_ORI)
viz.translate(viz.HEAD_POS,data1[0],data1[1],data1[2])
viz.rotate(viz.HEAD_ORI,data1[5], (data1[4]+90) ,data1[3])

The problem is two-fold. When I run this, the picture looks like it's "tumbling" everywhere. Additionally, I also need to figure out how to program in an "inversion" to the tracking system. (Eg. So that when something comes in "physically" from the right field of view it looks as if it were coming from the left field of view and as if it were inverted). Do I just put a negative sign somewhere to flip it?

Any help would be appreciated. Thank you.
Reply With Quote
  #2  
Old 08-31-2007, 11:47 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is some code that will manually apply tracking data to the viewpoint:
Code:
view = viz.get(viz.MAIN_VIEWPOINT)
def mytimer(num):
	data = sensor.get()

	view.translate(data[0],data[1]+1,data[2])
	view.rotate(data[3],data[4],data[5])
	
viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0,viz.FOREVER)
If it still doesn't work, then you might have a problem with your hardware.

If you want to invert the left/right movement then negate the yaw component of the rotation data. So the above rotation command would look like the following:
Code:
view.rotate(-data[3],data[4],data[5])
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


All times are GMT -7. The time now is 08:36 AM.


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