View Single Post
  #3  
Old 05-14-2010, 06:12 AM
superantTTY superantTTY is offline
Member
 
Join Date: May 2010
Posts: 7
Quote:
Originally Posted by Jeff View Post
You could modify the updateCar function to use the wiimote buttons to control the car. For example, you could replace:
Code:
#Use y position of joystick to compute forward car movement
forwardMovementAmount = viz.elapsed() * MOVE_SPEED * -joyPOS[1]
car.setPosition( [ 0, 0, forwardMovementAmount], viz.REL_LOCAL )
with:
Code:
if wiimote.isButtonDown(wii.BUTTON_UP):
	forwardMovementAmount = viz.elapsed() * MOVE_SPEED
	car.setPosition( [ 0, 0, forwardMovementAmount], viz.REL_LOCAL )
I already try the code that you provide, the car can move, but something is strange...
According to "joystick_driving.py", the car can move smoothly instead of moving step by step. For example, when I press the joystick's up button or left button, it can always move forward or turn left until I release the button.
However, now I try the code you provide, it can move, but its movement is step by step. For example, when I press the wiimote's up button or left button, it can just move a small step and then stop. If I keep pressing the button, it becomes not to move!
I would like to use wiimote to make the same preference.
How can I modify it ??

Thanks for your help
Kevin
Reply With Quote