gaesup-world 0.0.68 → 0.0.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (271) hide show
  1. package/README.md +16 -0
  2. package/dist/gaesup/animation/actions.d.ts +22 -5
  3. package/dist/gaesup/animation/actions.js +68 -43
  4. package/dist/gaesup/animation/passiveActions.d.ts +9 -0
  5. package/dist/gaesup/animation/passiveActions.js +16 -0
  6. package/dist/gaesup/camera/control/normal.js +1 -1
  7. package/dist/gaesup/camera/detector/index.d.ts +2 -0
  8. package/dist/gaesup/camera/detector/index.js +25 -0
  9. package/dist/gaesup/camera/index.d.ts +2 -2
  10. package/dist/gaesup/camera/index.js +12 -8
  11. package/dist/gaesup/camera/type.d.ts +3 -7
  12. package/dist/gaesup/component/active/airplane/collider.d.ts +6 -0
  13. package/dist/gaesup/component/active/airplane/collider.js +22 -0
  14. package/dist/gaesup/component/active/airplane/index.d.ts +5 -0
  15. package/dist/gaesup/component/active/airplane/index.js +11 -0
  16. package/dist/gaesup/component/active/character/collider.d.ts +6 -0
  17. package/dist/gaesup/component/active/character/collider.js +24 -0
  18. package/dist/gaesup/component/active/character/index.d.ts +5 -0
  19. package/dist/gaesup/component/active/character/index.js +16 -0
  20. package/dist/gaesup/component/active/common/InnerGroupRef.d.ts +10 -0
  21. package/dist/gaesup/component/active/common/InnerGroupRef.js +32 -0
  22. package/dist/gaesup/component/active/common/OuterGroupRef.d.ts +6 -0
  23. package/dist/gaesup/{tools/reducer.js → component/active/common/OuterGroupRef.js} +6 -13
  24. package/dist/gaesup/component/active/common/RigidbodyRef.d.ts +7 -0
  25. package/dist/gaesup/component/active/common/RigidbodyRef.js +18 -0
  26. package/dist/gaesup/component/active/common/WrapperRef.d.ts +12 -0
  27. package/dist/gaesup/component/active/common/WrapperRef.js +9 -0
  28. package/dist/gaesup/component/active/common/slopeRayRef.d.ts +6 -0
  29. package/dist/gaesup/component/active/common/slopeRayRef.js +10 -0
  30. package/dist/gaesup/component/active/vehicle/collider.d.ts +3 -0
  31. package/dist/gaesup/component/active/vehicle/collider.js +9 -0
  32. package/dist/gaesup/component/active/vehicle/index.d.ts +5 -0
  33. package/dist/gaesup/component/active/vehicle/index.js +12 -0
  34. package/dist/gaesup/component/active/vehicle/wheel.d.ts +12 -0
  35. package/dist/gaesup/component/active/vehicle/wheel.js +13 -0
  36. package/dist/gaesup/component/active/vehicle/wheels.d.ts +7 -0
  37. package/dist/gaesup/component/active/vehicle/wheels.js +22 -0
  38. package/dist/gaesup/component/index.d.ts +7 -5
  39. package/dist/gaesup/component/index.js +20 -5
  40. package/dist/gaesup/component/passive/airplane/collider.d.ts +6 -0
  41. package/dist/gaesup/component/passive/airplane/collider.js +8 -0
  42. package/dist/gaesup/component/passive/airplane/index.d.ts +4 -0
  43. package/dist/gaesup/component/passive/airplane/index.js +25 -0
  44. package/dist/gaesup/component/passive/character/collider.d.ts +6 -0
  45. package/dist/gaesup/component/passive/character/collider.js +7 -0
  46. package/dist/gaesup/component/passive/character/index.d.ts +4 -0
  47. package/dist/gaesup/component/passive/character/index.js +25 -0
  48. package/dist/gaesup/component/passive/common/InnerGroupRef.d.ts +8 -0
  49. package/dist/gaesup/component/passive/common/InnerGroupRef.js +27 -0
  50. package/dist/gaesup/component/passive/common/OuterGroupRef.d.ts +4 -0
  51. package/dist/gaesup/component/passive/common/OuterGroupRef.js +6 -0
  52. package/dist/gaesup/component/passive/common/PassiveWrapperRef.d.ts +10 -0
  53. package/dist/gaesup/component/passive/common/PassiveWrapperRef.js +8 -0
  54. package/dist/gaesup/component/passive/common/RigidbodyRef.d.ts +5 -0
  55. package/dist/gaesup/component/passive/common/RigidbodyRef.js +7 -0
  56. package/dist/gaesup/component/passive/type.d.ts +30 -0
  57. package/dist/gaesup/component/passive/vehicle/collider.d.ts +7 -0
  58. package/dist/gaesup/component/passive/vehicle/collider.js +8 -0
  59. package/dist/gaesup/component/passive/vehicle/index.d.ts +4 -0
  60. package/dist/gaesup/component/passive/vehicle/index.js +26 -0
  61. package/dist/gaesup/component/passive/vehicle/wheel.d.ts +16 -0
  62. package/dist/gaesup/component/passive/vehicle/wheel.js +10 -0
  63. package/dist/gaesup/component/passive/vehicle/wheels.d.ts +11 -0
  64. package/dist/gaesup/component/passive/vehicle/wheels.js +27 -0
  65. package/dist/gaesup/component/type.d.ts +18 -0
  66. package/dist/gaesup/controller/context/index.d.ts +36 -9
  67. package/dist/gaesup/controller/context/index.js +35 -8
  68. package/dist/gaesup/controller/context/reducer.d.ts +10 -8
  69. package/dist/gaesup/controller/context/type.d.ts +51 -32
  70. package/dist/gaesup/controller/debug/airplane.d.ts +71 -0
  71. package/dist/gaesup/controller/debug/airplane.js +71 -0
  72. package/dist/gaesup/controller/debug/cameraOption.d.ts +27 -0
  73. package/dist/gaesup/controller/debug/cameraOption.js +27 -0
  74. package/dist/gaesup/controller/debug/character.d.ts +27 -0
  75. package/dist/gaesup/controller/debug/character.js +27 -0
  76. package/dist/gaesup/controller/debug/index.d.ts +6 -0
  77. package/dist/gaesup/controller/debug/index.js +102 -0
  78. package/dist/gaesup/controller/debug/orthographicCamera.d.ts +17 -0
  79. package/dist/gaesup/controller/debug/orthographicCamera.js +17 -0
  80. package/dist/gaesup/controller/debug/perspectiveCamera.d.ts +12 -0
  81. package/dist/gaesup/controller/debug/perspectiveCamera.js +12 -0
  82. package/dist/gaesup/controller/debug/vehicle.d.ts +27 -0
  83. package/dist/gaesup/controller/debug/vehicle.js +27 -0
  84. package/dist/gaesup/controller/index.js +43 -42
  85. package/dist/gaesup/controller/initialize/callback/index.d.ts +2 -0
  86. package/dist/gaesup/controller/initialize/callback/index.js +57 -0
  87. package/dist/gaesup/{initial → controller/initialize}/callback/type.d.ts +4 -11
  88. package/dist/gaesup/controller/initialize/index.d.ts +13 -0
  89. package/dist/gaesup/{initial/controller → controller/initialize}/index.js +10 -48
  90. package/dist/gaesup/controller/type.d.ts +23 -56
  91. package/dist/gaesup/gaesupProps/index.js +4 -6
  92. package/dist/gaesup/hooks/index.d.ts +1 -0
  93. package/dist/gaesup/hooks/index.js +1 -0
  94. package/dist/gaesup/hooks/useGaesupController/index.d.ts +12 -0
  95. package/dist/gaesup/hooks/useGaesupController/index.js +18 -0
  96. package/dist/gaesup/index.d.ts +3 -3
  97. package/dist/gaesup/index.js +3 -3
  98. package/dist/gaesup/mutation/airplane/index.d.ts +2 -0
  99. package/dist/gaesup/mutation/airplane/index.js +6 -0
  100. package/dist/gaesup/mutation/airplane/rotation.d.ts +2 -0
  101. package/dist/gaesup/mutation/airplane/rotation.js +9 -0
  102. package/dist/gaesup/mutation/character/index.d.ts +2 -0
  103. package/dist/gaesup/mutation/character/index.js +8 -0
  104. package/dist/gaesup/mutation/character/rotation.d.ts +2 -0
  105. package/dist/gaesup/mutation/character/rotation.js +5 -0
  106. package/dist/gaesup/mutation/common/stabilizing.d.ts +2 -0
  107. package/dist/gaesup/mutation/common/stabilizing.js +4 -0
  108. package/dist/gaesup/mutation/common/transition.d.ts +2 -0
  109. package/dist/gaesup/mutation/common/transition.js +4 -0
  110. package/dist/gaesup/mutation/index.d.ts +7 -0
  111. package/dist/gaesup/mutation/index.js +35 -0
  112. package/dist/gaesup/mutation/type.d.ts +21 -0
  113. package/dist/gaesup/mutation/type.js +1 -0
  114. package/dist/gaesup/mutation/vehicle/index.d.ts +2 -0
  115. package/dist/gaesup/mutation/vehicle/index.js +6 -0
  116. package/dist/gaesup/mutation/vehicle/rotation.d.ts +2 -0
  117. package/dist/gaesup/mutation/vehicle/rotation.js +5 -0
  118. package/dist/gaesup/physics/airplane/damping.js +3 -2
  119. package/dist/gaesup/physics/airplane/direction.js +3 -2
  120. package/dist/gaesup/physics/airplane/gravity.js +3 -2
  121. package/dist/gaesup/physics/airplane/impulse.js +1 -1
  122. package/dist/gaesup/physics/character/accelaration.js +1 -1
  123. package/dist/gaesup/physics/character/damping.js +2 -2
  124. package/dist/gaesup/physics/character/direction.js +8 -9
  125. package/dist/gaesup/physics/character/impulse.js +1 -1
  126. package/dist/gaesup/physics/character/jump.js +2 -3
  127. package/dist/gaesup/physics/character/turn.js +6 -3
  128. package/dist/gaesup/physics/index.d.ts +2 -2
  129. package/dist/gaesup/physics/index.js +9 -2
  130. package/dist/gaesup/physics/type.d.ts +13 -9
  131. package/dist/gaesup/physics/vehicle/damping.js +3 -3
  132. package/dist/gaesup/physics/vehicle/impulse.js +4 -6
  133. package/dist/gaesup/tools/gameboy/GameBoyButton.d.ts +3 -1
  134. package/dist/gaesup/tools/gameboy/GameBoyButton.js +3 -5
  135. package/dist/gaesup/tools/gameboy/index.d.ts +2 -1
  136. package/dist/gaesup/tools/gameboy/index.js +8 -6
  137. package/dist/gaesup/tools/gameboy/style.css.d.ts +0 -1
  138. package/dist/gaesup/tools/gameboy/style.css.js +3 -15
  139. package/dist/gaesup/tools/gameboy/type.d.ts +2 -5
  140. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +3 -1
  141. package/dist/gaesup/tools/gamepad/GamePadButton.js +4 -5
  142. package/dist/gaesup/tools/gamepad/index.d.ts +2 -1
  143. package/dist/gaesup/tools/gamepad/index.js +9 -9
  144. package/dist/gaesup/tools/gamepad/style.css.js +1 -1
  145. package/dist/gaesup/tools/gamepad/type.d.ts +4 -6
  146. package/dist/gaesup/tools/index.d.ts +5 -2
  147. package/dist/gaesup/tools/index.js +5 -42
  148. package/dist/gaesup/tools/joystick/default.d.ts +0 -4
  149. package/dist/gaesup/tools/joystick/default.js +0 -4
  150. package/dist/gaesup/tools/joystick/index.d.ts +2 -2
  151. package/dist/gaesup/tools/joystick/index.js +48 -29
  152. package/dist/gaesup/tools/joystick/style.css.d.ts +0 -1
  153. package/dist/gaesup/tools/joystick/style.css.js +0 -15
  154. package/dist/gaesup/tools/joystick/type.d.ts +2 -7
  155. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -1
  156. package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -1
  157. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +2 -1
  158. package/dist/gaesup/tools/keyBoardToolTip/index.js +18 -14
  159. package/dist/gaesup/tools/keyBoardToolTip/style.css.d.ts +0 -1
  160. package/dist/gaesup/tools/keyBoardToolTip/style.css.js +1 -21
  161. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +8 -5
  162. package/dist/gaesup/tools/minimap/default.d.ts +4 -3
  163. package/dist/gaesup/tools/minimap/default.js +4 -3
  164. package/dist/gaesup/tools/minimap/index.d.ts +2 -1
  165. package/dist/gaesup/tools/minimap/index.js +49 -41
  166. package/dist/gaesup/tools/minimap/style.css.d.ts +32 -0
  167. package/dist/gaesup/tools/minimap/style.css.js +99 -19
  168. package/dist/gaesup/tools/minimap/type.d.ts +7 -11
  169. package/dist/gaesup/tools/type.d.ts +2 -26
  170. package/dist/gaesup/utils/context.d.ts +2 -0
  171. package/dist/gaesup/utils/context.js +3 -0
  172. package/dist/gaesup/utils/debug.d.ts +29 -0
  173. package/dist/gaesup/utils/debug.js +36 -0
  174. package/dist/gaesup/utils/gltf.d.ts +7 -0
  175. package/dist/gaesup/utils/gltf.js +10 -0
  176. package/dist/gaesup/utils/type.d.ts +5 -0
  177. package/dist/gaesup/utils/type.js +1 -0
  178. package/dist/gaesup/utils/vector.d.ts +1 -0
  179. package/dist/gaesup/utils/vector.js +3 -0
  180. package/dist/gaesup/world/context/index.d.ts +5 -4
  181. package/dist/gaesup/world/context/index.js +3 -8
  182. package/dist/gaesup/world/context/reducer.d.ts +8 -8
  183. package/dist/gaesup/world/context/reducer.js +0 -3
  184. package/dist/gaesup/world/context/type.d.ts +22 -19
  185. package/dist/gaesup/world/debug/index.d.ts +2 -0
  186. package/dist/gaesup/world/debug/index.js +30 -0
  187. package/dist/gaesup/world/debug/mode.d.ts +10 -0
  188. package/dist/gaesup/world/debug/mode.js +10 -0
  189. package/dist/gaesup/world/index.d.ts +2 -2
  190. package/dist/gaesup/world/index.js +1 -1
  191. package/dist/gaesup/world/initalize/collider/airplane.js +24 -0
  192. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/character.js +10 -13
  193. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/gltf.d.ts +1 -1
  194. package/dist/gaesup/world/initalize/collider/gltf.js +54 -0
  195. package/dist/gaesup/world/initalize/collider/index.d.ts +2 -0
  196. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/index.js +2 -1
  197. package/dist/gaesup/world/initalize/collider/vehicle.js +55 -0
  198. package/dist/gaesup/world/initalize/index.d.ts +33 -0
  199. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/index.js +7 -24
  200. package/dist/gaesup/world/initalize/type.d.ts +13 -0
  201. package/dist/gaesup/world/initalize/type.js +1 -0
  202. package/dist/gaesup/world/type.d.ts +17 -7
  203. package/dist/index.d.ts +2 -1
  204. package/dist/index.js +2 -1
  205. package/dist/styles/index.d.ts +2 -0
  206. package/dist/styles/index.js +2 -0
  207. package/dist/styles/sprinkles/color.css.d.ts +23 -23
  208. package/dist/styles/sprinkles/direction.css.d.ts +8 -8
  209. package/dist/styles/sprinkles/display.css.d.ts +3 -3
  210. package/dist/styles/sprinkles/fontSize.css.d.ts +4 -4
  211. package/dist/styles/sprinkles/index.css.d.ts +368 -1
  212. package/dist/styles/sprinkles/margin.css.d.ts +20 -20
  213. package/dist/styles/sprinkles/padding.css.d.ts +20 -20
  214. package/package.json +9 -3
  215. package/dist/gaesup/camera/cameraCollisionDetecter.d.ts +0 -4
  216. package/dist/gaesup/camera/cameraCollisionDetecter.js +0 -50
  217. package/dist/gaesup/component/Airplane.d.ts +0 -5
  218. package/dist/gaesup/component/Airplane.js +0 -14
  219. package/dist/gaesup/component/Character.d.ts +0 -5
  220. package/dist/gaesup/component/Character.js +0 -13
  221. package/dist/gaesup/component/Vehicle.d.ts +0 -5
  222. package/dist/gaesup/component/Vehicle.js +0 -15
  223. package/dist/gaesup/component/gltf/AirplaneGltf.d.ts +0 -2
  224. package/dist/gaesup/component/gltf/AirplaneGltf.js +0 -13
  225. package/dist/gaesup/component/gltf/CharacterGltf.d.ts +0 -14
  226. package/dist/gaesup/component/gltf/CharacterGltf.js +0 -46
  227. package/dist/gaesup/component/gltf/VehicleGltf.d.ts +0 -2
  228. package/dist/gaesup/component/gltf/VehicleGltf.js +0 -13
  229. package/dist/gaesup/component/gltf/WheelJoint.d.ts +0 -4
  230. package/dist/gaesup/component/gltf/WheelJoint.js +0 -21
  231. package/dist/gaesup/component/gltf/index.d.ts +0 -4
  232. package/dist/gaesup/component/gltf/index.js +0 -4
  233. package/dist/gaesup/component/gltf/type.d.ts +0 -10
  234. package/dist/gaesup/component/ref/airplane.d.ts +0 -16
  235. package/dist/gaesup/component/ref/airplane.js +0 -46
  236. package/dist/gaesup/component/ref/character.d.ts +0 -20
  237. package/dist/gaesup/component/ref/character.js +0 -56
  238. package/dist/gaesup/component/ref/index.d.ts +0 -3
  239. package/dist/gaesup/component/ref/index.js +0 -3
  240. package/dist/gaesup/component/ref/vehicle.d.ts +0 -24
  241. package/dist/gaesup/component/ref/vehicle.js +0 -41
  242. package/dist/gaesup/component/setInit.d.ts +0 -3
  243. package/dist/gaesup/component/setInit.js +0 -10
  244. package/dist/gaesup/initial/callback/index.d.ts +0 -2
  245. package/dist/gaesup/initial/callback/index.js +0 -51
  246. package/dist/gaesup/initial/controller/index.d.ts +0 -29
  247. package/dist/gaesup/initial/controller/initDebug.d.ts +0 -24
  248. package/dist/gaesup/initial/controller/initDebug.js +0 -110
  249. package/dist/gaesup/initial/gaesupWorld/collider/airplane.js +0 -25
  250. package/dist/gaesup/initial/gaesupWorld/collider/gltf.js +0 -71
  251. package/dist/gaesup/initial/gaesupWorld/collider/index.d.ts +0 -6
  252. package/dist/gaesup/initial/gaesupWorld/collider/vehicle.js +0 -40
  253. package/dist/gaesup/initial/gaesupWorld/index.d.ts +0 -33
  254. package/dist/gaesup/initial/gaesupWorld/type.d.ts +0 -28
  255. package/dist/gaesup/initial/index.d.ts +0 -3
  256. package/dist/gaesup/initial/index.js +0 -3
  257. package/dist/gaesup/tools/context.d.ts +0 -4
  258. package/dist/gaesup/tools/context.js +0 -3
  259. package/dist/gaesup/tools/gameboy/default.d.ts +0 -3
  260. package/dist/gaesup/tools/gameboy/default.js +0 -3
  261. package/dist/gaesup/tools/reducer.d.ts +0 -11
  262. package/dist/gaesup/tools/style.css.d.ts +0 -3
  263. package/dist/gaesup/tools/style.css.js +0 -31
  264. package/dist/gaesup/utils/constant.d.ts +0 -1
  265. package/dist/gaesup/utils/constant.js +0 -1
  266. /package/dist/gaesup/component/{gltf → passive}/type.js +0 -0
  267. /package/dist/gaesup/{initial/callback → component}/type.js +0 -0
  268. /package/dist/gaesup/{initial/gaesupWorld → controller/initialize/callback}/type.js +0 -0
  269. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/airplane.d.ts +0 -0
  270. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/character.d.ts +0 -0
  271. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/vehicle.d.ts +0 -0
