gaesup-world 0.2.24 → 0.2.26

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 (216) hide show
  1. package/dist/gaesup/animation/actions.d.ts +44 -0
  2. package/dist/gaesup/animation/actions.js +103 -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 +139 -0
  11. package/dist/gaesup/camera/type.d.ts +13 -0
  12. package/dist/gaesup/camera/type.js +1 -0
  13. package/dist/gaesup/component/active/airplane/index.d.ts +11 -0
  14. package/dist/gaesup/component/active/airplane/index.js +6 -0
  15. package/dist/gaesup/component/active/character/index.d.ts +7 -0
  16. package/dist/gaesup/component/active/character/index.js +34 -0
  17. package/dist/gaesup/component/active/vehicle/index.d.ts +12 -0
  18. package/dist/gaesup/component/active/vehicle/index.js +31 -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 +25 -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 +4 -0
  28. package/dist/gaesup/component/inner/common/OuterGroupRef.js +6 -0
  29. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +12 -0
  30. package/dist/gaesup/component/inner/common/RigidbodyRef.js +7 -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 +20 -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 +10 -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 +7 -0
  42. package/dist/gaesup/component/inner/vehicle/wheels.js +64 -0
  43. package/dist/gaesup/component/passive/airplane/index.d.ts +13 -0
  44. package/dist/gaesup/component/passive/airplane/index.js +40 -0
  45. package/dist/gaesup/component/passive/character/index.d.ts +10 -0
  46. package/dist/gaesup/component/passive/character/index.js +46 -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 +13 -0
  50. package/dist/gaesup/component/passive/vehicle/index.js +17 -0
  51. package/dist/gaesup/component/type.d.ts +17 -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 +38 -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 +74 -0
  69. package/dist/gaesup/controller/initialize/callback/index.d.ts +2 -0
  70. package/dist/gaesup/controller/initialize/callback/index.js +62 -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 +75 -0
  75. package/dist/gaesup/controller/type.d.ts +85 -0
  76. package/dist/gaesup/controller/type.js +1 -0
  77. package/dist/gaesup/gaesupProps/index.d.ts +7 -0
  78. package/dist/gaesup/gaesupProps/index.js +46 -0
  79. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +10 -0
  80. package/dist/gaesup/hooks/useGaesupAnimation/index.js +95 -0
  81. package/dist/gaesup/hooks/useGaesupController/index.d.ts +10 -0
  82. package/dist/gaesup/hooks/useGaesupController/index.js +14 -0
  83. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +25 -0
  84. package/dist/gaesup/hooks/useGaesupGltf/index.js +73 -0
  85. package/dist/gaesup/hooks/useJoyStick/index.d.ts +39 -0
  86. package/dist/gaesup/hooks/useJoyStick/index.js +61 -0
  87. package/dist/gaesup/hooks/usePushKey/index.d.ts +3 -0
  88. package/dist/gaesup/hooks/usePushKey/index.js +29 -0
  89. package/dist/gaesup/hooks/useRideable/index.d.ts +28 -0
  90. package/dist/gaesup/hooks/useRideable/index.js +199 -0
  91. package/dist/gaesup/hooks/useTeleport/index.d.ts +3 -0
  92. package/dist/gaesup/hooks/useTeleport/index.js +12 -0
  93. package/dist/gaesup/physics/airplane/damping.d.ts +2 -0
  94. package/dist/gaesup/physics/airplane/damping.js +5 -0
  95. package/dist/gaesup/physics/airplane/direction.d.ts +2 -0
  96. package/dist/gaesup/physics/airplane/direction.js +65 -0
  97. package/dist/gaesup/physics/airplane/gravity.d.ts +14 -0
  98. package/dist/gaesup/physics/airplane/gravity.js +18 -0
  99. package/dist/gaesup/physics/airplane/impulse.d.ts +16 -0
  100. package/dist/gaesup/physics/airplane/impulse.js +31 -0
  101. package/dist/gaesup/physics/airplane/index.d.ts +2 -0
  102. package/dist/gaesup/physics/airplane/index.js +14 -0
  103. package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
  104. package/dist/gaesup/physics/airplane/innerCalc.js +27 -0
  105. package/dist/gaesup/physics/airplane/landing.d.ts +2 -0
  106. package/dist/gaesup/physics/airplane/landing.js +29 -0
  107. package/dist/gaesup/physics/character/direction.d.ts +23 -0
  108. package/dist/gaesup/physics/character/direction.js +55 -0
  109. package/dist/gaesup/physics/character/impulse.d.ts +2 -0
  110. package/dist/gaesup/physics/character/impulse.js +43 -0
  111. package/dist/gaesup/physics/character/index.d.ts +2 -0
  112. package/dist/gaesup/physics/character/index.js +8 -0
  113. package/dist/gaesup/physics/character/innerCalc.d.ts +2 -0
  114. package/dist/gaesup/physics/character/innerCalc.js +31 -0
  115. package/dist/gaesup/physics/check/ground.d.ts +2 -0
  116. package/dist/gaesup/physics/check/ground.js +15 -0
  117. package/dist/gaesup/physics/check/index.d.ts +2 -0
  118. package/dist/gaesup/physics/check/index.js +12 -0
  119. package/dist/gaesup/physics/check/moving.d.ts +2 -0
  120. package/dist/gaesup/physics/check/moving.js +16 -0
  121. package/dist/gaesup/physics/check/push.d.ts +2 -0
  122. package/dist/gaesup/physics/check/push.js +6 -0
  123. package/dist/gaesup/physics/check/riding.d.ts +2 -0
  124. package/dist/gaesup/physics/check/riding.js +7 -0
  125. package/dist/gaesup/physics/check/rotate.d.ts +2 -0
  126. package/dist/gaesup/physics/check/rotate.js +8 -0
  127. package/dist/gaesup/physics/index.d.ts +2 -0
  128. package/dist/gaesup/physics/index.js +58 -0
  129. package/dist/gaesup/physics/type.d.ts +36 -0
  130. package/dist/gaesup/physics/type.js +1 -0
  131. package/dist/gaesup/physics/vehicle/damping.d.ts +2 -0
  132. package/dist/gaesup/physics/vehicle/damping.js +6 -0
  133. package/dist/gaesup/physics/vehicle/direction.d.ts +4 -0
  134. package/dist/gaesup/physics/vehicle/direction.js +30 -0
  135. package/dist/gaesup/physics/vehicle/impulse.d.ts +16 -0
  136. package/dist/gaesup/physics/vehicle/impulse.js +40 -0
  137. package/dist/gaesup/physics/vehicle/index.d.ts +2 -0
  138. package/dist/gaesup/physics/vehicle/index.js +12 -0
  139. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
  140. package/dist/gaesup/physics/vehicle/innerCalc.js +24 -0
  141. package/dist/gaesup/physics/vehicle/landing.d.ts +2 -0
  142. package/dist/gaesup/physics/vehicle/landing.js +29 -0
  143. package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +9 -0
  144. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +16 -0
  145. package/dist/gaesup/tools/gameBoy/index.d.ts +8 -0
  146. package/dist/gaesup/tools/gameBoy/index.js +22 -0
  147. package/dist/gaesup/tools/gameBoy/type.d.ts +4 -0
  148. package/dist/gaesup/tools/gameBoy/type.js +1 -0
  149. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +8 -0
  150. package/dist/gaesup/tools/gamePad/GamePadButton.js +21 -0
  151. package/dist/gaesup/tools/gamePad/index.d.ts +6 -0
  152. package/dist/gaesup/tools/gamePad/index.js +32 -0
  153. package/dist/gaesup/tools/gamePad/type.d.ts +6 -0
  154. package/dist/gaesup/tools/gamePad/type.js +1 -0
  155. package/dist/gaesup/tools/joyStick/index.d.ts +6 -0
  156. package/dist/gaesup/tools/joyStick/index.js +169 -0
  157. package/dist/gaesup/tools/joyStick/type.d.ts +19 -0
  158. package/dist/gaesup/tools/joyStick/type.js +1 -0
  159. package/dist/gaesup/tools/jumpPortal/index.d.ts +16 -0
  160. package/dist/gaesup/tools/jumpPortal/index.js +18 -0
  161. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +402 -0
  162. package/dist/gaesup/tools/keyBoardToolTip/constant.js +122 -0
  163. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +10 -0
  164. package/dist/gaesup/tools/keyBoardToolTip/default.js +12 -0
  165. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +3 -0
  166. package/dist/gaesup/tools/keyBoardToolTip/index.js +70 -0
  167. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +37 -0
  168. package/dist/gaesup/tools/keyBoardToolTip/type.js +1 -0
  169. package/dist/gaesup/tools/miniMap/default.d.ts +9 -0
  170. package/dist/gaesup/tools/miniMap/default.js +9 -0
  171. package/dist/gaesup/tools/miniMap/index.d.ts +3 -0
  172. package/dist/gaesup/tools/miniMap/index.js +72 -0
  173. package/dist/gaesup/tools/miniMap/type.d.ts +25 -0
  174. package/dist/gaesup/tools/miniMap/type.js +1 -0
  175. package/dist/gaesup/tools/rideable/index.d.ts +3 -0
  176. package/dist/gaesup/tools/rideable/index.js +79 -0
  177. package/dist/gaesup/tools/type.d.ts +2 -0
  178. package/dist/gaesup/tools/type.js +1 -0
  179. package/dist/gaesup/tools/zoomButton/index.d.ts +18 -0
  180. package/dist/gaesup/tools/zoomButton/index.js +146 -0
  181. package/dist/gaesup/utils/context.d.ts +2 -0
  182. package/dist/gaesup/utils/context.js +3 -0
  183. package/dist/gaesup/utils/debug.d.ts +29 -0
  184. package/dist/gaesup/utils/debug.js +36 -0
  185. package/dist/gaesup/utils/index.d.ts +3 -0
  186. package/dist/gaesup/utils/index.js +3 -0
  187. package/dist/gaesup/utils/ray.d.ts +7 -0
  188. package/dist/gaesup/utils/ray.js +6 -0
  189. package/dist/gaesup/utils/ref.d.ts +2 -0
  190. package/dist/gaesup/utils/ref.js +16 -0
  191. package/dist/gaesup/utils/type.d.ts +5 -0
  192. package/dist/gaesup/utils/type.js +1 -0
  193. package/dist/gaesup/utils/vector.d.ts +10 -0
  194. package/dist/gaesup/utils/vector.js +33 -0
  195. package/dist/gaesup/world/context/index.d.ts +6 -0
  196. package/dist/gaesup/world/context/index.js +117 -0
  197. package/dist/gaesup/world/context/reducer.d.ts +29 -0
  198. package/dist/gaesup/world/context/reducer.js +21 -0
  199. package/dist/gaesup/world/context/type.d.ts +169 -0
  200. package/dist/gaesup/world/context/type.js +1 -0
  201. package/dist/gaesup/world/debug/cameraOption.d.ts +47 -0
  202. package/dist/gaesup/world/debug/cameraOption.js +47 -0
  203. package/dist/gaesup/world/debug/index.d.ts +6 -0
  204. package/dist/gaesup/world/debug/index.js +32 -0
  205. package/dist/gaesup/world/debug/mode.d.ts +10 -0
  206. package/dist/gaesup/world/debug/mode.js +10 -0
  207. package/dist/gaesup/world/index.d.ts +3 -0
  208. package/dist/gaesup/world/index.js +9 -0
  209. package/dist/gaesup/world/initalize/index.d.ts +35 -0
  210. package/dist/gaesup/world/initalize/index.js +62 -0
  211. package/dist/gaesup/world/type.d.ts +19 -0
  212. package/dist/gaesup/world/type.js +1 -0
  213. package/dist/index.d.ts +23 -0
  214. package/index.ts +29 -0
  215. package/package.json +2 -5
  216. package/yarn-error.log +12152 -0
