View Single Post
  #2  
Old 05-20-2009, 09:13 AM
farshizzo farshizzo is offline
WorldViz Team Member
 
Join Date: Mar 2003
Posts: 2,849
Here is some code that uses the arrow keys on the wiimote to change the position of an object:
Code:
MOVE_SPEED = 5 # meters/sec

def WiiMove():
	
	elapsed = viz.elapsed()

	state = wiimote.state

	if state & wii.BUTTON_LEFT:
		caveorigin.setPosition([-MOVE_SPEED*elapsed,0,0],viz.REL_LOCAL)
	if state & wii.BUTTON_RIGHT:
		caveorigin.setPosition([MOVE_SPEED*elapsed,0,0],viz.REL_LOCAL)
	if state & wii.BUTTON_UP:
		caveorigin.setPosition([0,0,MOVE_SPEED*elapsed],viz.REL_LOCAL)
	if state & wii.BUTTON_DOWN:
		caveorigin.setPosition([0,0,-MOVE_SPEED*elapsed],viz.REL_LOCAL)
vizact.ontimer(0, WiiMove)
Let me know if this doesn't do what you want.
Reply With Quote