pong.app.json 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. {
  2. "camera": {
  3. "metadata": {
  4. "version": 4.3,
  5. "type": "Object",
  6. "generator": "ObjectExporter"
  7. },
  8. "object": {
  9. "uuid": "E5C76691-3D55-4E26-862E-24BADC21F4D7",
  10. "type": "PerspectiveCamera",
  11. "name": "Camera",
  12. "fov": 50,
  13. "aspect": 1.3291139240506329,
  14. "near": 0.1,
  15. "far": 100000,
  16. "matrix": [0.9522120356559753,4.209433246415983e-9,-0.3054378032684326,0,-0.17742955684661865,0.8139731884002686,-0.553142249584198,0,0.24861818552017212,0.5809023976325989,0.7750750780105591,0,186.46363830566406,435.67681884765625,581.3063354492188,1]
  17. }
  18. },
  19. "scene": {
  20. "metadata": {
  21. "version": 4.3,
  22. "type": "Object",
  23. "generator": "ObjectExporter"
  24. },
  25. "geometries": [
  26. {
  27. "uuid": "77B20ED1-2871-4B14-A652-8F823B2A817E",
  28. "type": "PlaneGeometry",
  29. "width": 600,
  30. "height": 400,
  31. "widthSegments": 1,
  32. "heightSegments": 1
  33. },
  34. {
  35. "uuid": "7ADE0D01-A56A-4D33-869A-6C360E096EF7",
  36. "type": "BoxGeometry",
  37. "width": 10,
  38. "height": 10,
  39. "depth": 10,
  40. "widthSegments": 1,
  41. "heightSegments": 1,
  42. "depthSegments": 1
  43. },
  44. {
  45. "uuid": "E8C064B6-3454-4739-9E02-3B07B8E70B4C",
  46. "type": "BoxGeometry",
  47. "width": 20,
  48. "height": 20,
  49. "depth": 100,
  50. "widthSegments": 1,
  51. "heightSegments": 1,
  52. "depthSegments": 1
  53. }],
  54. "materials": [
  55. {
  56. "uuid": "7EDF7C08-6325-418A-BBAB-89341C694730",
  57. "type": "MeshPhongMaterial",
  58. "color": 16777215,
  59. "ambient": 16777215,
  60. "emissive": 0,
  61. "specular": 16777215,
  62. "shininess": 30
  63. },
  64. {
  65. "uuid": "B1CAF098-FE36-45E1-BEBE-8D6AC04821CC",
  66. "type": "MeshPhongMaterial",
  67. "color": 16711680,
  68. "ambient": 16777215,
  69. "emissive": 0,
  70. "specular": 1118481,
  71. "shininess": 30
  72. },
  73. {
  74. "uuid": "FBDBE66D-B613-4741-802D-5AE1DE07DE46",
  75. "type": "MeshPhongMaterial",
  76. "color": 2752767,
  77. "ambient": 16777215,
  78. "emissive": 0,
  79. "specular": 1118481,
  80. "shininess": 30
  81. }],
  82. "object": {
  83. "uuid": "31517222-A9A7-4EAF-B5F6-60751C0BABA3",
  84. "type": "Scene",
  85. "name": "Scene",
  86. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],
  87. "children": [
  88. {
  89. "uuid": "B47D0BFC-D63A-4CBB-985E-9C4DBDF086E4",
  90. "type": "Mesh",
  91. "name": "Ground",
  92. "geometry": "77B20ED1-2871-4B14-A652-8F823B2A817E",
  93. "material": "7EDF7C08-6325-418A-BBAB-89341C694730",
  94. "matrix": [1,0,0,0,0,0.0007961748051457107,-0.9999997019767761,0,0,0.9999997019767761,0.0007961748051457107,0,0,-10,0,1]
  95. },
  96. {
  97. "uuid": "CE13E58A-4E8B-4F72-9E2E-7DE57C58F989",
  98. "type": "Mesh",
  99. "name": "Ball",
  100. "geometry": "7ADE0D01-A56A-4D33-869A-6C360E096EF7",
  101. "material": "B1CAF098-FE36-45E1-BEBE-8D6AC04821CC",
  102. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]
  103. },
  104. {
  105. "uuid": "2AAEA3AA-EC45-492B-B450-10473D1EC6C5",
  106. "type": "Mesh",
  107. "name": "Pad 1",
  108. "geometry": "E8C064B6-3454-4739-9E02-3B07B8E70B4C",
  109. "material": "FBDBE66D-B613-4741-802D-5AE1DE07DE46",
  110. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,-240,0,0,1]
  111. },
  112. {
  113. "uuid": "F1DD46A7-6584-4A37-BC76-852C3911077E",
  114. "type": "Mesh",
  115. "name": "Pad 2",
  116. "geometry": "E8C064B6-3454-4739-9E02-3B07B8E70B4C",
  117. "material": "FBDBE66D-B613-4741-802D-5AE1DE07DE46",
  118. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,240,0,0,1]
  119. },
  120. {
  121. "uuid": "C62AAE9F-9E51-46A5-BD2B-71BA804FC0B3",
  122. "type": "DirectionalLight",
  123. "name": "DirectionalLight 3",
  124. "color": 16777215,
  125. "intensity": 1,
  126. "matrix": [1,0,0,0,0,1,0,0,0,0,1,0,100,200,150,1]
  127. }]
  128. }
  129. },
  130. "scripts": {
  131. "31517222-A9A7-4EAF-B5F6-60751C0BABA3": [
  132. {
  133. "name": "Game logic",
  134. "source": "var ball = this.getObjectByName( 'Ball' );\n\nvar position = ball.position;\n\nvar velocity = new THREE.Vector3();\n\nvar direction = new THREE.Vector3();\ndirection.x = Math.random() - 0.5;\ndirection.z = Math.random() - 0.5;\ndirection.normalize();\n\nvar pad1 = this.getObjectByName( 'Pad 1' );\nvar pad2 = this.getObjectByName( 'Pad 2' );\n\nvar raycaster = new THREE.Raycaster();\nvar objects = [ pad1, pad2 ];\n\n//\n\nfunction mousemove( event ) {\n\n\tpad1.position.z = ( event.clientX / player.width ) * 300 - 150;\n\tpad2.position.z = - pad1.position.z;\n\n}\n\nfunction update( event ) {\n\n\tif ( position.x < -300 || position.x > 300 ) {\n\t\t\n\t\tdirection.x = - direction.x;\n\t\t\n\t}\n\n\tif ( position.z < -200 || position.z > 200 ) {\n\t\t\n\t\tdirection.z = - direction.z;\n\t\t\n\t}\n\t\n\traycaster.set( position, direction );\n\t\n\tvar intersections = raycaster.intersectObjects( objects );\n\t\n\tif ( intersections.length > 0 ) {\n\n\t\tvar intersection = intersections[ 0 ];\n\t\t\n\t\tif ( intersection.distance < 10 ) {\n\t\t\t\n\t\t\tdirection.reflect( intersection.face.normal );\n\t\t\t\n\t\t}\n\t\t\n\t}\n\n\tposition.add( velocity.copy( direction ).multiplyScalar( 8 ) );\n\n}"
  135. }]
  136. }
  137. }