View Single Post
  #2  
Old 09-10-2016, 02:09 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,466
If both controllers are connected, try the following:

Code:
rightController = steamvr.getControllerList()[0]
leftController = steamvr.getControllerList()[1]

def printData():
	print 'pos right:',rightController.getPosition()
	print 'pos left :',leftController.getPosition()
	
vizact.onupdate(0,printData)
However, I would recommend using vizconnect to connect to the Vive in Vizard. In the preset configuration list there is a 'HTC Vive' option. That connects to all hardware and renders a hand for each controller. The transport allows you to navigate using the controller track pad. You can also get the controller position in your own script:

Code:
rightTracker = vizconnect.getTracker('r_hand_tracker').getRaw()
leftTracker = vizconnect.getTracker('l_hand_tracker').getRaw()

def printData():
	print 'pos right:',rightTracker.getPosition()
	print 'pos left :',leftTracker.getPosition()
	
vizact.onupdate(0,printData)
Reply With Quote