index.html 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Ejemplo de X3DOM</title>
  5. <script type='text/javascript' src='scripts/x3dom/x3dom-full-physics.js'> </script>
  6. <link rel='stylesheet' type='text/css' href='css/x3dom.css'></link>
  7. <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
  8. </head>
  9. <body>
  10. <h1>Ejemplo de ejecución de X3DOM</h1>
  11. <p>
  12. José Luis Fernández Aguilera
  13. </p>
  14. <x3d width='600px' height='400px'>
  15. <scene>
  16. <navigationInfo id='head' headlight='false' type='NONE'> </navigationInfo>
  17. <Viewpoint position='0,0,20' orientation='0,0,0,1'></Viewpoint>
  18. <background skyColor='0 0 0'></background>
  19. <DirectionalLight on ='true' ambienIntensity='0.2' direction='0,-1,0'
  20. color='1 1 1' global='true' shadowintensity='0.5' shadowmapsize='512'
  21. shadowfiltersize='16'></DirectionalLight>
  22. <!-- Esfera de la escena -->
  23. <transform DEF='BALL-TRANS' translation='0,2,0' rotation='0,0,1,0'>
  24. <shape>
  25. <appearance>
  26. <material ambientintensity='0.2' diffuseColor='1,0,0' shininess='0.3'></material>
  27. </appearance>
  28. <sphere radius='1'></sphere>
  29. </shape>
  30. </transform>
  31. <collidableShape DEF='BALL-GEOM' enabled='true' rotation='0,0,1,0' translation='0,2,0' containerField='children'>
  32. <transform USE='BALL-TRANS' containerField='physics'></transform>
  33. <shape containerField='Shape'>
  34. <sphere radius='1'></sphere>
  35. </shape>
  36. </collidableShape>
  37. <transform DEF='SMALLBALL-TRANS' translation='2,2,0' rotation='0,0,1,0'>
  38. <shape>
  39. <appearance>
  40. <material ambientintensity='0.2' diffuseColor='0.2,0,0.8' shininess='0.3'></material>
  41. </appearance>
  42. <sphere radius='0.5'></sphere>
  43. </shape>
  44. </transform>
  45. <collidableShape DEF='SMALLBALL-GEOM' enabled='true' rotation='0,0,1,0' translation='2,2,0' containerField='children'>
  46. <transform USE='SMALLBALL-TRANS' containerField='physics'></transform>
  47. <shape containerField='Shape'>
  48. <sphere radius='0.5'></sphere>
  49. </shape>
  50. </collidableShape>
  51. <!-- Suelo en el que se sostendrá todo -->
  52. <transform DEF='GROUND-TRANS' translation='0,-5,0' rotation='0,0,1,0' >
  53. <shape>
  54. <appearance>
  55. <material diffuseColor='0.2,0.2,0.2'></material>
  56. </appearance>
  57. <box size='15,0.1,15'></box>
  58. </shape>
  59. </transform>
  60. <collidableShape DEF='GROUND-GEOM' translation='0.0,-5,0.0' enabled='true' rotation='0,0,1,0' containerField='children'>
  61. <transform USE='GROUND-TRANS' containerField='physics'></transform>
  62. <shape containerField='Shape'>
  63. <box size='15,0.1,15'></box>
  64. </shape>
  65. </collidableShape>
  66. <rigidBodyCollection DEF='BODY-COLLECTION' autoDisable='false' constantForceMix='0.0001' contactSurfaceThickness='0.5' disableAngularSpeed='0' disableLinearSpeed='0' disableTime='0' enabled='true' errorCorrection='0.8' gravity='0 -9.8 0' iterations='10' maxCorrectionSpeed='-1' preferAccuracy='false' containerField='children'>
  67. <rigidBody DEF='BODY-1' containerField='bodies' position='0.0 2.0 0.0' angularDampingFactor='0.001' angularVelocity='0 0 0' autoDamp='false' autoDisable='false' centerOfMass='0 0 0' disableAngularSpeed='0' disableLinearSpeed='0' disableTime='0' enabled='true' finiteRotationAxis='0 1 0' fixed='false' inertia='1 0 0 0 1 0 0 0 1' linearDampingFactor='0.001' linearVelocity='0 0 0' mass='1' orientation='0 0 1 0' useFiniteRotation='false' useGlobalGravity='true'>
  68. <collidableShape USE='BALL-GEOM' containerField='geometry' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  69. </rigidBody>
  70. <rigidBody DEF='BODY-2' containerField='bodies' position='0.0 2.0 0.0' angularDampingFactor='0.001' angularVelocity='0 0 0' autoDamp='false' autoDisable='false' centerOfMass='0 0 0' disableAngularSpeed='0' disableLinearSpeed='0' disableTime='0' enabled='true' finiteRotationAxis='0 1 0' fixed='false' inertia='1 0 0 0 1 0 0 0 1' linearDampingFactor='0.001' linearVelocity='0 0 0' mass='0' orientation='0 0 1 0' useFiniteRotation='false' useGlobalGravity='true'>
  71. <collidableShape USE='GROUND-GEOM' containerField='geometry' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  72. </rigidBody>
  73. <rigidBody DEF='BODY-3' containerField='bodies' position='0.0 2.0 0.0' angularDampingFactor='0.001' angularVelocity='0 0 0' autoDamp='false' autoDisable='false' centerOfMass='0 0 0' disableAngularSpeed='0' disableLinearSpeed='0' disableTime='0' enabled='true' finiteRotationAxis='0 1 0' fixed='false' inertia='1 0 0 0 1 0 0 0 1' linearDampingFactor='0.001' linearVelocity='0 0 0' mass='1' orientation='0 0 1 0' useFiniteRotation='false' useGlobalGravity='true'>
  74. <collidableShape USE='SMALLBALL-GEOM' containerField='geometry' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  75. </rigidBody>
  76. </rigidBodyCollection>
  77. <collisionSensor DEF='COLLISION-OUTPUT' enabled='true'>
  78. <collisionCollection DEF='COLLISION-GROUP' bounce='0.8' containerField='collidables' minBounceSpeed='1.0' appliedParameters='BOUNCE' enabled='true' frictionCoefficients='0.1 0.1' slipFactors='0 0' softnessConstantForceMix='0.0001' softnessErrorCorrection='0.8' surfaceSpeed='0 0'>
  79. <collidableShape USE='BALL-GEOM' containerField='collidables' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  80. <collidableShape USE='GROUND-GEOM' containerField='collidables' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  81. <collidableShape USE='SMALLBALL-GEOM' containerField='collidables' enabled='true' rotation='0 0 1 0' translation='0 0 0'></collidableShape>
  82. </collisionCollection>
  83. </collisionSensor>
  84. </scene>
  85. </x3d>
  86. </body>
  87. </html>