Suite de l'animation du volet (keyframe)

This commit is contained in:
Philippe Roy 2022-12-26 19:16:30 +01:00
parent 69dd644abc
commit 3add0238cd
3 changed files with 37 additions and 12 deletions

Binary file not shown.

View File

@ -83,19 +83,19 @@ def voy_auto (cont):
def mot (cont):
if scene.objects['System']['run']:
obj = cont.owner
print (obj['frame'])
print (obj['frame_up'], obj['frame_down'])
layer = 0
# Monter
if obj['up']:
start = 1
start = obj['frame_up']
end = 100
layer = 0
priority = 1
blendin = 1.0
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = 0.5
speed = 0.2
scene.objects['Axe enrouleur'].playAction('Axe enrouleur-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Axe fdc'].playAction('Axe fdc-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 1'].playAction('Lame volet 1-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
@ -110,14 +110,14 @@ def mot (cont):
scene.objects['Lame volet 10'].playAction('Lame volet 10-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 11'].playAction('Lame volet 11-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 12'].playAction('Lame volet 12-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.bjects['Lame volet 13'].playAction('Lame volet 13-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
time.sleep(0.125)
obj['up']= False
scene.objects['Lame volet 13'].playAction('Lame volet 13-Up', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
obj['frame_up'] = scene.objects['Axe enrouleur'].getActionFrame(layer)
obj['frame_down']= 100-obj['frame_up']
# FIXME : Touner sans fin
# Descendre
if obj['down']:
start = 1
start = obj['frame_down']
end = 100
layer = 0
priority = 1
@ -125,7 +125,7 @@ def mot (cont):
mode = bge.logic.KX_ACTION_MODE_PLAY
layerWeight = 0.0
ipoFlags = 0
speed = 0.5
speed = 0.2
scene.objects['Axe enrouleur'].playAction('Axe enrouleur-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Axe fdc'].playAction('Axe fdc-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 1'].playAction('Lame volet 1-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
@ -140,11 +140,30 @@ def mot (cont):
scene.objects['Lame volet 10'].playAction('Lame volet 10-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 11'].playAction('Lame volet 11-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.objects['Lame volet 12'].playAction('Lame volet 12-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
scene.bjects['Lame volet 13'].playAction('Lame volet 13-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
time.sleep(0.125)
obj['down']= False
scene.objects['Lame volet 13'].playAction('Lame volet 13-Down', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed)
obj['frame_down'] = scene.objects['Axe enrouleur'].getActionFrame(layer)
obj['frame_up']= 100-obj['frame_down']
# FIXME : Touner sans fin
# Arrêt
if obj['up'] == False and obj['down'] == False:
if scene.objects['Axe enrouleur'].isPlayingAction(layer):
scene.objects['Axe enrouleur'].stopAction(layer)
scene.objects['Axe fdc'].stopAction(layer)
scene.objects['Lame volet 1'].stopAction(layer)
scene.objects['Lame volet 2'].stopAction(layer)
scene.objects['Lame volet 3'].stopAction(layer)
scene.objects['Lame volet 4'].stopAction(layer)
scene.objects['Lame volet 5'].stopAction(layer)
scene.objects['Lame volet 6'].stopAction(layer)
scene.objects['Lame volet 7'].stopAction(layer)
scene.objects['Lame volet 8'].stopAction(layer)
scene.objects['Lame volet 9'].stopAction(layer)
scene.objects['Lame volet 10'].stopAction(layer)
scene.objects['Lame volet 11'].stopAction(layer)
scene.objects['Lame volet 12'].stopAction(layer)
scene.objects['Lame volet 13'].stopAction(layer)
###############################################################################
# Capteurs fin de course
###############################################################################

View File

@ -50,8 +50,14 @@ def commandes():
voy_auto(True)
if bp_m():
mot_m(True)
mot_d(False)
if bp_d():
mot_d(True)
mot_m(False)
if bp_a():
mot_m(False)
mot_d(False)
voy_auto(False)
fin() # A garder