@@ -0,0 +1,38 @@
1
+ import { GroupProps } from "@react-three/fiber";
2
+ import { dispatchType } from "../../utils/type";
3
+ import { callbackType } from "../initialize/callback/type";
4
+ import { gaesupControllerContextPropType, refsType } from "../type";
5
+ export type airplaneDebugType = {
6
+ angleDelta?: THREE.Vector3;
7
+ maxAngle?: THREE.Vector3;
8
+ buoyancy?: number;
9
+ maxSpeed?: number;
10
+ accelRatio?: number;
11
+ brakeRatio?: number;
12
+ linearDamping?: number;
13
+ };
14
+ export type vehicleDebugType = {
15
+ maxSpeed?: number;
16
+ accelRatio?: number;
17
+ brakeRatio?: number;
18
+ wheelOffset?: number;
19
+ linearDamping?: number;
20
+ };
21
+ export type characterDebugType = {
22
+ jumpSpeed?: number;
23
+ turnSpeed?: number;
24
+ walkSpeed?: number;
25
+ runSpeed?: number;
26
+ linearDamping?: number;
27
+ };
28
+ export interface airplaneType extends GroupProps, airplaneDebugType {
29
+ }
30
+ export interface vehicleType extends GroupProps, vehicleDebugType {
31
+ }
32
+ export interface characterType extends GroupProps, characterDebugType {
33
+ }
34
+ export type gaesupControllerType = gaesupControllerContextPropType & {
35
+ callbacks?: callbackType;
36
+ refs?: refsType;
37
+ };
38
+ export type gaesupDisptachType = dispatchType<gaesupControllerType>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,71 @@
1
+ export declare const airplaneDebugMap: {
2
+ angleDelta: {
3
+ value: {
4
+ x: number;
5
+ y: number;
6
+ z: number;
7
+ };
8
+ x: {
9
+ min: number;
10
+ max: number;
11
+ step: number;
12
+ };
13
+ y: {
14
+ min: number;
15
+ max: number;
16
+ step: number;
17
+ };
18
+ z: {
19
+ min: number;
20
+ max: number;
21
+ step: number;
22
+ };
23
+ };
24
+ maxAngle: {
25
+ value: {
26
+ x: number;
27
+ y: number;
28
+ z: number;
29
+ };
30
+ x: {
31
+ min: number;
32
+ max: number;
33
+ step: number;
34
+ };
35
+ y: {
36
+ min: number;
37
+ max: number;
38
+ step: number;
39
+ };
40
+ z: {
41
+ min: number;
42
+ max: number;
43
+ step: number;
44
+ };
45
+ };
46
+ maxSpeed: {
47
+ min: number;
48
+ max: number;
49
+ step: number;
50
+ };
51
+ accelRatio: {
52
+ min: number;
53
+ max: number;
54
+ step: number;
55
+ };
56
+ brakeRatio: {
57
+ min: number;
58
+ max: number;
59
+ step: number;
60
+ };
61
+ buoyancy: {
62
+ min: number;
63
+ max: number;
64
+ step: number;
65
+ };
66
+ linearDamping: {
67
+ min: number;
68
+ max: number;
69
+ step: number;
70
+ };
71
+ };
@@ -0,0 +1,71 @@
1
+ export var airplaneDebugMap = {
2
+ angleDelta: {
3
+ value: {
4
+ x: 0.01,
5
+ y: 0.005,
6
+ z: 0.005,
7
+ },
8
+ x: {
9
+ min: -Math.PI,
10
+ max: Math.PI,
11
+ step: 0.01,
12
+ },
13
+ y: {
14
+ min: -Math.PI,
15
+ max: Math.PI,
16
+ step: 0.01,
17
+ },
18
+ z: {
19
+ min: -Math.PI,
20
+ max: Math.PI,
21
+ step: 0.01,
22
+ },
23
+ },
24
+ maxAngle: {
25
+ value: {
26
+ x: 0.1,
27
+ y: 0.1,
28
+ z: 0.1,
29
+ },
30
+ x: {
31
+ min: -Math.PI,
32
+ max: Math.PI,
33
+ step: 0.01,
34
+ },
35
+ y: {
36
+ min: -Math.PI,
37
+ max: Math.PI,
38
+ step: 0.01,
39
+ },
40
+ z: {
41
+ min: -Math.PI,
42
+ max: Math.PI,
43
+ step: 0.01,
44
+ },
45
+ },
46
+ maxSpeed: {
47
+ min: 50,
48
+ max: 100,
49
+ step: 0.01,
50
+ },
51
+ accelRatio: {
52
+ min: 1,
53
+ max: 10,
54
+ step: 0.01,
55
+ },
56
+ brakeRatio: {
57
+ min: 1,
58
+ max: 20,
59
+ step: 0.01,
60
+ },
61
+ buoyancy: {
62
+ min: 0.1,
63
+ max: 1,
64
+ step: 0.01,
65
+ },
66
+ linearDamping: {
67
+ min: 0,
68
+ max: 1,
69
+ step: 0.01,
70
+ },
71
+ };
@@ -0,0 +1,27 @@
1
+ export declare const characterDebugMap: {
2
+ walkSpeed: {
3
+ min: number;
4
+ max: number;
5
+ step: number;
6
+ };
7
+ runSpeed: {
8
+ min: number;
9
+ max: number;
10
+ step: number;
11
+ };
12
+ turnSpeed: {
13
+ min: number;
14
+ max: number;
15
+ step: number;
16
+ };
17
+ jumpSpeed: {
18
+ min: number;
19
+ max: number;
20
+ step: number;
21
+ };
22
+ linearDamping: {
23
+ min: number;
24
+ max: number;
25
+ step: number;
26
+ };
27
+ };
@@ -0,0 +1,27 @@
1
+ export var characterDebugMap = {
2
+ walkSpeed: {
3
+ min: 1,
4
+ max: 20,
5
+ step: 0.01,
6
+ },
7
+ runSpeed: {
8
+ min: 1,
9
+ max: 20,
10
+ step: 0.01,
11
+ },
12
+ turnSpeed: {
13
+ min: 1,
14
+ max: 20,
15
+ step: 0.01,
16
+ },
17
+ jumpSpeed: {
18
+ min: 0.1,
19
+ max: 20,
20
+ step: 0.01,
21
+ },
22
+ linearDamping: {
23
+ min: -10,
24
+ max: 10,
25
+ step: 0.01,
26
+ },
27
+ };
@@ -0,0 +1,6 @@
1
+ import { dispatchType } from "../../utils/type";
2
+ import { gaesupControllerType } from "../context/type";
3
+ export default function initDebug({ controllerContext, controllerDispatch, }: {
4
+ controllerContext: gaesupControllerType;
5
+ controllerDispatch: dispatchType<gaesupControllerType>;
6
+ }): void;
@@ -0,0 +1,49 @@
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 { useContext, useEffect } from "react";
13
+ import { update } from "../../utils/context";
14
+ import debug from "../../utils/debug";
15
+ import { GaesupWorldContext } from "../../world/context";
16
+ import { airplaneDebugMap } from "./airplane";
17
+ import { characterDebugMap } from "./character";
18
+ import { vehicleDebugMap } from "./vehicle";
19
+ export default function initDebug(_a) {
20
+ var controllerContext = _a.controllerContext, controllerDispatch = _a.controllerDispatch;
21
+ var worldDebug = useContext(GaesupWorldContext).debug;
22
+ if (!worldDebug)
23
+ return;
24
+ var characterOptionValue = debug({
25
+ debug: worldDebug,
26
+ debugProps: controllerContext.character,
27
+ tag: "character",
28
+ debugMap: characterDebugMap,
29
+ });
30
+ var vehicleOptionValue = debug({
31
+ debug: worldDebug,
32
+ debugProps: controllerContext.vehicle,
33
+ tag: "vehicle",
34
+ debugMap: vehicleDebugMap,
35
+ });
36
+ var airplaneOptionValue = debug({
37
+ debug: worldDebug,
38
+ debugProps: controllerContext.airplane,
39
+ tag: "airplane",
40
+ debugMap: airplaneDebugMap,
41
+ });
42
+ useEffect(function () {
43
+ update({
44
+ character: __assign({}, characterOptionValue),
45
+ vehicle: __assign({}, vehicleOptionValue),
46
+ airplane: __assign({}, airplaneOptionValue),
47
+ }, controllerDispatch);
48
+ }, [characterOptionValue, vehicleOptionValue, airplaneOptionValue]);
49
+ }
@@ -0,0 +1,27 @@
1
+ export declare const vehicleDebugMap: {
2
+ maxSpeed: {
3
+ min: number;
4
+ max: number;
5
+ step: number;
6
+ };
7
+ accelRatio: {
8
+ min: number;
9
+ max: number;
10
+ step: number;
11
+ };
12
+ brakeRatio: {
13
+ min: number;
14
+ max: number;
15
+ step: number;
16
+ };
17
+ wheelOffset: {
18
+ min: number;
19
+ max: number;
20
+ step: number;
21
+ };
22
+ linearDamping: {
23
+ min: number;
24
+ max: number;
25
+ step: number;
26
+ };
27
+ };
@@ -0,0 +1,27 @@
1
+ export var vehicleDebugMap = {
2
+ maxSpeed: {
3
+ min: 50,
4
+ max: 100,
5
+ step: 0.01,
6
+ },
7
+ accelRatio: {
8
+ min: 1,
9
+ max: 10,
10
+ step: 0.01,
11
+ },
12
+ brakeRatio: {
13
+ min: 1,
14
+ max: 20,
15
+ step: 0.01,
16
+ },
17
+ wheelOffset: {
18
+ min: 0.1,
19
+ max: 10,
20
+ step: 0.01,
21
+ },
22
+ linearDamping: {
23
+ min: 0,
24
+ max: 1,
25
+ step: 0.01,
26
+ },
27
+ };
@@ -0,0 +1,3 @@
1
+ import { controllerType } from "./type";
2
+ export declare function GaesupController(props: controllerType): import("react/jsx-runtime").JSX.Element;
3
+ export declare function GaesupControllerInner(props: controllerType): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,74 @@
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 { useContext, useMemo, useReducer, useRef } from "react";
14
+ import Camera from "../camera";
15
+ import { KeyboardControls } from "@react-three/drei";
16
+ import { GaesupComponent } from "../component";
17
+ import { GaesupWorldContext } from "../world/context";
18
+ import { GaesupControllerContext, GaesupControllerDispatchContext, gaesupControllerDefault, } from "./context";
19
+ import { gaesupControllerReducer } from "./context/reducer";
20
+ import initDebug from "./debug";
21
+ import initControllerProps from "./initialize";
22
+ export function GaesupController(props) {
23
+ var keyBoardMap = useContext(GaesupWorldContext).keyBoardMap;
24
+ return (_jsx(KeyboardControls, { map: keyBoardMap, children: _jsx(GaesupControllerInner, __assign({}, props, { children: props.children })) }));
25
+ }
26
+ export function GaesupControllerInner(props) {
27
+ var colliderRef = useRef(null);
28
+ var rigidBodyRef = useRef(null);
29
+ var outerGroupRef = useRef(null);
30
+ var innerGroupRef = useRef(null);
31
+ var characterInnerRef = useRef(null);
32
+ var passiveRigidBodyRef = useRef(null);
33
+ var _a = useReducer(gaesupControllerReducer, {
34
+ airplane: Object.assign(gaesupControllerDefault.airplane, props.airplane || {}),
35
+ vehicle: Object.assign(gaesupControllerDefault.vehicle, props.vehicle || {}),
36
+ character: Object.assign(gaesupControllerDefault.character, props.character || {}),
37
+ callbacks: Object.assign(gaesupControllerDefault.callbacks, {
38
+ onReady: props.onReady,
39
+ onFrame: props.onFrame,
40
+ onDestory: props.onDestory,
41
+ onAnimate: props.onAnimate,
42
+ }),
43
+ urls: Object.assign(gaesupControllerDefault.urls, props.urls || {}),
44
+ refs: {
45
+ colliderRef: colliderRef,
46
+ rigidBodyRef: rigidBodyRef,
47
+ outerGroupRef: outerGroupRef,
48
+ innerGroupRef: innerGroupRef,
49
+ characterInnerRef: characterInnerRef,
50
+ },
51
+ }), controller = _a[0], controllerDispatch = _a[1];
52
+ var gaesupControl = useMemo(function () { return ({
53
+ value: controller,
54
+ dispatch: controllerDispatch,
55
+ }); }, [controller, controllerDispatch]);
56
+ var refs = useMemo(function () {
57
+ return {
58
+ colliderRef: colliderRef,
59
+ rigidBodyRef: rigidBodyRef,
60
+ outerGroupRef: outerGroupRef,
61
+ innerGroupRef: innerGroupRef,
62
+ characterInnerRef: characterInnerRef,
63
+ passiveRigidBodyRef: passiveRigidBodyRef,
64
+ };
65
+ }, []);
66
+ var prop = __assign(__assign(__assign(__assign({}, initControllerProps({
67
+ refs: refs,
68
+ })), { children: props.children, groupProps: props.groupProps }), gaesupControl.value.callbacks), refs);
69
+ initDebug({
70
+ controllerContext: gaesupControl.value,
71
+ controllerDispatch: gaesupControl.dispatch,
72
+ });
73
+ return (_jsxs(GaesupControllerContext.Provider, { value: gaesupControl.value, children: [_jsx(Camera, { refs: refs, prop: prop, control: prop.keyControl }), _jsx(GaesupControllerDispatchContext.Provider, { value: gaesupControl.dispatch, children: _jsx(GaesupComponent, { props: prop, refs: refs, urls: props.urls }) })] }));
74
+ }
@@ -0,0 +1,2 @@
1
+ import { controllerInnerType } from "../../type";
2
+ export default function initCallback(props: controllerInnerType, type: "character" | "vehicle" | "airplane"): void;
@@ -0,0 +1,62 @@
1
+ export default function initCallback(props, type) {
2
+ // const {
3
+ // characterGltf,
4
+ // animations: characterAnimations,
5
+ // activeState,
6
+ // states,
7
+ // control,
8
+ // } = useContext(GaesupWorldContext);
9
+ // const dispatch = useContext(GaesupWorldDispatchContext);
10
+ // const { animations } = characterGltf;
11
+ // const { actions } = useAnimations(animations, props.outerGroupRef);
12
+ // const { subscribe } = useGaesupAnimation({ type });
13
+ //
14
+ // const playAnimation = (tag: keyof animationTagType, key: string) => {
15
+ // if (!(key in control)) return;
16
+ // if (control[key]) {
17
+ // characterAnimations.current = tag;
18
+ // dispatch({
19
+ // type: "update",
20
+ // payload: {
21
+ // animations: {
22
+ // ...characterAnimations,
23
+ // },
24
+ // },
25
+ // });
26
+ // }
27
+ // };
28
+ //
29
+ // const controllerProp: callbackPropType = {
30
+ // ...props,
31
+ // activeState,
32
+ // control,
33
+ // states,
34
+ // subscribe,
35
+ // };
36
+ //
37
+ // useEffect(() => {
38
+ // if (props.onReady) {
39
+ // props.onReady(controllerProp);
40
+ // }
41
+ // return () => {
42
+ // if (props.onDestory) {
43
+ // props.onDestory(controllerProp);
44
+ // }
45
+ // };
46
+ // }, []);
47
+ //
48
+ // useFrame((prop) => {
49
+ // if (props.onFrame) {
50
+ // props.onFrame({ ...controllerProp, ...prop });
51
+ // }
52
+ // if (props.onAnimate) {
53
+ // props.onAnimate({
54
+ // ...controllerProp,
55
+ // ...prop,
56
+ // actions,
57
+ // animation: characterAnimations,
58
+ // playAnimation,
59
+ // });
60
+ // }
61
+ // });
62
+ }
@@ -0,0 +1,27 @@
1
+ import { RootState } from "@react-three/fiber";
2
+ import { cameraRayType } from "../../../camera/type";
3
+ import { activeStateType, animationAtomType, animationPropType, keyControlType, statesType } from "../../../world/context/type";
4
+ import { actionsType, groundRayType, slopeRayType } from "../../type";
5
+ export type callbackPropType = {
6
+ activeState: activeStateType;
7
+ states: statesType;
8
+ slopeRay: slopeRayType;
9
+ groundRay: groundRayType;
10
+ cameraRay: cameraRayType;
11
+ control: keyControlType;
12
+ subscribe: (props: animationAtomType) => void;
13
+ };
14
+ export type onFramePropType = callbackPropType & RootState;
15
+ export type onAnimatePropType = onFramePropType & {
16
+ actions: {
17
+ [x: string]: THREE.AnimationAction | null;
18
+ };
19
+ animation: animationPropType;
20
+ playAnimation: (tag: keyof actionsType, key: string) => void;
21
+ };
22
+ export type callbackType = {
23
+ onReady?: (prop: callbackPropType) => void;
24
+ onFrame?: (prop: onFramePropType) => void;
25
+ onDestory?: (prop: callbackPropType) => void;
26
+ onAnimate?: (prop: onAnimatePropType) => void;
27
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { groundRayType, refsType } from "../../controller/type";
2
+ import { cameraRayType } from "../../camera/type";
3
+ import { keyControlType } from "../../world/context/type";
4
+ export default function initControllerProps({ refs }: {
5
+ refs: refsType;
6
+ }): {
7
+ groundRay: groundRayType;
8
+ cameraRay: cameraRayType;
9
+ keyControl: keyControlType;
10
+ };
@@ -0,0 +1,75 @@
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 { useKeyboardControls } from "@react-three/drei";
13
+ import { vec3 } from "@react-three/rapier";
14
+ import { useCallback, useContext, useEffect, useMemo } from "react";
15
+ import * as THREE from "three";
16
+ import { update } from "../../utils/context";
17
+ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
18
+ export default function initControllerProps(_a) {
19
+ var refs = _a.refs;
20
+ var context = useContext(GaesupWorldContext);
21
+ var dispatch = useContext(GaesupWorldDispatchContext);
22
+ var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
23
+ var keyControl = getKeys();
24
+ useEffect(function () {
25
+ if (context && keyControl && context.control) {
26
+ dispatch({
27
+ type: "update",
28
+ payload: {
29
+ control: __assign({}, (context.mode.controller === "keyboard"
30
+ ? keyControl
31
+ : context.control)),
32
+ },
33
+ });
34
+ }
35
+ }, [context === null || context === void 0 ? void 0 : context.mode.controller, keyControl, context === null || context === void 0 ? void 0 : context.control]);
36
+ var groundRay = useMemo(function () {
37
+ return {
38
+ origin: vec3(),
39
+ dir: vec3({ x: 0, y: -1, z: 0 }),
40
+ offset: vec3({ x: 0, y: -1, z: 0 }),
41
+ hit: null,
42
+ parent: null,
43
+ rayCast: null,
44
+ length: 0.5,
45
+ };
46
+ }, []);
47
+ var cameraRay = useMemo(function () {
48
+ return {
49
+ origin: vec3(),
50
+ hit: new THREE.Raycaster(),
51
+ rayCast: new THREE.Raycaster(vec3(), vec3(), 0, -7),
52
+ dir: vec3(),
53
+ position: vec3(),
54
+ length: -context.cameraOption.maxDistance,
55
+ detected: [],
56
+ intersects: [],
57
+ intersectObjectMap: {},
58
+ };
59
+ }, []);
60
+ var initRefs = useCallback(function (refs) {
61
+ update({
62
+ refs: __assign({}, refs),
63
+ }, dispatch);
64
+ }, [refs]);
65
+ useEffect(function () {
66
+ if (refs) {
67
+ initRefs(refs);
68
+ }
69
+ }, []);
70
+ return {
71
+ groundRay: groundRay,
72
+ cameraRay: cameraRay,
73
+ keyControl: keyControl,
74
+ };
75
+ }