package/README.md CHANGED
@@ -182,3 +182,19 @@ This is the airplane control in Gaesup World. Characters can board the airplane.
182
182
  ## Tools
183
183
 
184
184
  #### [Tools](#tools)
185
+
186
+ #### [joystick](#joystick)
187
+
188
+ #### [keyboardtooltip](#keyboard tooltip)
189
+
190
+ #### [minimap](#minimap)
191
+
192
+ #### [gameboy](#gameboy)
193
+
194
+ ## joystick
195
+
196
+ ## keyboard tooltip
197
+
198
+ ## minimap
199
+
200
+ ## gameboy
@@ -1,8 +1,25 @@
1
- import { RefObject } from "react";
2
- import { groundRayType } from "../controller/type";
1
+ import { Ref } from "react";
2
+ import { Object3D, Object3DEventMap } from "three";
3
+ import { animationTagType, groundRayType } from "../controller/type";
3
4
  export type playActionsType = {
4
- outerGroupRef: RefObject<THREE.Group>;
5
5
  groundRay: groundRayType;
6
- isRider?: boolean;
7
6
  };
8
- export default function playActions({ outerGroupRef, groundRay, isRider, }: playActionsType): void;
7
+ export type actionsType = {
8
+ [x: string]: THREE.AnimationAction | null;
9
+ };
10
+ export type playResultType = {
11
+ actions: actionsType;
12
+ ref: Ref<Object3D<Object3DEventMap>>;
13
+ };
14
+ export declare function usePlayActions(): {
15
+ resultRef: {
16
+ character: playResultType;
17
+ vehicle: playResultType;
18
+ airplane: playResultType;
19
+ };
20
+ play: (tag: keyof animationTagType) => void;
21
+ setAnimationName: (actions: actionsType) => void;
22
+ };
23
+ export default function playCharacterActions({ groundRay }: playActionsType): {
24
+ ref: Ref<Object3D<Object3DEventMap>>;
25
+ };
@@ -13,71 +13,84 @@ import { useAnimations, useKeyboardControls } from "@react-three/drei";
13
13
  import { useFrame } from "@react-three/fiber";
