mirror of
https://forge.apps.education.fr/blender-edutech/blender-edutech-tutoriels.git
synced 2024-01-27 09:42:33 +01:00
Supression du joystick USB
This commit is contained in:
parent
b7e2ccbd4b
commit
7124771214
@ -127,7 +127,8 @@ def victoire_fermer(cont):
|
||||
scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie
|
||||
|
||||
###############################################################################
|
||||
# Gestion du Joystick
|
||||
# Gestion du Joystick (Joystick USB)
|
||||
# Partie non abordée dans le tutoriel
|
||||
###############################################################################
|
||||
|
||||
def joystick(cont):
|
||||
|
@ -204,40 +204,3 @@ def victoire_fermer(cont):
|
||||
scene.objects['Panneau victoire'].setVisible(False,True) # Cacher le panneau de la victoire
|
||||
scene.objects['Panneau victoire - plan'].suspendPhysics (True) # Suspendre la physique du panneau cliquable
|
||||
scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie
|
||||
|
||||
###############################################################################
|
||||
# Gestion du Joystick USB
|
||||
###############################################################################
|
||||
|
||||
def joystick(cont):
|
||||
obj = cont.owner
|
||||
joystickIndex = 0 #int from 0 to 6
|
||||
joy = bge.logic.joysticks[joystickIndex]
|
||||
events = joy.activeButtons
|
||||
axis = joy.axisValues[0:4]
|
||||
resolution = 0.01
|
||||
|
||||
leftStick_x = axis[0]; leftStick_y = axis[1]
|
||||
rightStick_x = axis[2]; rightStick_y = axis[3]
|
||||
|
||||
#if any button is pressed
|
||||
# if events:
|
||||
# print(events) #spit out integer index of pressed buttons
|
||||
# if 0 in events:
|
||||
# doSomething()
|
||||
|
||||
# Up
|
||||
if leftStick_y <-0.1 :
|
||||
obj.applyRotation((-resolution,0,0), False)
|
||||
|
||||
# Down
|
||||
if leftStick_y >0.1 :
|
||||
obj.applyRotation((resolution,0,0), False)
|
||||
|
||||
# Left
|
||||
if leftStick_x <-0.1 :
|
||||
obj.applyRotation((0, -resolution,0), False)
|
||||
|
||||
# Right
|
||||
if leftStick_x >0.1 :
|
||||
obj.applyRotation((0, resolution,0), False)
|
||||
|
@ -234,40 +234,3 @@ def victoire_fermer(cont):
|
||||
serial_msg_out = "90\n" # Afficher image de début (flèches) sur la matrice de leds
|
||||
serial_comm.write(serial_msg_out.encode())
|
||||
# scene.objects['Bille']['z']= -21 # On provoque le redémarrage si la bille est ressortie
|
||||
|
||||
###############################################################################
|
||||
# Gestion du Joystick USB
|
||||
###############################################################################
|
||||
|
||||
def joystick(cont):
|
||||
obj = cont.owner
|
||||
joystickIndex = 0 #int from 0 to 6
|
||||
joy = bge.logic.joysticks[joystickIndex]
|
||||
events = joy.activeButtons
|
||||
axis = joy.axisValues[0:4]
|
||||
resolution = 0.01
|
||||
|
||||
leftStick_x = axis[0]; leftStick_y = axis[1]
|
||||
rightStick_x = axis[2]; rightStick_y = axis[3]
|
||||
|
||||
#if any button is pressed
|
||||
# if events:
|
||||
# print(events) #spit out integer index of pressed buttons
|
||||
# if 0 in events:
|
||||
# doSomething()
|
||||
|
||||
# Up
|
||||
if leftStick_y <-0.1 :
|
||||
obj.applyRotation((-resolution,0,0), False)
|
||||
|
||||
# Down
|
||||
if leftStick_y >0.1 :
|
||||
obj.applyRotation((resolution,0,0), False)
|
||||
|
||||
# Left
|
||||
if leftStick_x <-0.1 :
|
||||
obj.applyRotation((0, -resolution,0), False)
|
||||
|
||||
# Right
|
||||
if leftStick_x >0.1 :
|
||||
obj.applyRotation((0, resolution,0), False)
|
||||
|
Loading…
Reference in New Issue
Block a user