View Single Post
Old 01-20-2009, 10:15 AM
whj whj is offline
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)
Reply With Quote