diff --git a/README.md b/README.md index d127b75..707348d 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ **3D player for kinematic analysis** Ce lecteur 3D est un environnement léger et spécifique pour l'analyse cinématique d'un mécanisme en mouvement ( [vidéo de -présentation](https://nuage03.apps.education.fr/index.php/s/HiLe7JwgMGDnkaM) ). +présentation](http://www.phroy.org/cloud/index.php/s/meK9dgYEk4pKwC5 ) ). Mécanismes : * Baton de colle @@ -21,13 +21,19 @@ Les fonctionalités du lecteur sont : * l'exploration par la mise en transparence des composants et l'éclatement du mécanisme, * l'entrée dans le mécanisme par la nomenclature. -Les fichiers sources sont dans le groupe Blender-Edutech de Gitlab : https://gitlab.com/blender-edutech/kinematic-player . - -Les binaires (Game Engine Runtime) sont hébergés sur [apps.education.fr](https://nuage03.apps.education.fr/index.php/s/g75WfrdXM4Gx35s). - Ce lecteur fait partie du projet open source [Blender-EduTech (Blender/UPBGE pour l'Enseignement Technologique)](https://gitlab.com/blender-edutech). +## Téléchargement + +Les binaires (Game Engine Runtime) sont hébergés sur [phroy.org](http://www.phroy.org/cloud/index.php/s/54RWNAeMYpFAR5E). + +## Documents pédagogiques + +Les applications pédagogique se trouvent dans le [dépôt des documents pédagogiques du projet Blender-EduTech](https://gitlab.com/blender-edutech/blender-edutech-oer-french) . + +## Développement + L'environnement de développement est basé sur : la plateforme de modélisation et d'animation 3D Blender ( https://blender.org ), le langage Python (https://python.org ) et le moteur de jeu 3D UPBGE ( https://upbge.org ). -Les applications pédagogique se trouvent dans le [dépôt des documents pédagogiques du projet Blender-EduTech](https://gitlab.com/blender-edutech/blender-edutech-oer-french) . +Les fichiers sources sont dans le groupe Blender-Edutech de Gitlab : https://gitlab.com/blender-edutech/kinematic-player . diff --git a/baton_colle/batoncolle.py b/baton_colle/batoncolle.py index 897e934..3788ebd 100644 --- a/baton_colle/batoncolle.py +++ b/baton_colle/batoncolle.py @@ -1,5 +1,4 @@ import bge # Bibliothèque Blender Game Engine (BGE) -import math import cine # Bibliothèque du player 3d d'analyse de cinématique ############################################################################### diff --git a/cine.py b/cine.py index 2df3926..c3b5702 100644 --- a/cine.py +++ b/cine.py @@ -262,7 +262,7 @@ def anim_pause(): scene.objects['Mecanism']['anim'] = False # Animation en pseudo-pause -# Play d'une frame pour remettre les pièces en place +# Play d'une frame pour remettre les pièces en place (après-écltement) def anim_play1frame(): start = scene.objects['Mecanism']['anim_frame'] end = scene.objects['Mecanism']['anim_frame']+1 @@ -275,6 +275,8 @@ def anim_play1frame(): speed = 1.0 for objet in scene.objects['Mecanism']['objects_anim'] : scene.objects[objet].playAction(objet+'-Action', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed) + scene.objects['Axe 2'].playAction('Axe 2-Action_init', start, end, layer, priority, blendin, mode, layerWeight, ipoFlags, speed) + scene.objects['Mecanism']['anim_frame'] = end # Reprise de l'animation (bas niveau) @@ -319,15 +321,29 @@ def circle (center, radius, color): ang = 0 ang_step = 0.1 while ang< 2 * math.pi: - x0 = center[0]+float(radius*math.cos(ang)) - y0 = center[1] + x0 = center[0]+float(radius*math.cos(ang)*0.95) + y0 = center[1] z0 = center[2]+float(radius*math.sin(ang)) - x1 = center[0]+float(radius*math.cos(ang+ang_step)) + x1 = center[0]+float(radius*math.cos(ang+ang_step)*0.95) y1 = center[1] z1 = center[2]+float(radius*math.sin(ang+ang_step)) bge.render.drawLine([x0,y0,z0],[x1,y1,z1],color) ang += ang_step +# def circle (center, radius, color): +# ang = 0 +# ang_step = 0.1 +# ang_cam = (25.1 * 2 * math.pi)*(1/360) +# while ang< 2 * math.pi: +# x0 = center[0]+float(radius*math.cos(ang)) +# y0 = center[1] +float(radius*math.sin(ang_cam)*math.cos(ang)) +# z0 = center[2]+float(radius*math.sin(ang) - y0*math.tan(ang_cam)) +# x1 = center[0]+float(radius*math.cos(ang+ang_step)) +# y1 = center[1] +float(radius*math.sin(ang_cam)*math.cos(ang+ang_step)) +# z1 = center[2]+float(radius*math.sin(ang+ang_step) - y1*math.tan(ang_cam)) +# bge.render.drawLine([x0,y0,z0],[x1,y1,z1],color) +# ang += ang_step + ## # Initialisation de la vue 3D @@ -341,12 +357,14 @@ def manip_init(): # Fenêtres scene.objects['About'].setVisible(False,True) + scene.objects['Doc'].setVisible(False,True) # Mémorisation de la position des composants for objet in scene.objects['Mecanism']['objects'] : scene.objects[objet]['init_lx']=scene.objects[objet].worldPosition.x scene.objects[objet]['init_ly']=scene.objects[objet].worldPosition.y scene.objects[objet]['init_lz']=scene.objects[objet].worldPosition.z + if 'init_rx' in scene.objects[objet]: scene.objects[objet]['init_rx'] = scene.objects[objet].worldOrientation.to_euler().x if 'init_ry' in scene.objects[objet]: @@ -410,19 +428,24 @@ def manip_reset(): scene.objects['Camera'].worldPosition.y = scene.objects['Camera']['init_ly'] scene.objects['Camera'].worldPosition.z = scene.objects['Camera']['init_lz'] applyRotationTo(scene.objects['Mecanism'], 0, 0, 0) + scene.objects['Mecanism'].worldPosition.x = scene.objects['Mecanism']['init_lx'] + scene.objects['Mecanism'].worldPosition.y = scene.objects['Mecanism']['init_ly'] + scene.objects['Mecanism'].worldPosition.z = scene.objects['Mecanism']['init_lz'] for objet in scene.objects['Mecanism']['objects'] : scene.objects[objet].setVisible(True,False) scene.objects[objet].restorePhysics() if objet+"_Lines.GP" in scene.objects: scene.objects[objet+"_Lines.GP"].setVisible(True,False) + + # FIXME : retour pas bon pour tous les composants if scene.objects['Mecanism']['expld'] ==True: scene.objects['Mecanism']['expld'] = False for objet in scene.objects['Mecanism']['objects'] : scene.objects[objet].worldPosition.x =scene.objects[objet]['init_lx'] scene.objects[objet].worldPosition.y = scene.objects[objet]['init_ly'] scene.objects[objet].worldPosition.z = scene.objects[objet]['init_lz'] - if scene.objects['Mecanism']['anim'] == False: # Play d'une frame - anim_play1frame() + # if scene.objects['Mecanism']['anim'] == False: # Play d'une frame + anim_play1frame() ## # Position de départ pour la manipulation de la vue @@ -452,9 +475,17 @@ def manip(cont): z0 =scene.objects['Orbit'].worldPosition.z width = bge.render.getWindowWidth() height = bge.render.getWindowHeight() + dist_orbit_y_base=200 # Pour 1280 x 720 + radius_orbit_y_base=5 + diag_base= math.sqrt(1280**2+720**2) + diag= math.sqrt(width**2+height**2) + dist_orbit_y = dist_orbit_y_base*(diag/diag_base) + radius_orbit_y=radius_orbit_y_base*(diag/diag_base) dist_orbit = math.sqrt(((width/2)-obj['click_x'])**2+((height/2)-obj['click_y'])**2) - if dist_orbit<215 : # Orbit sur x et z (150 valeur déterminée visuellement, anciennement 235) - circle ([x0,y0,z0], 5, color_cmd) + if obj['click_y']> height/2 : + dist_orbit = dist_orbit+((math.sqrt(((height/2)-obj['click_y'])**2)/175)*25) # Correction des Y sous le centre ? + if dist_orbit