gaesup-world 0.6.1 → 0.6.31

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 (256) hide show
  1. package/dist/gaesup/animation/actions.d.ts +50 -0
  2. package/dist/gaesup/animation/actions.js +123 -0
  3. package/dist/gaesup/camera/control/normal.d.ts +4 -0
  4. package/dist/gaesup/camera/control/normal.js +18 -0
  5. package/dist/gaesup/camera/control/orbit.d.ts +4 -0
  6. package/dist/gaesup/camera/control/orbit.js +22 -0
  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 +8 -0
  10. package/dist/gaesup/camera/index.js +99 -0
  11. package/dist/gaesup/camera/type.d.ts +14 -0
  12. package/dist/gaesup/camera/type.js +1 -0
  13. package/dist/gaesup/component/active/airplane/index.d.ts +14 -0
  14. package/dist/gaesup/component/active/airplane/index.js +38 -0
  15. package/dist/gaesup/component/active/character/index.d.ts +7 -0
  16. package/dist/gaesup/component/active/character/index.js +39 -0
  17. package/dist/gaesup/component/active/vehicle/index.d.ts +14 -0
  18. package/dist/gaesup/component/active/vehicle/index.js +38 -0
  19. package/dist/gaesup/component/index.d.ts +7 -0
  20. package/dist/gaesup/component/index.js +19 -0
  21. package/dist/gaesup/component/inner/airplane/index.d.ts +2 -0
  22. package/dist/gaesup/component/inner/airplane/index.js +16 -0
  23. package/dist/gaesup/component/inner/character/index.d.ts +29 -0
  24. package/dist/gaesup/component/inner/character/index.js +28 -0
  25. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +10 -0
  26. package/dist/gaesup/component/inner/common/InnerGroupRef.js +29 -0
  27. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +5 -0
  28. package/dist/gaesup/component/inner/common/OuterGroupRef.js +6 -0
  29. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +15 -0
  30. package/dist/gaesup/component/inner/common/RigidbodyRef.js +15 -0
  31. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +9 -0
  32. package/dist/gaesup/component/inner/common/setGroundRay.js +14 -0
  33. package/dist/gaesup/component/inner/common/type.d.ts +22 -0
  34. package/dist/gaesup/component/inner/common/type.js +1 -0
  35. package/dist/gaesup/component/inner/rider/index.d.ts +11 -0
  36. package/dist/gaesup/component/inner/rider/index.js +31 -0
  37. package/dist/gaesup/component/inner/vehicle/collider.d.ts +11 -0
  38. package/dist/gaesup/component/inner/vehicle/collider.js +19 -0
  39. package/dist/gaesup/component/inner/vehicle/index.d.ts +2 -0
  40. package/dist/gaesup/component/inner/vehicle/index.js +17 -0
  41. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +8 -0
  42. package/dist/gaesup/component/inner/vehicle/wheels.js +64 -0
  43. package/dist/gaesup/component/passive/airplane/index.d.ts +15 -0
  44. package/dist/gaesup/component/passive/airplane/index.js +40 -0
  45. package/dist/gaesup/component/passive/character/index.d.ts +15 -0
  46. package/dist/gaesup/component/passive/character/index.js +35 -0
  47. package/dist/gaesup/component/passive/type.d.ts +20 -0
  48. package/dist/gaesup/component/passive/type.js +1 -0
  49. package/dist/gaesup/component/passive/vehicle/index.d.ts +15 -0
  50. package/dist/gaesup/component/passive/vehicle/index.js +17 -0
  51. package/dist/gaesup/component/type.d.ts +18 -0
  52. package/dist/gaesup/component/type.js +1 -0
  53. package/dist/gaesup/controller/context/index.d.ts +49 -0
  54. package/dist/gaesup/controller/context/index.js +59 -0
  55. package/dist/gaesup/controller/context/reducer.d.ts +12 -0
  56. package/dist/gaesup/controller/context/reducer.js +21 -0
  57. package/dist/gaesup/controller/context/type.d.ts +39 -0
  58. package/dist/gaesup/controller/context/type.js +1 -0
  59. package/dist/gaesup/controller/debug/airplane.d.ts +71 -0
  60. package/dist/gaesup/controller/debug/airplane.js +71 -0
  61. package/dist/gaesup/controller/debug/character.d.ts +27 -0
  62. package/dist/gaesup/controller/debug/character.js +27 -0
  63. package/dist/gaesup/controller/debug/index.d.ts +6 -0
  64. package/dist/gaesup/controller/debug/index.js +49 -0
  65. package/dist/gaesup/controller/debug/vehicle.d.ts +27 -0
  66. package/dist/gaesup/controller/debug/vehicle.js +27 -0
  67. package/dist/gaesup/controller/index.d.ts +3 -0
  68. package/dist/gaesup/controller/index.js +75 -0
  69. package/dist/gaesup/controller/initialize/callback/index.d.ts +8 -0
  70. package/dist/gaesup/controller/initialize/callback/index.js +60 -0
  71. package/dist/gaesup/controller/initialize/callback/type.d.ts +27 -0
  72. package/dist/gaesup/controller/initialize/callback/type.js +1 -0
  73. package/dist/gaesup/controller/initialize/index.d.ts +10 -0
  74. package/dist/gaesup/controller/initialize/index.js +89 -0
  75. package/dist/gaesup/controller/style.css +48 -0
  76. package/dist/gaesup/controller/type.d.ts +85 -0
  77. package/dist/gaesup/controller/type.js +1 -0
  78. package/dist/gaesup/gaesupProps/index.d.ts +7 -0
  79. package/dist/gaesup/gaesupProps/index.js +46 -0
  80. package/dist/gaesup/hooks/useClicker/index.d.ts +4 -0
  81. package/dist/gaesup/hooks/useClicker/index.js +51 -0
  82. package/dist/gaesup/hooks/useFocus/index.d.ts +23 -0
  83. package/dist/gaesup/hooks/useFocus/index.js +190 -0
  84. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +10 -0
  85. package/dist/gaesup/hooks/useGaesupAnimation/index.js +95 -0
  86. package/dist/gaesup/hooks/useGaesupController/index.d.ts +10 -0
  87. package/dist/gaesup/hooks/useGaesupController/index.js +14 -0
  88. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +25 -0
  89. package/dist/gaesup/hooks/useGaesupGltf/index.js +73 -0
  90. package/dist/gaesup/hooks/useJoyStick/index.d.ts +39 -0
  91. package/dist/gaesup/hooks/useJoyStick/index.js +61 -0
  92. package/dist/gaesup/hooks/useMovePoint/index.d.ts +4 -0
  93. package/dist/gaesup/hooks/useMovePoint/index.js +45 -0
  94. package/dist/gaesup/hooks/usePushKey/index.d.ts +3 -0
  95. package/dist/gaesup/hooks/usePushKey/index.js +29 -0
  96. package/dist/gaesup/hooks/useRideable/index.d.ts +28 -0
  97. package/dist/gaesup/hooks/useRideable/index.js +199 -0
  98. package/dist/gaesup/hooks/useTeleport/index.d.ts +4 -0
  99. package/dist/gaesup/hooks/useTeleport/index.js +13 -0
  100. package/dist/gaesup/hooks/useZoom/index.d.ts +3 -0
  101. package/dist/gaesup/hooks/useZoom/index.js +18 -0
  102. package/dist/gaesup/physics/airplane/damping.d.ts +2 -0
  103. package/dist/gaesup/physics/airplane/damping.js +5 -0
  104. package/dist/gaesup/physics/airplane/direction.d.ts +2 -0
  105. package/dist/gaesup/physics/airplane/direction.js +65 -0
  106. package/dist/gaesup/physics/airplane/gravity.d.ts +14 -0
  107. package/dist/gaesup/physics/airplane/gravity.js +18 -0
  108. package/dist/gaesup/physics/airplane/impulse.d.ts +16 -0
  109. package/dist/gaesup/physics/airplane/impulse.js +31 -0
  110. package/dist/gaesup/physics/airplane/index.d.ts +2 -0
  111. package/dist/gaesup/physics/airplane/index.js +14 -0
  112. package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
  113. package/dist/gaesup/physics/airplane/innerCalc.js +27 -0
  114. package/dist/gaesup/physics/airplane/landing.d.ts +2 -0
  115. package/dist/gaesup/physics/airplane/landing.js +29 -0
  116. package/dist/gaesup/physics/character/direction.d.ts +22 -0
  117. package/dist/gaesup/physics/character/direction.js +62 -0
  118. package/dist/gaesup/physics/character/impulse.d.ts +2 -0
  119. package/dist/gaesup/physics/character/impulse.js +43 -0
  120. package/dist/gaesup/physics/character/index.d.ts +2 -0
  121. package/dist/gaesup/physics/character/index.js +10 -0
  122. package/dist/gaesup/physics/character/innerCalc.d.ts +2 -0
  123. package/dist/gaesup/physics/character/innerCalc.js +29 -0
  124. package/dist/gaesup/physics/character/stop.d.ts +2 -0
  125. package/dist/gaesup/physics/character/stop.js +8 -0
  126. package/dist/gaesup/physics/check/ground.d.ts +2 -0
  127. package/dist/gaesup/physics/check/ground.js +17 -0
  128. package/dist/gaesup/physics/check/index.d.ts +2 -0
  129. package/dist/gaesup/physics/check/index.js +12 -0
  130. package/dist/gaesup/physics/check/moving.d.ts +2 -0
  131. package/dist/gaesup/physics/check/moving.js +22 -0
  132. package/dist/gaesup/physics/check/push.d.ts +2 -0
  133. package/dist/gaesup/physics/check/push.js +6 -0
  134. package/dist/gaesup/physics/check/riding.d.ts +2 -0
  135. package/dist/gaesup/physics/check/riding.js +7 -0
  136. package/dist/gaesup/physics/check/rotate.d.ts +2 -0
  137. package/dist/gaesup/physics/check/rotate.js +8 -0
  138. package/dist/gaesup/physics/index.d.ts +2 -0
  139. package/dist/gaesup/physics/index.js +58 -0
  140. package/dist/gaesup/physics/type.d.ts +37 -0
  141. package/dist/gaesup/physics/type.js +1 -0
  142. package/dist/gaesup/physics/vehicle/damping.d.ts +2 -0
  143. package/dist/gaesup/physics/vehicle/damping.js +6 -0
  144. package/dist/gaesup/physics/vehicle/direction.d.ts +4 -0
  145. package/dist/gaesup/physics/vehicle/direction.js +30 -0
  146. package/dist/gaesup/physics/vehicle/impulse.d.ts +16 -0
  147. package/dist/gaesup/physics/vehicle/impulse.js +40 -0
  148. package/dist/gaesup/physics/vehicle/index.d.ts +2 -0
  149. package/dist/gaesup/physics/vehicle/index.js +12 -0
  150. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
  151. package/dist/gaesup/physics/vehicle/innerCalc.js +24 -0
  152. package/dist/gaesup/physics/vehicle/landing.d.ts +2 -0
  153. package/dist/gaesup/physics/vehicle/landing.js +29 -0
  154. package/dist/gaesup/tools/clicker/index.d.ts +5 -0
  155. package/dist/gaesup/tools/clicker/index.js +8 -0
  156. package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +9 -0
  157. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +16 -0
  158. package/dist/gaesup/tools/gameBoy/index.d.ts +8 -0
  159. package/dist/gaesup/tools/gameBoy/index.js +22 -0
  160. package/dist/gaesup/tools/gameBoy/style.css +92 -0
  161. package/dist/gaesup/tools/gameBoy/type.d.ts +4 -0
  162. package/dist/gaesup/tools/gameBoy/type.js +1 -0
  163. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +8 -0
  164. package/dist/gaesup/tools/gamePad/GamePadButton.js +21 -0
  165. package/dist/gaesup/tools/gamePad/index.d.ts +6 -0
  166. package/dist/gaesup/tools/gamePad/index.js +34 -0
  167. package/dist/gaesup/tools/gamePad/style.css +62 -0
  168. package/dist/gaesup/tools/gamePad/type.d.ts +6 -0
  169. package/dist/gaesup/tools/gamePad/type.js +1 -0
  170. package/dist/gaesup/tools/joyStick/index.d.ts +6 -0
  171. package/dist/gaesup/tools/joyStick/index.js +169 -0
  172. package/dist/gaesup/tools/joyStick/style.css +38 -0
  173. package/dist/gaesup/tools/joyStick/type.d.ts +19 -0
  174. package/dist/gaesup/tools/joyStick/type.js +1 -0
  175. package/dist/gaesup/tools/jumpPortal/index.d.ts +17 -0
  176. package/dist/gaesup/tools/jumpPortal/index.js +18 -0
  177. package/dist/gaesup/tools/jumpPortal/style.css +16 -0
  178. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +402 -0
  179. package/dist/gaesup/tools/keyBoardToolTip/constant.js +122 -0
  180. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +10 -0
  181. package/dist/gaesup/tools/keyBoardToolTip/default.js +12 -0
  182. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +3 -0
  183. package/dist/gaesup/tools/keyBoardToolTip/index.js +71 -0
  184. package/dist/gaesup/tools/keyBoardToolTip/style.css +24 -0
  185. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +37 -0
  186. package/dist/gaesup/tools/keyBoardToolTip/type.js +1 -0
  187. package/dist/gaesup/tools/miniMap/default.d.ts +9 -0
  188. package/dist/gaesup/tools/miniMap/default.js +9 -0
  189. package/dist/gaesup/tools/miniMap/index.d.ts +3 -0
  190. package/dist/gaesup/tools/miniMap/index.js +72 -0
  191. package/dist/gaesup/tools/miniMap/style.css +228 -0
  192. package/dist/gaesup/tools/miniMap/type.d.ts +25 -0
  193. package/dist/gaesup/tools/miniMap/type.js +1 -0
  194. package/dist/gaesup/tools/rideable/index.d.ts +3 -0
  195. package/dist/gaesup/tools/rideable/index.js +79 -0
  196. package/dist/gaesup/tools/rideable/style.css +16 -0
  197. package/dist/gaesup/tools/type.d.ts +2 -0
  198. package/dist/gaesup/tools/type.js +1 -0
  199. package/dist/gaesup/tools/zoomButton/index.d.ts +19 -0
  200. package/dist/gaesup/tools/zoomButton/index.js +146 -0
  201. package/dist/gaesup/tools/zoomButton/style.css +16 -0
  202. package/dist/gaesup/utils/context.d.ts +2 -0
  203. package/dist/gaesup/utils/context.js +3 -0
  204. package/dist/gaesup/utils/debug.d.ts +30 -0
  205. package/dist/gaesup/utils/debug.js +36 -0
  206. package/dist/gaesup/utils/index.d.ts +3 -0
  207. package/dist/gaesup/utils/index.js +3 -0
  208. package/dist/gaesup/utils/innerHtml.d.ts +4 -0
  209. package/dist/gaesup/utils/innerHtml.js +41 -0
  210. package/dist/gaesup/utils/ray.d.ts +7 -0
  211. package/dist/gaesup/utils/ray.js +6 -0
  212. package/dist/gaesup/utils/ref.d.ts +2 -0
  213. package/dist/gaesup/utils/ref.js +16 -0
  214. package/dist/gaesup/utils/type.d.ts +5 -0
  215. package/dist/gaesup/utils/type.js +1 -0
  216. package/dist/gaesup/utils/vector.d.ts +10 -0
  217. package/dist/gaesup/utils/vector.js +33 -0
  218. package/dist/gaesup/world/context/index.d.ts +6 -0
  219. package/dist/gaesup/world/context/index.js +128 -0
  220. package/dist/gaesup/world/context/reducer.d.ts +30 -0
  221. package/dist/gaesup/world/context/reducer.js +21 -0
  222. package/dist/gaesup/world/context/type.d.ts +183 -0
  223. package/dist/gaesup/world/context/type.js +1 -0
  224. package/dist/gaesup/world/debug/cameraOption.d.ts +47 -0
  225. package/dist/gaesup/world/debug/cameraOption.js +47 -0
  226. package/dist/gaesup/world/debug/index.d.ts +6 -0
  227. package/dist/gaesup/world/debug/index.js +32 -0
  228. package/dist/gaesup/world/debug/mode.d.ts +10 -0
  229. package/dist/gaesup/world/debug/mode.js +10 -0
  230. package/dist/gaesup/world/index.d.ts +3 -0
  231. package/dist/gaesup/world/index.js +9 -0
  232. package/dist/gaesup/world/initalize/index.d.ts +36 -0
  233. package/dist/gaesup/world/initalize/index.js +63 -0
  234. package/dist/gaesup/world/style.css +13 -0
  235. package/dist/gaesup/world/type.d.ts +20 -0
  236. package/dist/gaesup/world/type.js +1 -0
  237. package/dist/index.d.ts +29 -0
  238. package/dist/index.js +29 -0
  239. package/package.json +13 -14
  240. package/.vscode/extensions.json +0 -7
  241. package/.vscode/settings.json +0 -10
  242. package/.yarn/sdks/eslint/bin/eslint.js +0 -20
  243. package/.yarn/sdks/eslint/lib/api.js +0 -20
  244. package/.yarn/sdks/eslint/lib/unsupported-api.js +0 -20
  245. package/.yarn/sdks/eslint/package.json +0 -14
  246. package/.yarn/sdks/integrations.yml +0 -5
  247. package/.yarn/sdks/prettier/bin/prettier.cjs +0 -20
  248. package/.yarn/sdks/prettier/index.cjs +0 -20
  249. package/.yarn/sdks/prettier/package.json +0 -7
  250. package/.yarn/sdks/typescript/bin/tsc +0 -20
  251. package/.yarn/sdks/typescript/bin/tsserver +0 -20
  252. package/.yarn/sdks/typescript/lib/tsc.js +0 -20
  253. package/.yarn/sdks/typescript/lib/tsserver.js +0 -225
  254. package/.yarn/sdks/typescript/lib/tsserverlibrary.js +0 -225
  255. package/.yarn/sdks/typescript/lib/typescript.js +0 -20
  256. package/.yarn/sdks/typescript/package.json +0 -10
