WorldViz User Forum orientation question
 Register FAQ Search Today's Posts Mark Forums Read

#1
01-19-2009, 04:27 PM
 whj Member Join Date: Apr 2008 Posts: 60
orientation question

Hello,

Generally I have two ways to control orientation. One is to turn the viewpoint with head, the code would be like:

rot_data = ppt.getEuler()

In this way, the direction I can see is also my moving direction.

The other is to turn the viewpoint with twist value of joystick, the code would be like:
if abs(joy_rot) > 0.2:
angle = ANIMATE_RATE * TURN_SPEED * joy_rot
viz.MainView.rotate(0, 1, 0, angle, viz.HEAD_ORI, viz.RELATIVE_WORLD)

In this way, I can not change orientation by rotating my head.

So my question is, is there any way that I can use the twist value of joystick to control the walking direction while I can still change orientation by rotating my head. In other words, I can use joystick to control navigation while feel free to look around.

Thanks!
#2
01-19-2009, 05:56 PM
 whj Member Join Date: Apr 2008 Posts: 60
I'm not sure if I make it clear. To solve this problem, I'm looking for a way to turn off the connection between the head orientation and the moving direction. The moving direction is controlled by only joystick.
#3
01-20-2009, 11:15 AM
 whj Member Join Date: Apr 2008 Posts: 60
Basically I want to look around with HMD and move with joystick independently at the same time. Here is what I've done. Worked a little bit and then messed up. Does anybody know how to correct my code? Thanks a lot.

def mytimer(num):
global joy_pos, joy_rot

## Control orientation
rot_data = ppt.getEuler()

if abs(joy_rot) > 0.2:
angle = joy_rot*TURN_SPEED*viz.elapsed()
viz.MainView.rotate(0, 1, 0, angle, viz.BODY_ORI, viz.RELATIVE_WORLD)

## Control position
if abs(joy_pos[0]) > 0.25:
viz.MainView.move(joy_pos[0]*WALK_SPEED*viz.elapsed(), 0, 0, viz.BODY_ORI)
if abs(joy_pos[1]) > 0.25:
viz.MainView.move(0, 0, -joy_pos[1]*WALK_SPEED*viz.elapsed(), viz.BODY_ORI)
#4
01-21-2009, 12:22 PM
 farshizzo WorldViz Team Member Join Date: Mar 2003 Posts: 2,849
Have a look at the Viewpoint control tutorial in the docs. It describes how to accomplish what you want. Basically, you would apply the joystick data to body orientation of the viewpoint and the HMD data to the head orientation. When you want to move the viewpoint, you just specify that you want to move relative to the body orientation.

 Thread Tools Display Modes Rate This Thread Linear Mode Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements Vizard Precision Position Tracker (PPT) Plug-in development

 Similar Threads Thread Thread Starter Forum Replies Last Post dan12345 Vizard 1 01-15-2008 11:15 AM TunTun Vizard 2 05-23-2007 01:46 PM astull Vizard 16 02-22-2007 10:45 AM jargon Vizard 2 05-14-2005 05:55 PM shai Vizard 2 10-27-2004 11:55 AM

All times are GMT -7. The time now is 06:04 AM.