WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
Old 10-20-2007, 02:43 PM
Vinicius Lima Vinicius Lima is offline
Join Date: Jul 2007
Posts: 40
Joystick Navigation


I am trying to use a joystick to navigate in interior spaces. So, I would like to be able to look up and down at the ceiling and floor and so far, my script is not doing that. I pasted the script I am using here and if I could get the information I am missing it would be great.



import viz
import vizjoy

#Add a ground model

#Add a joystick
joy = vizjoy.add()

def UpdateJoystick():
#Get the joystick position
x,y,z = joy.getPosition()
#Get the twist of the joystick
twist = joy.getTwist()
#Move the viewpoint forward/backward based on y-axis value
if abs(y) > 0.2: #Make sure value is above a certain threshold
#Move the viewpoint left/right based on x-axis value
if abs(x) > 0.2: #Make sure value is above a certain threshold
#Turn the viewpoint left/right based on twist value
if abs(twist) > 0.2: #Make sure value is above a certain threshold
viz.MainView.rotate(0,1,0,twist,viz.BODY_ORI,viz.R ELATIVE_WORLD)

#UpdateJoystick every frame

#Register a callback for joystick button events
def onjoybutton(e):
print 'Joystick button',e.button,'pressed'
Reply With Quote

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 02:36 PM.

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