Gérer la rotation d'un model 3d avec x3dom

bijour-greg Messages postés 112 Statut Membre -  
tuxboy Messages postés 1083 Statut Membre -
Bonjour,
j'ai fait plusieurs model 3d avec blender et en sauvegardant au formas x3d j'ai pus faire la conversion vers un code html5 sur cette page https://doc.instantreality.org/tools/x3d_encoding_converter/
ce site me donne un code qui fonctionne, il n'y a pas de soucis la dessus.
le truc que je cherche a faire c'est de bloquer les translation et le zoom pour ne laisser que la rotation sur les 3 axes.
je n'ai pas de très grande connaissance sur l'html et donc je ne sais pas si c'est faisable. Est ce que quelqu'un pourrais me montrer comment faire pour limiter les mouvements des pieces ?
merci

un site pour tester le code
http://www.draac.com/htmltester.html
et le code


<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8'></meta>
    <link rel='stylesheet' type='text/css' href='http://www.x3dom.org/x3dom/release/x3dom.css'></link>
    <script type='text/javascript' src='http://www.x3dom.org/x3dom/release/x3dom.js'></script>
  </head>
  <body>
    <x3d id='someUniqueId' showStat='false' showLog='false' x='0px' y='0px' width='400px' height='400px'>
      <scene>
        <navigationInfo avatarSize='0.25 1.75 0.75' headlight='false' type='"EXAMINE" "ANY"'></navigationInfo>
        <background DEF='WO_World' groundColor='0.051 0.051 0.051' skyColor='1 1 1'></background>
        <transform DEF='Point_TRANSFORM' rotation='0 0.707107 0.707107 3.14159'>
          <pointLight DEF='LA_Point' intensity='0.5714' radius='25'></pointLight>
        </transform>
        <transform DEF='Cube_007_TRANSFORM' rotation='-0.862856 -0.357407 -0.357407 1.71777' translation='-4.53077 0 -4.53077'>
          <transform DEF='Cube_007_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_009'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_004' ambientIntensity='0.333' diffuseColor='0.619 0 0.8' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_009' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_006_TRANSFORM' rotation='-0.862857 0.357407 0.357407 1.71777' translation='-4.53077 0 4.53077'>
          <transform DEF='Cube_006_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_008'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_002' ambientIntensity='0.333' diffuseColor='0 0.8 0.8' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_008' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_005_TRANSFORM' rotation='-0.281085 0.678598 0.678598 2.59356' translation='4.53077 0 4.53077'>
          <transform DEF='Cube_005_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_007'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_008' ambientIntensity='0.333' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_007' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_004_TRANSFORM' rotation='-0.281084 -0.678598 -0.678598 2.59356' translation='4.53077 0 -4.53077'>
          <transform DEF='Cube_004_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_006'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_006' ambientIntensity='0.333' diffuseColor='0.8 0.519 0' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_006' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_003_TRANSFORM' rotation='-0.57735 -0.57735 -0.57735 2.09439' translation='-1e-06 0 -6.40748'>
          <transform DEF='Cube_003_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_005'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_005' ambientIntensity='0.333' diffuseColor='0.8 0 0.409' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_005' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_002_TRANSFORM' rotation='-1 0 0 1.5708' translation='-6.40748 0 1e-06'>
          <transform DEF='Cube_002_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_004'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_003' ambientIntensity='0.333' diffuseColor='0.04 0 0.8' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_004' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_001_TRANSFORM' rotation='-0.57735 0.57735 0.57735 2.09439' translation='0 0 6.40748'>
          <transform DEF='Cube_001_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_003'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_001' ambientIntensity='0.333' diffuseColor='0 0.8 0.01' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_003' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Cube_TRANSFORM' rotation='0 0.707107 0.707107 3.14159' translation='6.40748 0 0'>
          <transform DEF='Cube_ifs_TRANSFORM'>
            <group DEF='group_ME_Cube_001'>
              <shape>
                <appearance>
                  <material DEF='MA_Material_007' ambientIntensity='0.333' diffuseColor='0.28 0.8 0' shininess='0.098' specularColor='0.401 0.401 0.401'></material>
                </appearance>
                <indexedFaceSet coordIndex='1 0 4 5 -1 5 6 2 1 -1 6 7 3 2 -1 0 3 7 4 -1 0 1 2 3 -1 7 6 5 4 -1'>
                  <coordinate DEF='coords_ME_Cube_001' point='-1 -1 -1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1'></coordinate>
                </indexedFaceSet>
              </shape>
            </group>
          </transform>
        </transform>
        <transform DEF='Hemi_002_TRANSFORM' rotation='-0.274962 0.953606 -0.1226 2.30412' translation='15.7577 0.345243 -12.0499'>
          <directionalLight DEF='LA_Hemi_002' intensity='0.2971'></directionalLight>
        </transform>
        <transform DEF='Hemi_001_TRANSFORM' rotation='-0.973585 -0.217952 -0.068032 0.252585' translation='-1.44624 5.51549 21.2693'>
          <directionalLight DEF='LA_Hemi_001' intensity='0.2857'></directionalLight>
        </transform>
        <transform DEF='Hemi_TRANSFORM' rotation='-0.161793 -0.985365 0.053661 2.5389' translation='-11.9853 0.021064 -16.7182'>
          <directionalLight DEF='LA_Hemi' intensity='0.2857'></directionalLight>
        </transform>
        <transform DEF='Camera_TRANSFORM' rotation='0.004877 -0.973484 -0.228703 3.13582' translation='-0.022797 7.45404 -17.6564'>
          <viewpoint DEF='CA_Camera' position='0 0 -0' fieldOfView='0.858'></viewpoint>
        </transform>
      </scene>
    </x3d>
  </body>
</html>
A voir également:

2 réponses

tuxboy Messages postés 1083 Statut Membre 190
 
Salut,

C'est un choix dans <navigationinfo> : type="EXAMINE"
Tu peux essayer avec type="GAME" ou type="FLY" ou type="WALK"
http://x3dom.org/docs/dev/navigation.html#interactive-camera-movement

Si tu veux contrôler toi-même les mouvements, il faut impérativement passer par un code javascript.
https://x3dom.org/x3dom/test/functional/walkThrough.html
https://www.x3dom.org/x3dom/example/x3dom_carousel.xhtml
0
bijour-greg Messages postés 112 Statut Membre 4
 
salut et merci pour ta réponse tuxboy
j'ai déja tester du coté des types de navigation préréglé de mais aucun de ces types ne va, il me faudrait le type "examine" mais sans la translation et le zoom et je ne connait pas le langage javascript, est ce qu'il y aurait un moyen simple de limité les degrés de liberté de ma pièce ? ( ou sinon, quelqu'un pourrait-il me proposé un code javascript ? )
0
tuxboy Messages postés 1083 Statut Membre 190
 
Une ultime possibilité est de faire un "custom" x3dom.js
Tu regardes le code par rapport à "examine" et supprime les codes qui correspondent à la translation, le zoom, et autres...
0