mirror of
https://forge.apps.education.fr/blender-edutech/ropy.git
synced 2024-01-27 08:23:20 +01:00
Ajout de la fonction rp_reculer()
This commit is contained in:
parent
d7f447aa77
commit
c38ceb9e9f
6
asset/nasa/poster/README.txt
Normal file
6
asset/nasa/poster/README.txt
Normal file
@ -0,0 +1,6 @@
|
||||
Poster Mars wanted : https://mars.nasa.gov/multimedia/resources/mars-posters-explorers-wanted/
|
||||
Credits : NASA/KSC
|
||||
|
||||
Poster Curiosity : https://mars.nasa.gov/resources/26910/curiosity-10th-anniversary-poster/
|
||||
Poster Perseverance : https://mars.nasa.gov/resources/24996/mars-2020-perseverance-poster/
|
||||
Credits : NASA/JPL-Caltech
|
BIN
ropy-24.blend
Normal file
BIN
ropy-24.blend
Normal file
Binary file not shown.
3
rp.py
3
rp.py
@ -308,10 +308,11 @@ def terrain_grid ():
|
||||
bpy.data.materials["Grid-Holo-Green"].node_tree.nodes["Émission"].inputs[1].default_value = 0
|
||||
scene.objects['Grid-u'].setVisible(True,True)
|
||||
scene.objects['Grid-v'].setVisible(True,True)
|
||||
rp_map.aim_show()
|
||||
scene.objects['Grid-u']['anim'] = True
|
||||
|
||||
def terrain_grid_anim ():
|
||||
rp_map.aim_show()
|
||||
print (scene.objects['Grid-u']['timer'])
|
||||
bpy.data.materials["Grid"].node_tree.nodes["Shader de mélange"].inputs[0].default_value=scene.objects['Grid-u']['timer']
|
||||
bpy.data.materials["Grid-Yellow"].node_tree.nodes["Shader de mélange"].inputs[0].default_value=scene.objects['Grid-u']['timer']
|
||||
bpy.data.materials["Grid-Green"].node_tree.nodes["Shader de mélange"].inputs[0].default_value=scene.objects['Grid-u']['timer']
|
||||
|
34
rp_cmd.py
34
rp_cmd.py
@ -22,7 +22,6 @@ from rp_lib import * # Bibliothèque Ropy
|
||||
# Fonctions
|
||||
###############################################################################
|
||||
|
||||
j=0
|
||||
|
||||
def mrp_marquer_couleur():
|
||||
global j
|
||||
@ -34,7 +33,8 @@ def mrp_marquer_couleur():
|
||||
def mrp_avancer():
|
||||
if rp_detect()==False:
|
||||
rp_avancer()
|
||||
mrp_marquer_couleur()
|
||||
rp_marquer()
|
||||
# mrp_marquer_couleur()
|
||||
|
||||
def mrp_avancer_nbpas(pas):
|
||||
for i in range (pas):
|
||||
@ -53,33 +53,15 @@ def mrp_avancer_mur_sb(): # sb = sans balise
|
||||
###############################################################################
|
||||
|
||||
def commandes():
|
||||
global j
|
||||
|
||||
a=""
|
||||
while a =="":
|
||||
a=input()
|
||||
print ("a = ", a)
|
||||
|
||||
rp_gauche()
|
||||
mrp_avancer_mur_sb()
|
||||
rp_droite()
|
||||
mrp_avancer_mur_sb()
|
||||
rp_gauche()
|
||||
mrp_avancer_mur_sb()
|
||||
rp_gauche()
|
||||
|
||||
j=0
|
||||
mrp_marquer_couleur()
|
||||
for i in range (5):
|
||||
mrp_avancer_nbpas(9)
|
||||
rp_gauche()
|
||||
mrp_avancer()
|
||||
rp_gauche()
|
||||
mrp_avancer_nbpas(9)
|
||||
rp_droite()
|
||||
mrp_avancer()
|
||||
rp_droite()
|
||||
|
||||
rp_reculer()
|
||||
rp_reculer()
|
||||
rp_reculer()
|
||||
rp_reculer()
|
||||
rp_reculer()
|
||||
|
||||
rp_fin()
|
||||
|
||||
###############################################################################
|
||||
|
@ -1,15 +1,15 @@
|
||||
<data>
|
||||
<config>
|
||||
<speed>4.0</speed>
|
||||
<sound>True</sound>
|
||||
<speed>0.25</speed>
|
||||
<sound>False</sound>
|
||||
<cam>
|
||||
<worldPosition.x>0.0057830810546875</worldPosition.x>
|
||||
<worldPosition.y>-36.409027099609375</worldPosition.y>
|
||||
<worldPosition.z>28.587913513183594</worldPosition.z>
|
||||
<worldPosition.x>-12.146218299865723</worldPosition.x>
|
||||
<worldPosition.y>-3.286367416381836</worldPosition.y>
|
||||
<worldPosition.z>5.455016613006592</worldPosition.z>
|
||||
</cam>
|
||||
</config>
|
||||
<mission>
|
||||
<current>6</current>
|
||||
<current>3</current>
|
||||
<level>6</level>
|
||||
</mission>
|
||||
<upgrade>
|
||||
|
45
rp_doc.py
45
rp_doc.py
@ -43,34 +43,35 @@ missions_card=rp_map1.get_missions_card()
|
||||
# Documentation Rover
|
||||
################################################################################
|
||||
|
||||
rover_card=["avancer-card", "tourner-card", "baliser-card", "detecter-card", "radar-card"]
|
||||
rover_card=["forward-card", "turn-card", "delineate-card", "detect-card", "radar-card"]
|
||||
rover_card=rover_card+["speed-card", "paint-card", "battery-card", "beacon-card"]
|
||||
|
||||
# Avancer
|
||||
rp_avancer_title="Avancer"
|
||||
rp_avancer_text=" rp_avancer() \n -> Avance d'un pas en avant."
|
||||
rp_avancer_type="standard"
|
||||
card_description.update({"avancer-card" : [rp_avancer_title, rp_avancer_text, rp_avancer_type]})
|
||||
rp_forward_title="Avancer"
|
||||
rp_forward_text=" rp_avancer() \n -> Avance d'un pas en avant. \n\n"
|
||||
rp_forward_text=rp_forward_text + " rp_reculer() \n -> Recule d'un pas."
|
||||
rp_forward_type="standard"
|
||||
card_description.update({"forward-card" : [rp_forward_title, rp_forward_text, rp_forward_type]})
|
||||
|
||||
# Tourner
|
||||
rp_tourner_title="Tourner"
|
||||
rp_tourner_text=" rp_gauche() \n -> Tourne à gauche (90°).\n \n"
|
||||
rp_tourner_text=rp_tourner_text + " rp_droite() \n -> Tourne à droite (90°)."
|
||||
rp_tourner_type="standard"
|
||||
card_description.update({"tourner-card" : [rp_tourner_title, rp_tourner_text, rp_tourner_type]})
|
||||
rp_turn_title="Tourner"
|
||||
rp_turn_text=" rp_gauche() \n -> Tourne à gauche (90°).\n\n"
|
||||
rp_turn_text=rp_turn_text + " rp_droite() \n -> Tourne à droite (90°)."
|
||||
rp_turn_type="standard"
|
||||
card_description.update({"turn-card" : [rp_turn_title, rp_turn_text, rp_turn_type]})
|
||||
|
||||
# Baliser
|
||||
rp_baliser_title="Baliser"
|
||||
rp_baliser_text=" rp_marquer() \n -> Place une balise sur la case. \n \n Ropy possède que 20 balises, il ne \n peut pas en poser une de plus.\n\n"
|
||||
rp_baliser_text=rp_baliser_text + " Avec l'amélioration \"Balise +\", le \n nombre de balise transportées est \n étendu à 200. \n \n \n \n"
|
||||
rp_baliser_type="standard"
|
||||
card_description.update({"baliser-card" : [rp_baliser_title, rp_baliser_text, rp_baliser_type]})
|
||||
rp_delineate_title="Baliser"
|
||||
rp_delineate_text=" rp_marquer() \n -> Place une balise sur la case. \n\n Ropy possède que 20 balises, il ne \n peut pas en poser une de plus.\n\n"
|
||||
rp_delineate_text=rp_delineate_text + " Avec l'amélioration \"Balise +\", le \n nombre de balise transportées est \n étendu à 200. \n\n\n\n"
|
||||
rp_delineate_type="standard"
|
||||
card_description.update({"delineate-card" : [rp_delineate_title, rp_delineate_text, rp_delineate_type]})
|
||||
|
||||
# Détecter
|
||||
rp_detecter_title="Détecter"
|
||||
rp_detecter_text=" rp_detect() \n -> Détecte un obstacle.\n \n La fonction retourne : \n - \"True\" si il a un obstacle, \n - \"False\" si il n'y a pas d'obstacle."
|
||||
rp_detecter_type="standard"
|
||||
card_description.update({"detecter-card" : [rp_detecter_title, rp_detecter_text, rp_detecter_type]})
|
||||
rp_detect_title="Détecter"
|
||||
rp_detect_text=" rp_detect() \n -> Détecte un obstacle.\n \n La fonction retourne : \n - \"True\" si il a un obstacle, \n - \"False\" si il n'y a pas d'obstacle."
|
||||
rp_detect_type="standard"
|
||||
card_description.update({"detect-card" : [rp_detect_title, rp_detect_text, rp_detect_type]})
|
||||
|
||||
# Radar
|
||||
rp_radar_title="Radar"
|
||||
@ -118,7 +119,7 @@ python_card=["function-card", "alternative-card", "loop-card", "flow-card", "tex
|
||||
|
||||
# Fonction
|
||||
rp_function_title="Fonction"
|
||||
rp_function_text=" La définition d'une fonction se fait \n avec \"def\". La fonction peut \n renvoyer une valeur avec \"return\". \n \n"
|
||||
rp_function_text=" La définition d'une fonction se fait \n avec \"def\". La fonction peut \n renvoyer une valeur avec \"return\". \n\n"
|
||||
rp_function_text=rp_function_text + " def fonction_1 (arguments) : \n instruction_1 \n instruction_2 \n ....\n return valeurs_renvoyées \n\n"
|
||||
rp_function_text=rp_function_text + " Les arguments sont des données \n transmises à la fonction."
|
||||
rp_function_url=[["w3schools.com : functions","https://www.w3schools.com/python/python_functions.asp"]]
|
||||
@ -128,11 +129,11 @@ card_description.update({"function-card" : [rp_function_title, rp_function_text,
|
||||
rp_alternative_title="Alternative"
|
||||
rp_alternative_text=" L'alternative permet d'éxécuter des \n instructions en fonction d'un test. \n"
|
||||
rp_alternative_text=rp_alternative_text + " Elle se programme en suivant la \n suite : si ... alors ... sinon ... où \n"
|
||||
rp_alternative_text=rp_alternative_text + " \"si\" est \"if \" et \"sinon\" est \"else\". \n \n"
|
||||
rp_alternative_text=rp_alternative_text + " \"si\" est \"if \" et \"sinon\" est \"else\". \n\n"
|
||||
rp_alternative_text=rp_alternative_text + " if condition :\n"
|
||||
rp_alternative_text=rp_alternative_text + " instruction_1\n"
|
||||
rp_alternative_text=rp_alternative_text + " else : \n"
|
||||
rp_alternative_text=rp_alternative_text + " instruction_2\n \n"
|
||||
rp_alternative_text=rp_alternative_text + " instruction_2\n\n"
|
||||
rp_alternative_text=rp_alternative_text + "Le sinon (\"else\") est facultatif. \n\n"
|
||||
rp_alternative_url=[["w3schools.com : if ... else","https://www.w3schools.com/python/python_conditions.asp"]]
|
||||
card_description.update({"alternative-card" : [rp_alternative_title, rp_alternative_text, rp_alternative_url]})
|
||||
|
198
rp_lib.py
198
rp_lib.py
@ -184,7 +184,7 @@ def rp_avancer ():
|
||||
y1 = y0
|
||||
if [x1,y1] in scene.objects['Terrain']['map_tile_montain']:
|
||||
print ("Crash dans la montagne !")
|
||||
rover_colision_montain ()
|
||||
rover_colision_montain (False)
|
||||
obj['stop'] = True
|
||||
if [x1,y1] in scene.objects['Terrain']['map_tile_station']:
|
||||
print ("Crash dans la station !")
|
||||
@ -269,7 +269,103 @@ def rp_avancer ():
|
||||
|
||||
# Contrôle objectif
|
||||
if rp_map.objectif_control(x1,y1):
|
||||
rover_goal ()
|
||||
rover_goal ()
|
||||
return True
|
||||
|
||||
|
||||
##
|
||||
# Avancer le rover
|
||||
##
|
||||
|
||||
def rp_reculer ():
|
||||
obj=scene.objects['Rover']
|
||||
|
||||
# Pas de mouvement si colision ou objectif
|
||||
if obj['stop']:
|
||||
return False
|
||||
|
||||
# Contrôle colision
|
||||
x0 = obj.worldPosition.x
|
||||
y0 = obj.worldPosition.y
|
||||
z0 = obj.worldPosition.z
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
x1 = x0
|
||||
y1 = y0+1
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
x1 = x0
|
||||
y1 = y0-1
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
x1 = x0-1
|
||||
y1 = y0
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
x1 = x0+1
|
||||
y1 = y0
|
||||
if [x1,y1] in scene.objects['Terrain']['map_tile_montain']:
|
||||
print ("Crash dans la montagne !")
|
||||
rover_colision_montain (True)
|
||||
obj['stop'] = True
|
||||
if [x1,y1] in scene.objects['Terrain']['map_tile_station']:
|
||||
print ("Crash dans la station !")
|
||||
rover_colision_station (True) # FIXME à faire en recul
|
||||
obj['stop'] = True
|
||||
if x1 < scene.objects['Terrain']['size'][0] or x1 > scene.objects['Terrain']['size'][2] or y1 < scene.objects['Terrain']['size'][1] or y1 > scene.objects['Terrain']['size'][3] :
|
||||
print ("Sortie de carte !") # FIXME à faire en recul
|
||||
obj['stop'] = True
|
||||
if obj['stop']:
|
||||
return False
|
||||
|
||||
# Points et console
|
||||
if (debug_mvt):
|
||||
print ("rp_reculer()")
|
||||
scene.objects['Points']['step'] +=1
|
||||
|
||||
# Animation rapide
|
||||
if scene.objects['Commands']['speed'] >= 10 and scene.objects['Points']['step']> 2: # A tendance à planter sur les premiers mouvements en rapide + balisage
|
||||
x0 = obj.worldPosition.x
|
||||
y0 = obj.worldPosition.y
|
||||
z0 = obj.worldPosition.z
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.worldPosition=[x0, y0+1, z0]
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.worldPosition=[x0, y0-1, z0]
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.worldPosition=[x0-1, y0, z0]
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.worldPosition=[x0+1, y0, z0]
|
||||
rp_tempo (0.1)
|
||||
|
||||
# Animation
|
||||
if scene.objects['Commands']['speed'] < 10:
|
||||
start = 1
|
||||
end = 100
|
||||
layer = 0
|
||||
priority = 1
|
||||
blendin = 1.0
|
||||
mode = bge.logic.KX_ACTION_MODE_PLAY
|
||||
layerWeight = 0.0
|
||||
ipoFlags = 0
|
||||
speed = scene.objects['Commands']['speed']*8
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-Avancer-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-Avancer-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-Avancer-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-Avancer-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
|
||||
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
||||
rp_tempo (0.1)
|
||||
|
||||
# Contrôle objectif
|
||||
if rp_map.objectif_control(x1,y1):
|
||||
rover_goal ()
|
||||
return True
|
||||
|
||||
##
|
||||
@ -640,7 +736,7 @@ def rp_batterie ():
|
||||
# Montagne
|
||||
##
|
||||
|
||||
def rover_colision_montain ():
|
||||
def rover_colision_montain (back):
|
||||
obj=scene.objects['Rover']
|
||||
|
||||
# Animation
|
||||
@ -653,21 +749,39 @@ def rover_colision_montain ():
|
||||
layerWeight = 0.0
|
||||
ipoFlags = 0
|
||||
speed = scene.objects['Commands']['speed']*2
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-Crash-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-Crash-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-Crash-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-Crash-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if back==False: # Crash en avant
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-Crash-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-Crash-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-Crash-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-Crash-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
else: # Crash en arrière
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-Crash-Back-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-Crash-Back-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-Crash-Back-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-Crash-Back-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
|
||||
# Forçage du redraw
|
||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
|
||||
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
||||
rp_tempo (0.1)
|
||||
@ -677,7 +791,7 @@ def rover_colision_montain ():
|
||||
# Station
|
||||
##
|
||||
|
||||
def rover_colision_station ():
|
||||
def rover_colision_station (back):
|
||||
obj=scene.objects['Rover']
|
||||
|
||||
# Animation
|
||||
@ -690,22 +804,40 @@ def rover_colision_station ():
|
||||
layerWeight = 0.0
|
||||
ipoFlags = 0
|
||||
speed = scene.objects['Commands']['speed']*2
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-CrashStation-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-CrashStation-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-CrashStation-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-CrashStation-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction(): # Forçage du redraw
|
||||
if back==False: # Crash en avant
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-CrashStation-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-CrashStation-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-CrashStation-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-CrashStation-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Avancer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
else:
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == 0.00: # Sud
|
||||
obj.playAction('Rover-CrashStation-Back-Y+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi,2) or round(obj.worldOrientation.to_euler().z, 2) == - round(math.pi,2) : # Nord
|
||||
obj.playAction('Rover-CrashStation-Back-Y-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == -round(3*(math.pi/2),2) : # Est
|
||||
obj.playAction('Rover-CrashStation-Back-X-', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
if round(obj.worldOrientation.to_euler().z, 2) == round(-math.pi/2,2) or round(obj.worldOrientation.to_euler().z, 2) == round(3*(math.pi/2),2) : # Ouest
|
||||
obj.playAction('Rover-CrashStation-Back-X+', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-right-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-front'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-mid'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
scene.objects['Rv-Wheel-left-rear'].playAction('Wheel-Reculer', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
|
||||
|
||||
# Forçage du redraw
|
||||
while scene.objects['Rv-Wheel-right-front'].isPlayingAction():
|
||||
scene.objects['Sun'].applyMovement((0, 0, 0), True)
|
||||
rp_tempo (0.1)
|
||||
return True
|
||||
|
@ -274,7 +274,7 @@ def map_reset():
|
||||
##
|
||||
|
||||
def aim_show():
|
||||
|
||||
|
||||
# Zone de départ
|
||||
if scene.objects['Points']['mission']==5 or scene.objects['Points']['mission']==6:
|
||||
scene.objects['Initzone-mission-5'].setVisible(True,True)
|
||||
|
Loading…
Reference in New Issue
Block a user