WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 02-23-2004, 11:34 AM
Plasma Plasma is offline
Member
 
Join Date: Jan 2004
Posts: 22
Thanks for your help! Here's the program:

#Trial 08 - 2-1B
import sid
import viz
import math
viz.go()

a = 0
b = 0
c = 0

#Add the intersense tracker
tracker = viz.addsensor('intersense')
viz.tracker()
tracker.reset()

#Turn off the mouse cursor
viz.cursor(0)

#Add the objects

viz.add('08hw21b.wrl')

viz.sensitivity(10.0,0.5) #For Participants
#viz.sensitivity(100.0,0.5) #For Development

viz.collision(viz.ON)
viz.gravity(0.0)

#Make the headlight omnidirectional
headlight = viz.get(viz.HEAD_LIGHT)
headlight.position(0,0,0,1)

#Triple the intensity of the headlight
headlight.intensity(3)

#Add the crosshair
crosshair = viz.add(viz.TEXQUAD,viz.SCREEN)
crosshair.texture(viz.add('crosshair.tif'))
crosshair.translate(0.5,0.5)

#Add joystick navigation
def joysticktimer(num):
data = sid.get()[2]
y = sid.get()[1]
if math.fabs(y) > 0.2:
viz.move(0,0,-y*0.9)

#Get the head position
pos = viz.get(viz.HEAD_POS)

#Get the yaw of the viewer
yaw = viz.get(viz.VIEW_YAW)

#Snap back to the home position on S key press
def snapback(key):
if key == 's':
viz.reset(viz.HEAD_ORI|viz.BODY_ORI|viz.HEAD_POS)
viz.translate(viz.HEAD_POS,0.875,1.82,569.5) #Home Position 1
viz.callback(viz.KEYBOARD_EVENT,snapback)

#Print data on trigger pull
buttons = sid.buttons()
if buttons & 1:
print yaw,pos

#Print yaw and positional information constantly in terminal window
#print yaw,pos

viz.eyeheight(1.82)
viz.callback(viz.TIMER_EVENT,joysticktimer)
viz.starttimer(0,0.001,viz.FOREVER)
Reply With Quote
 


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 07:21 AM.


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