@@ -0,0 +1,50 @@
1
+ import { Ref } from "react";
2
+ import * as THREE from "three";
3
+ import { AnimationAction, AnimationClip, AnimationMixer, Object3D, Object3DEventMap } from "three";
4
+ import { groundRayType } from "../controller/type";
5
+ export type Api<T extends AnimationClip> = {
6
+ ref: React.MutableRefObject<Object3D | undefined | null>;
7
+ clips: AnimationClip[];
8
+ mixer: AnimationMixer;
9
+ names: T["name"][];
10
+ actions: {
11
+ [key in T["name"]]: AnimationAction | null;
12
+ };
13
+ };
14
+ export type playActionsType = {
15
+ type: "character" | "vehicle" | "airplane";
16
+ animationResult: Api<AnimationClip>;
17
+ currentAnimation?: string;
18
+ };
19
+ export type subscribeActionsType = {
20
+ type: "character" | "vehicle" | "airplane";
21
+ groundRay: groundRayType;
22
+ animations: AnimationClip[];
23
+ };
24
+ export type actionsType = {
25
+ [x: string]: THREE.AnimationAction | null;
26
+ };
27
+ export type playResultType = {
28
+ actions: actionsType;
29
+ ref: Ref<Object3D<Object3DEventMap>>;
30
+ };
31
+ export declare function subscribeActions({ type, groundRay, animations, }: subscribeActionsType): {
32
+ animationResult: {
33
+ ref: import("react").MutableRefObject<THREE.Object3D<THREE.Object3DEventMap>>;
34
+ clips: THREE.AnimationClip[];
35
+ mixer: THREE.AnimationMixer;
36
+ names: string[];
37
+ actions: {
38
+ [x: string]: THREE.AnimationAction;
39
+ };
40
+ };
41
+ };
42
+ export default function playActions({ type, animationResult, currentAnimation, }: playActionsType): {
43
+ animationRef: import("react").MutableRefObject<THREE.Object3D<THREE.Object3DEventMap>>;
44
+ currentAnimation: string;
45
+ };
46
+ export declare const setAnimation: ({ currentAnimation, actions, type, }: {
47
+ currentAnimation?: string;
48
+ actions?: actionsType;
49
+ type?: "character" | "vehicle" | "airplane";
50
+ }) => void;
@@ -0,0 +1,123 @@
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 { useAnimations } from "@react-three/drei";
13
+ import { useFrame } from "@react-three/fiber";
14
+ import { useContext, useEffect } from "react";
15
+ import { useGaesupAnimation } from "../hooks/useGaesupAnimation";
16
+ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
17
+ export function subscribeActions(_a) {
18
+ var type = _a.type, groundRay = _a.groundRay, animations = _a.animations;
19
+ var _b = useContext(GaesupWorldContext), states = _b.states, activeState = _b.activeState;
20
+ var subscribeAll = useGaesupAnimation({ type: type }).subscribeAll;
21
+ var animationResult = useAnimations(animations);
22
+ // 초기 기본 애니메이션 등록
23
+ useEffect(function () {
24
+ subscribeAll([
25
+ {
26
+ tag: "walk",
27
+ condition: function () { return !states.isRunning && states.isMoving; },
28
+ action: function () { },
29
+ animationName: "walk",
30
+ key: "walk",
31
+ },
32
+ {
33
+ tag: "run",
34
+ condition: function () { return states.isRunning; },
35
+ action: function () { },
36
+ animationName: "run",
37
+ key: "run",
38
+ },
39
+ {
40
+ tag: "jump",
41
+ condition: function () { return states.isJumping; },
42
+ action: function () { },
43
+ animationName: "jump",
44
+ key: "jump",
45
+ },
46
+ {
47
+ tag: "fall",
48
+ condition: function () { return groundRay.hit === null && activeState.velocity.y < 0; },
49
+ action: function () { },
50
+ animationName: "fall",
51
+ key: "fall",
52
+ },
53
+ {
54
+ tag: "ride",
55
+ condition: function () { return states.isPush["keyR"]; },
56
+ action: function () { },
57
+ animationName: "ride",
58
+ key: "ride",
59
+ },
60
+ ]);
61
+ }, []);
62
+ return {
63
+ animationResult: animationResult,
64
+ };
65
+ }
66
+ export default function playActions(_a) {
67
+ var _b;
68
+ var type = _a.type, animationResult = _a.animationResult, currentAnimation = _a.currentAnimation;
69
+ var _c = useContext(GaesupWorldContext), mode = _c.mode, animationState = _c.animationState, block = _c.block;
70
+ var dispatch = useContext(GaesupWorldDispatchContext);
71
+ var _d = useGaesupAnimation({ type: type }), notify = _d.notify, store = _d.store;
72
+ var actions = animationResult.actions, ref = animationResult.ref;
73
+ var play = function (tag) {
74
+ animationState[type].current = tag;
75
+ var currentAnimation = store[tag];
76
+ if (currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.action) {
77
+ currentAnimation.action();
78
+ }
79
+ dispatch({
80
+ type: "update",
81
+ payload: {
82
+ animationState: __assign({}, animationState),
83
+ },
84
+ });
85
+ };
86
+ useEffect(function () {
87
+ var _a;
88
+ var animation = "idle";
89
+ if (block.animation) {
90
+ animation = "idle";
91
+ }
92
+ else if (currentAnimation) {
93
+ animation = currentAnimation;
94
+ }
95
+ else if (animationState[type].current) {
96
+ animation = animationState[type].current;
97
+ }
98
+ var action = (_a = actions[animation]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
99
+ return function () {
100
+ action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
101
+ };
102
+ }, [currentAnimation, mode.type, block.animation]);
103
+ useFrame(function () {
104
+ if (!currentAnimation) {
105
+ var tag = notify();
106
+ play(tag);
107
+ }
108
+ });
109
+ return {
110
+ animationRef: ref,
111
+ currentAnimation: (_b = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _b === void 0 ? void 0 : _b.current,
112
+ };
113
+ }
114
+ export var setAnimation = function (_a) {
115
+ var currentAnimation = _a.currentAnimation, actions = _a.actions, type = _a.type;
116
+ useEffect(function () {
117
+ var _a;
118
+ var action = (_a = actions[currentAnimation]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
119
+ return function () {
120
+ action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
121
+ };
122
+ }, [currentAnimation, type]);
123
+ };
@@ -0,0 +1,4 @@
1
+ import { cameraPropType } from "../../physics/type";
2
+ import { activeStateType, cameraOptionType } from "../../world/context/type";
3
+ export declare const makeNormalCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
4
+ export default function normal(prop: cameraPropType): void;
@@ -0,0 +1,18 @@
1
+ import { V3 } from "../../utils/vector";
2
+ export var makeNormalCameraPosition = function (activeState, cameraOption) {
3
+ var YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
4
+ var cameraPosition = activeState.position
5
+ .clone()
6
+ .add(V3(0, YDistance, ZDistance));
7
+ return cameraPosition;
8
+ };
9
+ export default function normal(prop) {
10
+ var delta = prop.delta, state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
11
+ if (!state || !state.camera)
12
+ return;
13
+ // const cameraPosition = activeState.position
14
+ // .clone()
15
+ // .add(V3(0, cameraOption.YDistance, cameraOption.ZDistance));
16
+ state.camera.position.lerp(cameraOption.position.clone(), 1);
17
+ state.camera.lookAt(cameraOption.target);
18
+ }
@@ -0,0 +1,4 @@
1
+ import { cameraPropType } from "../../physics/type";
2
+ import { activeStateType, cameraOptionType } from "../../world/context/type";
3
+ export declare const makeOrbitCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
4
+ export default function orbit(prop: cameraPropType): void;
@@ -0,0 +1,22 @@
1
+ import { quat } from "@react-three/rapier";
2
+ import { V3 } from "../../utils/vector";
3
+ export var makeOrbitCameraPosition = function (activeState, cameraOption) {
4
+ var XDistance = cameraOption.XDistance, YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
5
+ var cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 1, Math.cos(activeState.euler.y))
6
+ .normalize()
7
+ .clone()
8
+ .multiply(V3(-XDistance, YDistance, -ZDistance)));
9
+ return cameraPosition;
10
+ };
11
+ export default function orbit(prop) {
12
+ var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
13
+ if (!state || !state.camera)
14
+ return;
15
+ var cameraPosition = makeOrbitCameraPosition(activeState, cameraOption);
16
+ state.camera.position.lerp(cameraPosition, 1);
17
+ state.camera.quaternion.copy(activeState.quat
18
+ .clone()
19
+ .multiply(quat().setFromAxisAngle(V3(0, 1, 0), Math.PI)));
20
+ state.camera.rotation.copy(activeState.euler);
21
+ state.camera.lookAt(activeState.position.clone());
22
+ }
@@ -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
+ }
@@ -0,0 +1,8 @@
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ export default function Camera({ refs, prop, control, }: {
3
+ refs: refsType;
4
+ prop: controllerInnerType;
5
+ control: {
6
+ [key: string]: boolean;
7
+ };
8
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,99 @@
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 { CameraControls } from "@react-three/drei";
14
+ import { useFrame, useThree } from "@react-three/fiber";
15
+ import { vec3 } from "@react-three/rapier";
16
+ import { useContext, useEffect, useMemo, useRef } from "react";
17
+ import * as THREE from "three";
18
+ import { GaesupControllerContext } from "../controller/context";
19
+ import { GaesupWorldContext } from "../world/context";
20
+ import normal, { makeNormalCameraPosition } from "./control/normal";
21
+ import orbit from "./control/orbit";
22
+ export default function Camera(_a) {
23
+ var refs = _a.refs, prop = _a.prop, control = _a.control;
24
+ var worldContext = useContext(GaesupWorldContext);
25
+ var controllerContext = useContext(GaesupControllerContext);
26
+ var mode = worldContext.mode, cameraOption = worldContext.cameraOption, activeState = worldContext.activeState;
27
+ var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef;
28
+ var camera = useThree().camera;
29
+ var cameraRef = useRef();
30
+ var intersectObjectMap = useMemo(function () { return ({}); }, []);
31
+ var cameraProp = __assign(__assign({}, prop), { control: control, controllerContext: controllerContext, worldContext: worldContext, intersectObjectMap: intersectObjectMap });
32
+ var position = useMemo(function () { return camera.position; }, []);
33
+ var dir = useMemo(function () { return vec3(); }, []);
34
+ cameraProp.cameraRay.rayCast = new THREE.Raycaster(cameraProp.cameraRay.origin, cameraProp.cameraRay.dir, 0, -cameraOption.maxDistance);
35
+ useEffect(function () {
36
+ cameraProp.cameraRay.origin.copy(position);
37
+ cameraProp.cameraRay.dir.copy(camera.getWorldDirection(dir));
38
+ }, [cameraProp]);
39
+ useFrame(function (state, delta) {
40
+ if (!rigidBodyRef ||
41
+ !rigidBodyRef.current ||
42
+ !outerGroupRef ||
43
+ !outerGroupRef.current)
44
+ return;
45
+ cameraProp.delta = delta;
46
+ cameraProp.state = state;
47
+ if (!worldContext.block.camera) {
48
+ if (mode.control === "orbit") {
49
+ orbit(cameraProp);
50
+ }
51
+ else if (mode.control === "normal") {
52
+ normal(cameraProp);
53
+ }
54
+ // detector(cameraProp);
55
+ }
56
+ });
57
+ // zoom
58
+ useEffect(function () {
59
+ if (cameraRef.current) {
60
+ cameraRef.current.zoomTo(worldContext.cameraOption.zoom, true);
61
+ }
62
+ }, [worldContext.cameraOption.zoom]);
63
+ // 포커스가 아닐 때 카메라 activeStae 따라가기
64
+ useFrame(function () {
65
+ if (!cameraOption.focus) {
66
+ cameraOption.target = activeState.position;
67
+ cameraOption.position = makeNormalCameraPosition(activeState, cameraOption);
68
+ }
69
+ });
70
+ // lookat
71
+ // useEffect(() => {
72
+ // if (cameraRef.current) {
73
+ // const currentCamera = camera.position.clone();
74
+ // if (cameraOption.focus) {
75
+ // cameraRef.current.setLookAt(
76
+ // currentCamera.x,
77
+ // currentCamera.y,
78
+ // currentCamera.z,
79
+ // cameraOption.target.x,
80
+ // cameraOption.target.y,
81
+ // cameraOption.target.z,
82
+ // true
83
+ // );
84
+ // // 포커스 품
85
+ // } else if (!cameraOption.focus) {
86
+ // cameraRef.current.setLookAt(
87
+ // currentCamera.x,
88
+ // currentCamera.y,
89
+ // currentCamera.z,
90
+ // activeState.position.x,
91
+ // activeState.position.y,
92
+ // activeState.position.z,
93
+ // true
94
+ // );
95
+ // }
96
+ // }
97
+ // }, [cameraOption.focus]);
98
+ return _jsx(CameraControls, { ref: cameraRef });
99
+ }
@@ -0,0 +1,14 @@
1
+ import * as THREE from "three";
2
+ export type cameraRayType = {
3
+ origin: THREE.Vector3;
4
+ hit: THREE.Raycaster;
5
+ rayCast: THREE.Raycaster | null;
6
+ length: number;
7
+ dir: THREE.Vector3;
8
+ position: THREE.Vector3;
9
+ intersects: THREE.Intersection<THREE.Mesh>[];
10
+ detected: THREE.Intersection<THREE.Mesh>[];
11
+ intersectObjectMap: {
12
+ [uuid: string]: THREE.Mesh;
13
+ };
14
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ import * as THREE from "three";
3
+ import { controllerInnerType, groundRayType, refsType } from "../../../controller/type";
4
+ import { urlsType } from "../../../world/context/type";
5
+ export declare function AirplaneRef({ children, props, groundRay, enableRiding, isRiderOn, offset, refs, urls, }: {
6
+ children: ReactNode;
7
+ props: controllerInnerType;
8
+ groundRay: groundRayType;
9
+ enableRiding?: boolean;
10
+ isRiderOn?: boolean;
11
+ offset?: THREE.Vector3;
12
+ refs: refsType;
13
+ urls: urlsType;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { vec3 } from "@react-three/rapier";
3
+ import playActions, { subscribeActions } from "../../../animation/actions";
4
+ import initCallback from "../../../controller/initialize/callback";
5
+ import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
6
+ import { AirplaneInnerRef } from "../../inner/airplane";
7
+ import { setGroundRay } from "../../inner/common/setGroundRay";
8
+ export function AirplaneRef(_a) {
9
+ var children = _a.children, props = _a.props, groundRay = _a.groundRay, enableRiding = _a.enableRiding, isRiderOn = _a.isRiderOn, offset = _a.offset, refs = _a.refs, urls = _a.urls;
10
+ var colliderRef = refs.colliderRef;
11
+ var _b = useGltfAndSize({ url: urls.vehicleUrl }), size = _b.size, gltf = _b.gltf;
12
+ groundRay.offset = vec3({
13
+ x: 0,
14
+ y: size.y * 5,
15
+ z: 0,
16
+ });
17
+ setGroundRay({
18
+ groundRay: groundRay,
19
+ length: size.y * 5,
20
+ colliderRef: colliderRef,
21
+ });
22
+ var animationResult = subscribeActions({
23
+ type: "airplane",
24
+ groundRay: groundRay,
25
+ animations: gltf.animations,
26
+ }).animationResult;
27
+ var currentAnimation = playActions({
28
+ type: "airplane",
29
+ animationResult: animationResult,
30
+ }).currentAnimation;
31
+ // callback
32
+ initCallback({
33
+ props: props,
34
+ animationResult: animationResult,
35
+ type: "airplane",
36
+ });
37
+ return (_jsx(AirplaneInnerRef, { refs: refs, urls: urls, isRiderOn: isRiderOn, enableRiding: enableRiding, offset: offset, currentAnimation: currentAnimation, children: children }));
38
+ }
@@ -0,0 +1,7 @@
1
+ import { controllerInnerType, refsType } from "../../../controller/type";
2
+ import { urlsType } from "../../../world/context/type";
3
+ export declare function CharacterRef({ props, refs, urls, }: {
4
+ props: controllerInnerType;
5
+ refs: refsType;
6
+ urls: urlsType;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { vec3 } from "@react-three/rapier";
3
+ import playActions, { subscribeActions } from "../../../animation/actions";
4
+ import initCallback from "../../../controller/initialize/callback";
5
+ import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
6
+ import { CharacterInnerRef, calcCharacterColliderProps, } from "../../inner/character";
7
+ import { setGroundRay } from "../../inner/common/setGroundRay";
8
+ export function CharacterRef(_a) {
9
+ var props = _a.props, refs = _a.refs, urls = _a.urls;
10
+ var colliderRef = refs.colliderRef;
11
+ var _b = useGltfAndSize({ url: urls.characterUrl }), size = _b.size, gltf = _b.gltf;
12
+ var collider = calcCharacterColliderProps(size);
13
+ props.groundRay.offset = vec3({
14
+ x: 0,
15
+ y: (collider === null || collider === void 0 ? void 0 : collider.halfHeight) ? -(collider === null || collider === void 0 ? void 0 : collider.halfHeight) : -1,
16
+ z: 0,
17
+ });
18
+ setGroundRay({
19
+ groundRay: props.groundRay,
20
+ length: ((collider === null || collider === void 0 ? void 0 : collider.height) || 0) + 2,
21
+ colliderRef: colliderRef,
22
+ });
23
+ var animationResult = subscribeActions({
24
+ type: "character",
25
+ groundRay: props.groundRay,
26
+ animations: gltf.animations,
27
+ }).animationResult;
28
+ var _c = playActions({
29
+ type: "character",
30
+ animationResult: animationResult,
31
+ }), animationRef = _c.animationRef, currentAnimation = _c.currentAnimation;
32
+ // callback
33
+ initCallback({
34
+ props: props,
35
+ animationResult: animationResult,
36
+ type: "character",
37
+ });
38
+ return (_jsx(CharacterInnerRef, { animationRef: animationRef, refs: refs, urls: urls, currentAnimation: currentAnimation, children: props.children }));
39
+ }
@@ -0,0 +1,14 @@
1
+ import { ReactNode } from "react";
2
+ import * as THREE from "three";
3
+ import { controllerInnerType, groundRayType, refsType } from "../../../controller/type";
4
+ import { urlsType } from "../../../world/context/type";
5
+ export declare function VehicleRef({ children, props, groundRay, enableRiding, isRiderOn, offset, refs, urls, }: {
6
+ children: ReactNode;
7
+ props: controllerInnerType;
8
+ groundRay: groundRayType;
9
+ enableRiding?: boolean;
10
+ isRiderOn?: boolean;
11
+ offset?: THREE.Vector3;
12
+ refs: refsType;
13
+ urls: urlsType;
14
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { vec3 } from "@react-three/rapier";
3
+ import playActions, { subscribeActions } from "../../../animation/actions";
4
+ import initCallback from "../../../controller/initialize/callback";
5
+ import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
6
+ import { setGroundRay } from "../../inner/common/setGroundRay";
7
+ import { VehicleInnerRef } from "../../inner/vehicle";
8
+ export function VehicleRef(_a) {
9
+ var children = _a.children, props = _a.props, groundRay = _a.groundRay, enableRiding = _a.enableRiding, isRiderOn = _a.isRiderOn, offset = _a.offset, refs = _a.refs, urls = _a.urls;
10
+ var colliderRef = refs.colliderRef;
11
+ var _b = useGltfAndSize({ url: urls.vehicleUrl }), size = _b.size, gltf = _b.gltf;
12
+ groundRay.offset = vec3({
13
+ x: 0,
14
+ y: size.y * 3,
15
+ z: 0,
16
+ });
17
+ setGroundRay({
18
+ groundRay: groundRay,
19
+ length: size.y * 3,
20
+ colliderRef: colliderRef,
21
+ });
22
+ var animationResult = subscribeActions({
23
+ type: "vehicle",
24
+ groundRay: groundRay,
25
+ animations: gltf.animations,
26
+ }).animationResult;
27
+ var currentAnimation = playActions({
28
+ type: "vehicle",
29
+ animationResult: animationResult,
30
+ }).currentAnimation;
31
+ // callback
32
+ initCallback({
33
+ props: props,
34
+ animationResult: animationResult,
35
+ type: "vehicle",
36
+ });
37
+ return (_jsx(VehicleInnerRef, { refs: refs, urls: urls, isRiderOn: isRiderOn, enableRiding: enableRiding, offset: offset, currentAnimation: currentAnimation, children: children }));
38
+ }
@@ -0,0 +1,7 @@
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ import { urlsType } from "../world/context/type";
3
+ export declare function GaesupComponent({ props, refs, urls, }: {
4
+ props: controllerInnerType;
5
+ refs: refsType;
6
+ urls: urlsType;
7
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { vec3 } from "@react-three/rapier";
3
+ import { useContext } from "react";
4
+ import calculation from "../physics";
5
+ import { GaesupWorldContext } from "../world/context";
6
+ import { AirplaneRef } from "./active/airplane";
7
+ import { CharacterRef } from "./active/character";
8
+ import { VehicleRef } from "./active/vehicle";
9
+ export function GaesupComponent(_a) {
10
+ var props = _a.props, refs = _a.refs, urls = _a.urls;
11
+ var _b = useContext(GaesupWorldContext), mode = _b.mode, states = _b.states, rideable = _b.rideable;
12
+ var enableRiding = states.enableRiding, isRiderOn = states.isRiderOn, rideableId = states.rideableId;
13
+ calculation(props);
14
+ return (_jsxs(_Fragment, { children: [mode.type === "character" && (_jsx(CharacterRef, { props: props, refs: refs, urls: urls })), mode.type === "vehicle" && (_jsx(VehicleRef, { props: props, groundRay: props.groundRay, refs: refs, urls: urls, enableRiding: enableRiding, isRiderOn: isRiderOn, offset: rideableId && rideable[rideableId]
15
+ ? rideable[rideableId].offset
16
+ : vec3(), children: props.children })), mode.type === "airplane" && (_jsx(AirplaneRef, { props: props, groundRay: props.groundRay, refs: refs, urls: urls, enableRiding: enableRiding, isRiderOn: isRiderOn, offset: rideableId && rideable[rideableId]
17
+ ? rideable[rideableId].offset
18
+ : vec3(), children: props.children }))] }));
19
+ }
@@ -0,0 +1,2 @@
1
+ import { refPropsType } from "../common/type";
2
+ export declare function AirplaneInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, onCollisionEnter, type, }: refPropsType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { CuboidCollider } from "@react-three/rapier";
3
+ import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
4
+ import { InnerGroupRef } from "../common/InnerGroupRef";
5
+ import { OuterGroupRef } from "../common/OuterGroupRef";
6
+ import { RigidBodyRef } from "../common/RigidbodyRef";
7
+ import RiderRef from "../rider";
8
+ export function AirplaneInnerRef(_a) {
9
+ var children = _a.children, refs = _a.refs, urls = _a.urls, isRiderOn = _a.isRiderOn, enableRiding = _a.enableRiding, offset = _a.offset, name = _a.name, position = _a.position, rotation = _a.rotation, userData = _a.userData, onCollisionEnter = _a.onCollisionEnter, type = _a.type;
10
+ var airplaneUrl = urls.airplaneUrl;
11
+ var rigidBodyRef = refs.rigidBodyRef, innerGroupRef = refs.innerGroupRef, outerGroupRef = refs.outerGroupRef;
12
+ var size = useGltfAndSize({
13
+ url: airplaneUrl,
14
+ }).size;
15
+ return (_jsx(OuterGroupRef, { ref: outerGroupRef, children: airplaneUrl && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, type: type, children: [_jsx(CuboidCollider, { args: [size.x / 2, size.y / 2, size.z / 2], position: [0, size.y / 2, 0] }), children, _jsx(InnerGroupRef, { type: "airplane", url: airplaneUrl, currentAnimation: "idle", ref: innerGroupRef, children: enableRiding && isRiderOn && urls.characterUrl && (_jsx(RiderRef, { urls: urls, offset: offset })) })] })) }));
16
+ }
@@ -0,0 +1,29 @@
1
+ import { refsType } from "../../../controller/type";
2
+ import { RigidBodyTypeString } from "@react-three/rapier";
3
+ import { ReactNode, Ref } from "react";
4
+ import * as THREE from "three";
5
+ import { Object3D, Object3DEventMap } from "three";
6
+ import { urlsType } from "../../../world/context/type";
7
+ export declare const calcCharacterColliderProps: (characterSize: THREE.Vector3) => {
8
+ height: number;
9
+ halfHeight: number;
10
+ radius: number;
11
+ diameter: number;
12
+ };
13
+ export type characterColliderType = {
14
+ height: number;
15
+ halfHeight: number;
16
+ radius: number;
17
+ diameter: number;
18
+ };
19
+ export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, positionLerp, type, }: {
20
+ children: ReactNode;
21
+ refs: Partial<refsType>;
22
+ urls: urlsType;
23
+ position?: THREE.Vector3;
24
+ euler?: THREE.Euler;
25
+ animationRef?: Ref<Object3D<Object3DEventMap>>;
26
+ currentAnimation?: string;
27
+ positionLerp?: number;
28
+ type?: RigidBodyTypeString;
29
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { CapsuleCollider } from "@react-three/rapier";
3
+ import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
4
+ import { InnerGroupRef } from "../common/InnerGroupRef";
5
+ import { OuterGroupRef } from "../common/OuterGroupRef";
6
+ import { RigidBodyRef } from "../common/RigidbodyRef";
7
+ export var calcCharacterColliderProps = function (characterSize) {
8
+ if (!characterSize)
9
+ return null;
10
+ var heightPlusDiameter = characterSize.y / 2;
11
+ var diameter = Math.max(characterSize.x, characterSize.z);
12
+ var radius = diameter / 2;
13
+ var height = heightPlusDiameter - radius;
14
+ var halfHeight = height / 2;
15
+ return {
16
+ height: height,
17
+ halfHeight: halfHeight,
18
+ radius: radius,
19
+ diameter: diameter,
20
+ };
21
+ };
22
+ export function CharacterInnerRef(_a) {
23
+ var children = _a.children, refs = _a.refs, urls = _a.urls, position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation, positionLerp = _a.positionLerp, type = _a.type;
24
+ var outerGroupRef = refs.outerGroupRef, rigidBodyRef = refs.rigidBodyRef, colliderRef = refs.colliderRef, innerGroupRef = refs.innerGroupRef;
25
+ var size = useGltfAndSize({ url: urls.characterUrl }).size;
26
+ var collider = calcCharacterColliderProps(size);
27
+ return (_jsx(_Fragment, { children: collider && (_jsx(OuterGroupRef, { ref: outerGroupRef, children: _jsxs(RigidBodyRef, { ref: rigidBodyRef, name: "character", position: position, positionLerp: positionLerp, rotation: euler, type: type, children: [_jsx(CapsuleCollider, { ref: colliderRef, args: [collider.height, collider.radius], position: [0, collider.height + collider.radius, 0] }), _jsx(InnerGroupRef, { type: "character", ref: innerGroupRef, url: urls.characterUrl, currentAnimation: currentAnimation, children: children })] }) })) }));
28
+ }