14
14
  import { useContext, useEffect } from "react";
15
15
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
16
- export default function playActions(_a) {
17
- var outerGroupRef = _a.outerGroupRef, groundRay = _a.groundRay, isRider = _a.isRider;
18
- var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, characterAnimations = _b.animations;
16
+ export function usePlayActions() {
17
+ var _a = useContext(GaesupWorldContext), characterGltf = _a.characterGltf, vehicleGltf = _a.vehicleGltf, airplaneGltf = _a.airplaneGltf, animations = _a.animations;
18
+ var characterAnimations = characterGltf.animations;
19
+ var characterResult = useAnimations(characterAnimations);
20
+ var vehicleAnimations = vehicleGltf.animations;
21
+ var vehicleResult = useAnimations(vehicleAnimations);
22
+ var airplaneAnimations = airplaneGltf.animations;
23
+ var airplaneResult = useAnimations(airplaneAnimations);
19
24
  var dispatch = useContext(GaesupWorldDispatchContext);
20
- var animations = characterGltf.animations;
21
- var control = useKeyboardControls()[1]();
22
- var actions = useAnimations(animations, outerGroupRef).actions;
23
- useEffect(function () {
24
- characterAnimations.keyControl = control;
25
+ var play = function (tag) {
26
+ animations.current = tag;
25
27
  dispatch({
26
28
  type: "update",
27
29
  payload: {
28
- animations: __assign({}, characterAnimations),
29
- },
30
- });
31
- }, [control]);
32
- var playAnimation = function (tag) {
33
- characterAnimations.current = tag;
34
- dispatch({
35
- type: "update",
36
- payload: {
37
- animations: __assign({}, characterAnimations),
30
+ animations: __assign({}, animations),
38
31
  },
39
32
  });
40
33
  };
41
34
  var setAnimationName = function (actions) {
42
- characterAnimations.animationNames = Object.assign(characterAnimations.animationNames, Object.keys(actions).reduce(function (acc, cur) {
35
+ animations.animationNames = Object.assign(animations.animationNames, Object.keys(actions).reduce(function (acc, cur) {
43
36
  var _a;
44
37
  return __assign(__assign({}, acc), (_a = {}, _a[cur] = cur, _a));
45
38
  }, {}));
46
39
  dispatch({
47
40
  type: "update",
48
41
  payload: {
49
- animations: __assign({}, characterAnimations),
42
+ animations: __assign({}, animations),
50
43
  },
51
44
  });
52
45
  };
53
- var resetAni = function () { return playAnimation("idle"); };
54
- var playIdle = function () { return playAnimation("idle"); };
55
- var playWalk = function () { return playAnimation("walk"); };
56
- var playRun = function () { return playAnimation("run"); };
57
- var playJump = function () { return playAnimation("jump"); };
58
- var playFall = function () { return playAnimation("fall"); };
59
- var playRide = function () { return playAnimation("ride"); };
46
+ var resultRef = {
47
+ character: characterResult,
48
+ vehicle: vehicleResult,
49
+ airplane: airplaneResult,
50
+ };
51
+ return { resultRef: resultRef, play: play, setAnimationName: setAnimationName };
52
+ }
53
+ export default function playCharacterActions(_a) {
54
+ var groundRay = _a.groundRay;
55
+ var _b = usePlayActions(), _c = _b.resultRef.character, actions = _c.actions, ref = _c.ref, play = _b.play, setAnimationName = _b.setAnimationName;
56
+ var _d = useContext(GaesupWorldContext), states = _d.states, activeState = _d.activeState, animations = _d.animations, mode = _d.mode;
57
+ var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter, isOnTheGround = states.isOnTheGround;
58
+ var dispatch = useContext(GaesupWorldDispatchContext);
59
+ var control = useKeyboardControls()[1]();
60
+ var resetAni = function () { return play("idle"); };
61
+ var playIdle = function () { return play("idle"); };
62
+ var playWalk = function () { return play("walk"); };
63
+ var playRun = function () { return play("run"); };
64
+ var playJump = function () { return play("jump"); };
65
+ var playFall = function () { return play("fall"); };
66
+ var playRide = function () { return play("ride"); };
67
+ var playLanding = function () { return play("land"); };
60
68
  useEffect(function () {
61
69
  return function () {
62
70
  resetAni();
63
71
  };
64
72
  }, []);
73
+ useEffect(function () {
74
+ animations.keyControl = control;
75
+ dispatch({
76
+ type: "update",
77
+ payload: {
78
+ animations: __assign({}, animations),
79
+ },
80
+ });
81
+ }, [control]);
65
82
  useEffect(function () {
66
83
  var _a;
67
- // Play animation
68
- var action = (_a = actions[characterAnimations.current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
69
- setAnimationName(actions);
70
- return function () {
71
- action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
72
- };
73
- }, [characterAnimations.current]);
74
- var _c = useContext(GaesupWorldContext), states = _c.states, activeState = _c.activeState;
75
- var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter;
76
- useFrame(function () {
77
- if (isRider) {
78
- playRide();
84
+ if (mode.type === "character") {
85
+ var action_1 = (_a = actions[animations.current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
86
+ setAnimationName(actions);
87
+ return function () {
88
+ action_1 === null || action_1 === void 0 ? void 0 : action_1.fadeOut(0.2);
89
+ };
79
90
  }
80
- else {
91
+ }, [animations.current, mode.type]);
92
+ useFrame(function () {
93
+ if (mode.type === "character") {
81
94
  if (!isAnimationOuter) {
82
95
  if (isJumping) {
83
96
  playJump();
@@ -91,10 +104,22 @@ export default function playActions(_a) {
91
104
  else if (isMoving) {
92
105
  playWalk();
93
106
  }
94
- if (groundRay.hit === null && activeState.velocity.y < 0) {
95
- playFall();
96
- }
107
+ // if (groundRay.hit) {
108
+ // if (!isJumping && !isOnTheGround) {
109
+ // if (groundRay.hit.toi < 5) {
110
+ // playLanding();
111
+ // } else {
112
+ // playFall();
113
+ // }
114
+ // }
115
+ // }
116
+ // if (groundRay.hit === null && activeState.velocity.y < 0) {
117
+ // playFall();
118
+ // }
97
119
  }
98
120
  }
99
121
  });
122
+ return {
123
+ ref: ref,
124
+ };
100
125
  }
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { AnimationClip } from "three";
3
+ export type playPassiveActionsType = {
4
+ current: string;
5
+ animations: AnimationClip[];
6
+ };
7
+ export default function playPassiveActions({ current, animations, }: playPassiveActionsType): {
8
+ animationRef: import("react").MutableRefObject<import("three").Object3D<import("three").Object3DEventMap>>;
9
+ };
@@ -0,0 +1,16 @@
1
+ import { useAnimations } from "@react-three/drei";
2
+ import { useEffect } from "react";
3
+ export default function playPassiveActions(_a) {
4
+ var current = _a.current, animations = _a.animations;
5
+ var _b = useAnimations(animations), actions = _b.actions, animationRef = _b.ref;
6
+ useEffect(function () {
7
+ var _a;
8
+ var action = (_a = actions[current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
9
+ return function () {
10
+ action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
11
+ };
12
+ }, [current]);
13
+ return {
14
+ animationRef: animationRef,
15
+ };
16
+ }
@@ -3,7 +3,7 @@ export default function normal(prop) {
3
3
  var state = prop.state, perspectiveCamera = prop.controllerContext.perspectiveCamera, activeState = prop.worldContext.activeState;
4
4
  var cameraPosition = activeState.position
5
5
  .clone()
6
- .add(V3(perspectiveCamera.XZDistance, perspectiveCamera.YDistance, 0));
6
+ .add(V3(0, perspectiveCamera.YDistance, perspectiveCamera.XZDistance));
7
7
  state.camera.position.lerp(cameraPosition, 1);
8
8
  state.camera.lookAt(activeState.position.clone());
9
9
  }
@@ -0,0 +1,2 @@
1
+ import { cameraPropType } from "../../physics/type";
2
+ export default function detector(cameraProp: cameraPropType): void;
@@ -0,0 +1,25 @@
1
+ import * as THREE from "three";
2
+ export default function detector(cameraProp) {
3
+ var cameraRay = cameraProp.cameraRay, intersectObjectMap = cameraProp.intersectObjectMap;
4
+ var intersects = cameraRay.rayCast.intersectObjects(Object.values(intersectObjectMap));
5
+ var intersectId = {};
6
+ intersects.map(function (_a) {
7
+ var object = _a.object;
8
+ if (object instanceof THREE.Mesh) {
9
+ intersectId[object.uuid] = true;
10
+ }
11
+ });
12
+ Object.values(intersectObjectMap).map(function (mesh) {
13
+ if (mesh instanceof THREE.Mesh && mesh.material instanceof THREE.Material) {
14
+ var material = mesh.material;
15
+ if (intersectId[mesh.uuid]) {
16
+ material.opacity = 0.2;
17
+ material.transparent = true;
18
+ }
19
+ else {
20
+ material.opacity = 1;
21
+ material.transparent = false;
22
+ }
23
+ }
24
+ });
25
+ }
@@ -1,7 +1,7 @@
1
- import { propType, refsType } from "../controller/type";
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
2
  export default function Camera({ refs, prop, control, }: {
3
3
  refs: refsType;
4
- prop: propType;
4
+ prop: controllerInnerType;
5
5
  control: {
6
6
  [key: string]: boolean;
7
7
  };
@@ -12,14 +12,14 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
13
  import { MapControls, OrbitControls, OrthographicCamera, PerspectiveCamera, } from "@react-three/drei";
14
14
  import { useFrame, useThree } from "@react-three/fiber";
15
- import { useContext } from "react";
15
+ import { useContext, useEffect, useMemo } from "react";
16
16
  import * as THREE from "three";
17
17
  import { GaesupControllerContext } from "../controller/context";
18
18
  import { GaesupWorldContext } from "../world/context";
19
- import cameraCollisionDetector from "./cameraCollisionDetecter";
20
19
  import mapControl from "./control/map";
21
20
  import normal from "./control/normal";
22
21
  import orbit from "./control/orbit";
22
+ import detector from "./detector";
23
23
  export default function Camera(_a) {
24
24
  var refs = _a.refs, prop = _a.prop, control = _a.control;
25
25
  var worldContext = useContext(GaesupWorldContext);
@@ -27,11 +27,10 @@ export default function Camera(_a) {
27
27
  var cameraMode = controllerContext.cameraMode, perspectiveCamera = controllerContext.perspectiveCamera, orthographicCamera = controllerContext.orthographicCamera;
28
28
  var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef;
29
29
  var cameraRay = prop.cameraRay;
30
- var checkCollision = cameraCollisionDetector(prop).checkCollision;
31
- var scene = useThree().scene;
30
+ var _b = useThree(), camera = _b.camera, scene = _b.scene;
32
31
  var activeState = worldContext.activeState;
33
- var intersectObjectMap = {};
34
- var cameraProp = __assign(__assign({}, prop), { checkCollision: checkCollision, control: control, controllerContext: controllerContext, worldContext: worldContext });
32
+ var intersectObjectMap = useMemo(function () { return ({}); }, []);
33
+ var cameraProp = __assign(__assign({}, prop), { control: control, controllerContext: controllerContext, worldContext: worldContext, intersectObjectMap: intersectObjectMap });
35
34
  var getMeshs = function (object) {
36
35
  if (object.userData && object.userData.intangible)
37
36
  return;
@@ -43,6 +42,9 @@ export default function Camera(_a) {
43
42
  getMeshs(child);
44
43
  });
45
44
  };
45
+ useEffect(function () {
46
+ scene.children.forEach(function (child) { return getMeshs(child); });
47
+ }, []);
46
48
  useFrame(function (state, delta) {
47
49
  if (!rigidBodyRef ||
48
50
  !rigidBodyRef.current ||
@@ -52,8 +54,6 @@ export default function Camera(_a) {
52
54
  cameraProp.state = state;
53
55
  cameraProp.delta = delta;
54
56
  if (cameraMode.cameraType === "perspective") {
55
- scene.children.forEach(function (child) { return getMeshs(child); });
56
- cameraRay.intersectObjectMap = intersectObjectMap;
57
57
  if (cameraMode.controlType === "orbit") {
58
58
  orbit(cameraProp);
59
59
  }
@@ -64,6 +64,10 @@ export default function Camera(_a) {
64
64
  else if (cameraMode.cameraType === "orthographic") {
65
65
  mapControl(cameraProp);
66
66
  }
67
+ var distV3 = camera.position.clone().sub(activeState.position);
68
+ cameraRay.origin.copy(camera.position);
69
+ cameraRay.dir.copy(distV3.negate().normalize());
70
+ detector(cameraProp);
67
71
  });
68
72
  return (_jsxs(_Fragment, { children: [cameraMode.cameraType === "perspective" && (_jsxs(_Fragment, { children: [_jsx(OrbitControls, { target: activeState.position }), _jsx(PerspectiveCamera, __assign({ makeDefault: true }, perspectiveCamera))] })), cameraMode.cameraType === "orthographic" && (_jsxs(_Fragment, { children: [_jsx(MapControls, { target: activeState.position }), _jsx(OrthographicCamera, __assign({ makeDefault: true }, orthographicCamera))] }))] }));
69
73
  }
@@ -2,16 +2,12 @@ export type cameraRayType = {
2
2
  origin: THREE.Vector3;
3
3
  hit: THREE.Raycaster;
4
4
  rayCast: THREE.Raycaster | null;
5
- lerpingPoint: THREE.Vector3;
6
5
  length: number;
7
6
  dir: THREE.Vector3;
8
7
  position: THREE.Vector3;
9
- followCamera: THREE.Object3D;
10
- pivot: THREE.Object3D;
11
- intersetesAndTransParented: THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>>[];
12
- intersects: THREE.Intersection<THREE.Object3D<THREE.Object3DEventMap>>[];
13
- intersectObjects: THREE.Object3D[];
8
+ intersects: THREE.Intersection<THREE.Mesh>[];
9
+ detected: THREE.Intersection<THREE.Mesh>[];
14
10
  intersectObjectMap: {
15
- [uuid: string]: THREE.Object3D;
11
+ [uuid: string]: THREE.Mesh;
16
12
  };
17
13
  };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { Collider } from "@dimforge/rapier3d-compat";
3
+ import { controllerInnerType } from "../../../controller/type";
4
+ export declare const AirplaneCollider: import("react").ForwardRefExoticComponent<{
5
+ props: controllerInnerType;
6
+ } & import("react").RefAttributes<Collider>>;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { CuboidCollider, useRapier } from "@react-three/rapier";
3
+ import { forwardRef, useContext } from "react";
4
+ import { getRayHit, useForwardRef } from "../../../utils";
5
+ import { GaesupWorldContext } from "../../../world/context";
6
+ export var AirplaneCollider = forwardRef(function (_a, ref) {
7
+ var _b;
8
+ var props = _a.props;
9
+ var collider = useContext(GaesupWorldContext).airplaneCollider;
10
+ var airplaneSizeX = collider.airplaneSizeX, airplaneSizeY = collider.airplaneSizeY, airplaneSizeZ = collider.airplaneSizeZ;
11
+ var colliderRef = useForwardRef(ref);
12
+ var rapier = useRapier().rapier;
13
+ var groundRay = props.groundRay;
14
+ groundRay.length = airplaneSizeY * 5 + 2;
15
+ groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
16
+ groundRay.hit = getRayHit({
17
+ ray: groundRay,
18
+ ref: colliderRef,
19
+ });
20
+ groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
21
+ return (_jsx(CuboidCollider, { ref: ref, args: [airplaneSizeX / 2, airplaneSizeY / 2, airplaneSizeZ / 2], position: [0, airplaneSizeY / 2, 0] }));
22
+ });
@@ -0,0 +1,5 @@
1
+ import { controllerInnerType, refsType } from "../../../controller/type";
2
+ export declare function AirplaneRef({ props, refs, }: {
3
+ props: controllerInnerType;
4
+ refs: refsType;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,11 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import { GaesupWorldContext } from "../../../world/context";
4
+ import { InnerGroupRef } from "../common/InnerGroupRef";
5
+ import { WrapperRef } from "../common/WrapperRef";
6
+ import { AirplaneCollider } from "./collider";
7
+ export function AirplaneRef(_a) {
8
+ var props = _a.props, refs = _a.refs;
9
+ var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, airplaneGltf = _b.airplaneGltf;
10
+ return (_jsxs(WrapperRef, { props: props, refs: refs, gltf: airplaneGltf, children: [props.isRider && (_jsx(InnerGroupRef, { props: props, gltf: characterGltf, ref: refs.characterInnerRef })), _jsx(AirplaneCollider, { props: props })] }));
11
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { Collider } from "@dimforge/rapier3d-compat";
3
+ import { controllerInnerType } from "../../../controller/type";
4
+ export declare const CharacterCapsuleCollider: import("react").ForwardRefExoticComponent<{
5
+ props: controllerInnerType;
6
+ } & import("react").RefAttributes<Collider>>;
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CapsuleCollider, useRapier } from "@react-three/rapier";
3
+ import { forwardRef, useContext } from "react";
4
+ import { getRayHit, useForwardRef } from "../../../utils";
5
+ import { GaesupWorldContext } from "../../../world/context";
6
+ export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
7
+ var _b;
8
+ var props = _a.props;
9
+ var collider = useContext(GaesupWorldContext).characterCollider;
10
+ var colliderRef = useForwardRef(ref);
11
+ var rapier = useRapier().rapier;
12
+ var groundRay = props.groundRay, slopeRay = props.slopeRay;
13
+ groundRay.length = collider.radius + 2;
14
+ groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
15
+ groundRay.hit = getRayHit({
16
+ ray: groundRay,
17
+ ref: colliderRef,
18
+ });
19
+ groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
20
+ slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
21
+ slopeRay.length = collider.radius + 3;
22
+ slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
23
+ return (_jsx(_Fragment, { children: _jsx(CapsuleCollider, { ref: ref, args: [collider.height, collider.radius], position: [0, collider.height + collider.radius, 0] }) }));
24
+ });
@@ -0,0 +1,5 @@
1
+ import { controllerInnerType, refsType } from "../../../controller/type";
2
+ export declare function CharacterRef({ props, refs, }: {
3
+ props: controllerInnerType;
4
+ refs: refsType;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useContext } from "react";
3
+ import initCallback from "../../../controller/initialize/callback";
4
+ import { GaesupWorldContext } from "../../../world/context";
5
+ import { CharacterCapsuleCollider } from "./collider";
6
+ import playCharacterActions from "../../../animation/actions";
7
+ import { WrapperRef } from "../common/WrapperRef";
8
+ export function CharacterRef(_a) {
9
+ var props = _a.props, refs = _a.refs;
10
+ initCallback(props);
11
+ var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, characterCollider = _b.characterCollider, vehicleCollider = _b.vehicleCollider;
12
+ var ref = playCharacterActions({
13
+ groundRay: props.groundRay,
14
+ }).ref;
15
+ return (_jsx(WrapperRef, { props: props, refs: refs, gltf: characterGltf, animationRef: ref, children: _jsx(CharacterCapsuleCollider, { props: props, ref: refs.capsuleColliderRef }) }));
16
+ }
@@ -0,0 +1,10 @@
1
+ import { Ref } from "react";
2
+ import { controllerInnerType } from "../../../controller/type";
3
+ import * as THREE from "three";
4
+ import { GLTFResult } from "../../type";
5
+ export type InnerGroupRefType = {
6
+ props: controllerInnerType;
7
+ animationRef?: Ref<THREE.Object3D<THREE.Object3DEventMap>>;
8
+ gltf: GLTFResult;
9
+ };
10
+ export declare const InnerGroupRef: import("react").ForwardRefExoticComponent<InnerGroupRefType & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
@@ -0,0 +1,32 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { forwardRef, useMemo } from "react";
14
+ import { useGraph } from "@react-three/fiber";
15
+ import * as THREE from "three";
16
+ import { SkeletonUtils } from "three-stdlib";
17
+ export var InnerGroupRef = forwardRef(function (_a, ref) {
18
+ var props = _a.props, animationRef = _a.animationRef, gltf = _a.gltf;
19
+ var scene = gltf.scene;
20
+ var clone = useMemo(function () { return SkeletonUtils.clone(scene); }, [scene]);
21
+ var nodes = useGraph(clone).nodes;
22
+ var objectNode = Object.values(nodes).find(function (node) { return node.type === "Object3D"; });
23
+ return (_jsxs("group", __assign({ receiveShadow: true, castShadow: true }, props.groupProps, { ref: ref, children: [objectNode && animationRef && (_jsx("primitive", { object: objectNode, visible: false, receiveShadow: true, castShadow: true, ref: animationRef })), Object.keys(nodes).map(function (name, key) {
24
+ var node = nodes[name];
25
+ if (node instanceof THREE.SkinnedMesh) {
26
+ return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry, skeleton: node.skeleton }, key));
27
+ }
28
+ else if (node instanceof THREE.Mesh) {
29
+ return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry }, key));
30
+ }
31
+ })] })));
32
+ });
@@ -0,0 +1,6 @@
1
+ import { ReactNode } from "react";
2
+ import { controllerType } from "../../../controller/type";
3
+ export declare const OuterGroupRef: import("react").ForwardRefExoticComponent<{
4
+ props: controllerType;
5
+ children: ReactNode;
6
+ } & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
@@ -9,16 +9,9 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- export function gaesupToolsReducer(props, action) {
13
- switch (action.type) {
14
- case "init": {
15
- return __assign({}, props);
16
- }
17
- case "update": {
18
- return __assign(__assign({}, props), action.payload);
19
- }
20
- default: {
21
- throw Error("Unknown action: " + action.type);
22
- }
23
- }
24
- }
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { forwardRef } from "react";
14
+ export var OuterGroupRef = forwardRef(function (_a, ref) {
15
+ var props = _a.props, children = _a.children;
16
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.vehicle, { children: children })));
17
+ });
@@ -0,0 +1,7 @@
1
+ import { RapierRigidBody } from "@react-three/rapier";
2
+ import { ReactNode } from "react";
3
+ import { controllerInnerType } from "../../../controller/type";
4
+ export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
5
+ props: controllerInnerType;
6
+ children: ReactNode;
7
+ } & import("react").RefAttributes<RapierRigidBody>>;
@@ -0,0 +1,18 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { RigidBody } from "@react-three/rapier";
14
+ import { forwardRef } from "react";
15
+ export var RigidBodyRef = forwardRef(function (_a, ref) {
16
+ var props = _a.props, children = _a.children;
17
+ return (_jsx(RigidBody, __assign({ colliders: false, ref: ref }, props.rigidBodyProps, { children: children })));
18
+ });
@@ -0,0 +1,12 @@
1
+ import { ReactNode, Ref } from "react";
2
+ import * as THREE from "three";
3
+ import { controllerInnerType, refsType } from "../../../controller/type";
4
+ import { GLTFResult } from "../../type";
5
+ export declare function WrapperRef({ children, outerChildren, props, refs, gltf, animationRef, }: {
6
+ children: ReactNode;
7
+ outerChildren?: ReactNode;
8
+ props: controllerInnerType;
9
+ refs: refsType;
10
+ gltf: GLTFResult;
11
+ animationRef?: Ref<THREE.Object3D<THREE.Object3DEventMap>>;
12
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { InnerGroupRef } from "../common/InnerGroupRef";
3
+ import { OuterGroupRef } from "../common/OuterGroupRef";
4
+ import { SlopeRayRef } from "../common/slopeRayRef";
5
+ import { RigidBodyRef } from "./RigidbodyRef";
6
+ export function WrapperRef(_a) {
7
+ var children = _a.children, outerChildren = _a.outerChildren, props = _a.props, refs = _a.refs, gltf = _a.gltf, animationRef = _a.animationRef;
8
+ return (_jsxs(OuterGroupRef, { ref: refs.outerGroupRef, props: props, children: [_jsxs(RigidBodyRef, { ref: refs.rigidBodyRef, props: props, children: [_jsx(SlopeRayRef, { slopeRay: props.slopeRay, groundRay: props.groundRay, ref: refs.slopeRayOriginRef }), children, props.children, _jsx(InnerGroupRef, { props: props, gltf: gltf, ref: refs.innerGroupRef, animationRef: animationRef })] }), outerChildren] }));
9
+ }
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { groundRayType, slopeRayType } from "../../../controller/type";
3
+ export declare const SlopeRayRef: import("react").ForwardRefExoticComponent<{
4
+ groundRay: groundRayType;
5
+ slopeRay: slopeRayType;
6
+ } & import("react").RefAttributes<import("three").Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes>, import("three").Material | import("three").Material[], import("three").Object3DEventMap>>>;
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
3
+ export var SlopeRayRef = forwardRef(function (_a, ref) {
4
+ var groundRay = _a.groundRay, slopeRay = _a.slopeRay;
5
+ return (_jsx("mesh", { position: [
6
+ groundRay.offset.x,
7
+ groundRay.offset.y,
8
+ groundRay.offset.z + slopeRay.offset.z,
9
+ ], ref: ref, visible: false, children: _jsx("boxGeometry", { args: [0.15, 0.15, 0.15] }) }));
10
+ });
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import { Collider } from "@dimforge/rapier3d-compat";
3
+ export declare const VehicleCollider: import("react").ForwardRefExoticComponent<import("react").RefAttributes<Collider>>;