gaesup-world 0.9.52 → 0.9.53

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 (211) hide show
  1. package/package.json +2 -2
  2. package/dist/gaesup/animation/actions.js +0 -104
  3. package/dist/gaesup/camera/control/normal.d.ts +0 -4
  4. package/dist/gaesup/camera/control/normal.js +0 -15
  5. package/dist/gaesup/camera/control/orbit.d.ts +0 -4
  6. package/dist/gaesup/camera/control/orbit.js +0 -22
  7. package/dist/gaesup/camera/index.d.ts +0 -2
  8. package/dist/gaesup/camera/index.js +0 -24
  9. package/dist/gaesup/camera/type.d.ts +0 -14
  10. package/dist/gaesup/camera/type.js +0 -1
  11. package/dist/gaesup/component/active/airplane/index.d.ts +0 -2
  12. package/dist/gaesup/component/active/airplane/index.js +0 -5
  13. package/dist/gaesup/component/active/airplane/type.d.ts +0 -3
  14. package/dist/gaesup/component/active/airplane/type.js +0 -1
  15. package/dist/gaesup/component/active/character/index.js +0 -5
  16. package/dist/gaesup/component/active/character/type.js +0 -1
  17. package/dist/gaesup/component/active/vehicle/index.d.ts +0 -2
  18. package/dist/gaesup/component/active/vehicle/index.js +0 -5
  19. package/dist/gaesup/component/active/vehicle/type.d.ts +0 -3
  20. package/dist/gaesup/component/active/vehicle/type.js +0 -1
  21. package/dist/gaesup/component/index.d.ts +0 -5
  22. package/dist/gaesup/component/index.js +0 -16
  23. package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
  24. package/dist/gaesup/component/inner/airplane/index.js +0 -7
  25. package/dist/gaesup/component/inner/airplane/type.d.ts +0 -5
  26. package/dist/gaesup/component/inner/airplane/type.js +0 -1
  27. package/dist/gaesup/component/inner/character/index.d.ts +0 -2
  28. package/dist/gaesup/component/inner/character/index.js +0 -7
  29. package/dist/gaesup/component/inner/character/type.d.ts +0 -10
  30. package/dist/gaesup/component/inner/character/type.js +0 -1
  31. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -1
  32. package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -18
  33. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -1
  34. package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -5
  35. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -1
  36. package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -248
  37. package/dist/gaesup/component/inner/common/calc.d.ts +0 -6
  38. package/dist/gaesup/component/inner/common/calc.js +0 -15
  39. package/dist/gaesup/component/inner/common/partsGroupRef.d.ts +0 -10
  40. package/dist/gaesup/component/inner/common/partsGroupRef.js +0 -33
  41. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -2
  42. package/dist/gaesup/component/inner/common/setGroundRay.js +0 -13
  43. package/dist/gaesup/component/inner/common/type.js +0 -1
  44. package/dist/gaesup/component/inner/rider/index.d.ts +0 -10
  45. package/dist/gaesup/component/inner/rider/index.js +0 -32
  46. package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -2
  47. package/dist/gaesup/component/inner/vehicle/collider.js +0 -17
  48. package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
  49. package/dist/gaesup/component/inner/vehicle/index.js +0 -10
  50. package/dist/gaesup/component/inner/vehicle/type.d.ts +0 -5
  51. package/dist/gaesup/component/inner/vehicle/type.js +0 -1
  52. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -8
  53. package/dist/gaesup/component/inner/vehicle/wheels.js +0 -56
  54. package/dist/gaesup/component/passive/airplane/index.d.ts +0 -2
  55. package/dist/gaesup/component/passive/airplane/index.js +0 -37
  56. package/dist/gaesup/component/passive/airplane/type.d.ts +0 -2
  57. package/dist/gaesup/component/passive/airplane/type.js +0 -1
  58. package/dist/gaesup/component/passive/character/index.d.ts +0 -2
  59. package/dist/gaesup/component/passive/character/index.js +0 -26
  60. package/dist/gaesup/component/passive/character/type.d.ts +0 -2
  61. package/dist/gaesup/component/passive/character/type.js +0 -1
  62. package/dist/gaesup/component/passive/type.js +0 -1
  63. package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -2
  64. package/dist/gaesup/component/passive/vehicle/index.js +0 -21
  65. package/dist/gaesup/component/passive/vehicle/type.d.ts +0 -2
  66. package/dist/gaesup/component/passive/vehicle/type.js +0 -1
  67. package/dist/gaesup/component/type.d.ts +0 -18
  68. package/dist/gaesup/component/type.js +0 -1
  69. package/dist/gaesup/controller/context/index.d.ts +0 -46
  70. package/dist/gaesup/controller/context/index.js +0 -48
  71. package/dist/gaesup/controller/context/reducer.d.ts +0 -12
  72. package/dist/gaesup/controller/context/reducer.js +0 -10
  73. package/dist/gaesup/controller/context/type.d.ts +0 -39
  74. package/dist/gaesup/controller/context/type.js +0 -1
  75. package/dist/gaesup/controller/index.d.ts +0 -3
  76. package/dist/gaesup/controller/index.js +0 -58
  77. package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -15
  78. package/dist/gaesup/controller/initialize/callback/index.js +0 -59
  79. package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -24
  80. package/dist/gaesup/controller/initialize/callback/type.js +0 -1
  81. package/dist/gaesup/controller/initialize/index.d.ts +0 -8
  82. package/dist/gaesup/controller/initialize/index.js +0 -67
  83. package/dist/gaesup/controller/type.d.ts +0 -103
  84. package/dist/gaesup/controller/type.js +0 -1
  85. package/dist/gaesup/gaesupProps/index.js +0 -38
  86. package/dist/gaesup/hooks/useClicker/index.d.ts +0 -3
  87. package/dist/gaesup/hooks/useClicker/index.js +0 -28
  88. package/dist/gaesup/hooks/useFocus/index.d.ts +0 -23
  89. package/dist/gaesup/hooks/useFocus/index.js +0 -103
  90. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
  91. package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
  92. package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
  93. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
  94. package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -61
  95. package/dist/gaesup/hooks/useMovePoint/index.d.ts +0 -3
  96. package/dist/gaesup/hooks/useMovePoint/index.js +0 -27
  97. package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
  98. package/dist/gaesup/hooks/usePushKey/index.js +0 -18
  99. package/dist/gaesup/hooks/useRideable/index.d.ts +0 -19
  100. package/dist/gaesup/hooks/useRideable/index.js +0 -107
  101. package/dist/gaesup/hooks/useRideable/type.d.ts +0 -19
  102. package/dist/gaesup/hooks/useRideable/type.js +0 -1
  103. package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
  104. package/dist/gaesup/hooks/useTeleport/index.js +0 -16
  105. package/dist/gaesup/hooks/useZoom/index.d.ts +0 -3
  106. package/dist/gaesup/hooks/useZoom/index.js +0 -18
  107. package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
  108. package/dist/gaesup/physics/airplane/damping.js +0 -5
  109. package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
  110. package/dist/gaesup/physics/airplane/direction.js +0 -46
  111. package/dist/gaesup/physics/airplane/gravity.d.ts +0 -2
  112. package/dist/gaesup/physics/airplane/gravity.js +0 -6
  113. package/dist/gaesup/physics/airplane/impulse.d.ts +0 -2
  114. package/dist/gaesup/physics/airplane/impulse.js +0 -17
  115. package/dist/gaesup/physics/airplane/index.d.ts +0 -2
  116. package/dist/gaesup/physics/airplane/index.js +0 -14
  117. package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
  118. package/dist/gaesup/physics/airplane/innerCalc.js +0 -16
  119. package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
  120. package/dist/gaesup/physics/airplane/landing.js +0 -18
  121. package/dist/gaesup/physics/character/direction.d.ts +0 -5
  122. package/dist/gaesup/physics/character/direction.js +0 -48
  123. package/dist/gaesup/physics/character/impulse.d.ts +0 -2
  124. package/dist/gaesup/physics/character/impulse.js +0 -26
  125. package/dist/gaesup/physics/character/index.d.ts +0 -2
  126. package/dist/gaesup/physics/character/index.js +0 -12
  127. package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
  128. package/dist/gaesup/physics/character/innerCalc.js +0 -12
  129. package/dist/gaesup/physics/character/queue.d.ts +0 -2
  130. package/dist/gaesup/physics/character/queue.js +0 -48
  131. package/dist/gaesup/physics/character/stop.d.ts +0 -2
  132. package/dist/gaesup/physics/character/stop.js +0 -8
  133. package/dist/gaesup/physics/check/ground.d.ts +0 -2
  134. package/dist/gaesup/physics/check/ground.js +0 -23
  135. package/dist/gaesup/physics/check/index.d.ts +0 -2
  136. package/dist/gaesup/physics/check/index.js +0 -12
  137. package/dist/gaesup/physics/check/moving.d.ts +0 -2
  138. package/dist/gaesup/physics/check/moving.js +0 -11
  139. package/dist/gaesup/physics/check/push.d.ts +0 -2
  140. package/dist/gaesup/physics/check/push.js +0 -6
  141. package/dist/gaesup/physics/check/riding.d.ts +0 -2
  142. package/dist/gaesup/physics/check/riding.js +0 -7
  143. package/dist/gaesup/physics/check/rotate.d.ts +0 -2
  144. package/dist/gaesup/physics/check/rotate.js +0 -8
  145. package/dist/gaesup/physics/index.d.ts +0 -7
  146. package/dist/gaesup/physics/index.js +0 -66
  147. package/dist/gaesup/physics/type.d.ts +0 -42
  148. package/dist/gaesup/physics/type.js +0 -2
  149. package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
  150. package/dist/gaesup/physics/vehicle/damping.js +0 -6
  151. package/dist/gaesup/physics/vehicle/direction.d.ts +0 -3
  152. package/dist/gaesup/physics/vehicle/direction.js +0 -18
  153. package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -2
  154. package/dist/gaesup/physics/vehicle/impulse.js +0 -18
  155. package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
  156. package/dist/gaesup/physics/vehicle/index.js +0 -12
  157. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
  158. package/dist/gaesup/physics/vehicle/innerCalc.js +0 -7
  159. package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
  160. package/dist/gaesup/physics/vehicle/landing.js +0 -18
  161. package/dist/gaesup/tools/clicker/index.d.ts +0 -5
  162. package/dist/gaesup/tools/clicker/index.js +0 -22
  163. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +0 -8
  164. package/dist/gaesup/tools/gamepad/GamePadButton.js +0 -20
  165. package/dist/gaesup/tools/gamepad/index.d.ts +0 -6
  166. package/dist/gaesup/tools/gamepad/index.js +0 -30
  167. package/dist/gaesup/tools/gamepad/type.js +0 -1
  168. package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -9
  169. package/dist/gaesup/tools/jumpPortal/index.js +0 -9
  170. package/dist/gaesup/tools/minimap/default.d.ts +0 -9
  171. package/dist/gaesup/tools/minimap/default.js +0 -9
  172. package/dist/gaesup/tools/minimap/index.d.ts +0 -2
  173. package/dist/gaesup/tools/minimap/index.js +0 -64
  174. package/dist/gaesup/tools/minimap/type.d.ts +0 -30
  175. package/dist/gaesup/tools/minimap/type.js +0 -1
  176. package/dist/gaesup/tools/rideable/index.d.ts +0 -3
  177. package/dist/gaesup/tools/rideable/index.js +0 -41
  178. package/dist/gaesup/tools/rideable/type.d.ts +0 -25
  179. package/dist/gaesup/tools/rideable/type.js +0 -1
  180. package/dist/gaesup/tools/type.d.ts +0 -2
  181. package/dist/gaesup/tools/type.js +0 -1
  182. package/dist/gaesup/utils/context.d.ts +0 -4
  183. package/dist/gaesup/utils/context.js +0 -3
  184. package/dist/gaesup/utils/getTag.d.ts +0 -2
  185. package/dist/gaesup/utils/getTag.js +0 -4
  186. package/dist/gaesup/utils/index.d.ts +0 -3
  187. package/dist/gaesup/utils/index.js +0 -3
  188. package/dist/gaesup/utils/innerHtml.d.ts +0 -4
  189. package/dist/gaesup/utils/innerHtml.js +0 -28
  190. package/dist/gaesup/utils/ray.d.ts +0 -6
  191. package/dist/gaesup/utils/ray.js +0 -6
  192. package/dist/gaesup/utils/ref.d.ts +0 -1
  193. package/dist/gaesup/utils/ref.js +0 -15
  194. package/dist/gaesup/utils/type.d.ts +0 -5
  195. package/dist/gaesup/utils/type.js +0 -1
  196. package/dist/gaesup/utils/vector.d.ts +0 -11
  197. package/dist/gaesup/utils/vector.js +0 -38
  198. package/dist/gaesup/world/context/index.d.ts +0 -4
  199. package/dist/gaesup/world/context/index.js +0 -109
  200. package/dist/gaesup/world/context/reducer.d.ts +0 -24
  201. package/dist/gaesup/world/context/reducer.js +0 -10
  202. package/dist/gaesup/world/context/type.d.ts +0 -182
  203. package/dist/gaesup/world/context/type.js +0 -1
  204. package/dist/gaesup/world/index.d.ts +0 -3
  205. package/dist/gaesup/world/index.js +0 -9
  206. package/dist/gaesup/world/initalize/index.d.ts +0 -4
  207. package/dist/gaesup/world/initalize/index.js +0 -25
  208. package/dist/gaesup/world/type.d.ts +0 -18
  209. package/dist/gaesup/world/type.js +0 -1
  210. package/dist/index.d.ts +0 -22
  211. package/dist/index.js +0 -22
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gaesup-world",
3
- "version": "0.9.52",
3
+ "version": "0.9.53",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -8,7 +8,7 @@
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "clean": "rimraf dist/",
11
- "copy-files": "copyfiles -u 1 src/**/*.css dist/",
11
+ "copy-files": "copyfiles -u 1 dist/",
12
12
  "build": "vite build",
13
13
  "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
14
14
  "preview": "vite preview",
@@ -1,104 +0,0 @@
1
- import { useFrame } from "@react-three/fiber";
2
- import { useContext, useEffect } from "react";
3
- import { useGaesupAnimation } from "../hooks/useGaesupAnimation";
4
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
5
- export function subscribeActions({ type }) {
6
- const { states } = useContext(GaesupWorldContext);
7
- const { subscribeAll } = useGaesupAnimation({ type });
8
- // 초기 기본 애니메이션 등록
9
- useEffect(() => {
10
- subscribeAll([
11
- {
12
- tag: "walk",
13
- condition: () => !states.isRunning && states.isMoving,
14
- action: () => { },
15
- animationName: "walk",
16
- key: "walk",
17
- },
18
- {
19
- tag: "run",
20
- condition: () => states.isRunning,
21
- action: () => { },
22
- animationName: "run",
23
- key: "run",
24
- },
25
- {
26
- tag: "jump",
27
- condition: () => states.isJumping,
28
- action: () => { },
29
- animationName: "jump",
30
- key: "jump",
31
- },
32
- {
33
- tag: "ride",
34
- condition: () => states.isPush["keyR"],
35
- action: () => { },
36
- animationName: "ride",
37
- key: "ride",
38
- },
39
- {
40
- tag: "land",
41
- condition: () => states.isLanding,
42
- action: () => { },
43
- animationName: "land",
44
- key: "land",
45
- },
46
- {
47
- tag: "fall",
48
- condition: () => states.isFalling,
49
- action: () => { },
50
- animationName: "fall",
51
- key: "fall",
52
- },
53
- ]);
54
- }, []);
55
- }
56
- export default function playActions({ type, actions, animationRef, currentAnimation, isActive, }) {
57
- var _a, _b;
58
- const { mode, animationState, block } = useContext(GaesupWorldContext);
59
- const dispatch = useContext(GaesupWorldDispatchContext);
60
- const { notify, store } = useGaesupAnimation({ type });
61
- if (isActive) {
62
- currentAnimation = (_a = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _a === void 0 ? void 0 : _a.current;
63
- }
64
- const play = (tag) => {
65
- animationState[type].current = tag;
66
- const currentAnimation = store[tag];
67
- if (currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.action) {
68
- currentAnimation.action();
69
- }
70
- dispatch({
71
- type: "update",
72
- payload: {
73
- animationState: Object.assign({}, animationState),
74
- },
75
- });
76
- };
77
- useEffect(() => {
78
- var _a;
79
- let animation = "idle";
80
- if (block.animation) {
81
- animation = "idle";
82
- }
83
- else if (currentAnimation) {
84
- animation = currentAnimation;
85
- }
86
- else if (animationState[type].current) {
87
- animation = animationState[type].current;
88
- }
89
- const action = (_a = actions[animation]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
90
- return () => {
91
- action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
92
- };
93
- }, [currentAnimation, mode.type, block.animation, type]);
94
- useFrame(() => {
95
- if (isActive) {
96
- const tag = notify();
97
- play(tag);
98
- }
99
- });
100
- return {
101
- animationRef,
102
- currentAnimation: (_b = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _b === void 0 ? void 0 : _b.current,
103
- };
104
- }
@@ -1,4 +0,0 @@
1
- import { cameraPropType } from "../../physics/type";
2
- import { activeStateType, cameraOptionType } from "../../world/context/type";
3
- export declare const makeNormalCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => any;
4
- export default function normal(prop: cameraPropType): void;
@@ -1,15 +0,0 @@
1
- import { V3 } from "../../utils/vector";
2
- export const makeNormalCameraPosition = (activeState, cameraOption) => {
3
- const { XDistance, YDistance, ZDistance } = cameraOption;
4
- const cameraPosition = activeState.position
5
- .clone()
6
- .add(V3(XDistance, YDistance, ZDistance));
7
- return cameraPosition;
8
- };
9
- export default function normal(prop) {
10
- const { state, worldContext: { cameraOption }, controllerOptions: { lerp }, } = prop;
11
- if (!state || !state.camera)
12
- return;
13
- state.camera.position.lerp(cameraOption.position.clone(), lerp.cameraPosition);
14
- state.camera.lookAt(cameraOption.target);
15
- }
@@ -1,4 +0,0 @@
1
- import { cameraPropType } from "../../physics/type";
2
- import { activeStateType, cameraOptionType } from "../../world/context/type";
3
- export declare const makeOrbitCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => any;
4
- export default function orbit(prop: cameraPropType): void;
@@ -1,22 +0,0 @@
1
- import { quat } from "@react-three/rapier";
2
- import { V3 } from "../../utils/vector";
3
- export const makeOrbitCameraPosition = (activeState, cameraOption) => {
4
- const { XDistance, YDistance, ZDistance } = cameraOption;
5
- const 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
- const { state, worldContext: { activeState, cameraOption }, controllerOptions: { lerp }, } = prop;
13
- if (!state || !state.camera)
14
- return;
15
- const cameraPosition = makeOrbitCameraPosition(activeState, cameraOption);
16
- state.camera.position.lerp(cameraPosition.clone(), lerp.cameraTurn);
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
- }
@@ -1,2 +0,0 @@
1
- import { cameraPropType } from "../physics/type";
2
- export default function Camera(prop: cameraPropType): void;
@@ -1,24 +0,0 @@
1
- import { useFrame } from "@react-three/fiber";
2
- import normal, { makeNormalCameraPosition } from "./control/normal";
3
- import orbit from "./control/orbit";
4
- export default function Camera(prop) {
5
- useFrame((state) => {
6
- prop.state = state;
7
- if (!prop.worldContext.block.camera) {
8
- if (prop.worldContext.mode.control === "orbit") {
9
- orbit(prop);
10
- }
11
- else if (prop.worldContext.mode.control === "normal") {
12
- normal(prop);
13
- }
14
- }
15
- });
16
- // 포커스가 아닐 때 카메라 activeStae 따라가기
17
- useFrame(() => {
18
- if (!prop.worldContext.cameraOption.focus) {
19
- prop.worldContext.cameraOption.target =
20
- prop.worldContext.activeState.position;
21
- prop.worldContext.cameraOption.position = makeNormalCameraPosition(prop.worldContext.activeState, prop.worldContext.cameraOption);
22
- }
23
- });
24
- }
@@ -1,14 +0,0 @@
1
- import * as THREE from "three";
2
- export declare 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
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { activeAirplaneInnerType } from "./type";
2
- export declare function AirplaneRef(props: activeAirplaneInnerType): any;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { AirplaneInnerRef } from "../../inner/airplane";
3
- export function AirplaneRef(props) {
4
- return (_jsx(AirplaneInnerRef, Object.assign({ name: "airplane", isActive: true, currentAnimation: "idle", componentType: "airplane", ridingUrl: props.ridingUrl }, props, { children: props.children })));
5
- }
@@ -1,3 +0,0 @@
1
- import { passiveAirplanePropsType } from "../../passive/airplane/type";
2
- import { innerRefType } from "../../passive/type";
3
- export declare type activeAirplaneInnerType = passiveAirplanePropsType & innerRefType;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CharacterInnerRef } from "../../inner/character";
3
- export function CharacterRef({ children, props, refs, urls, }) {
4
- return (_jsx(CharacterInnerRef, Object.assign({ url: urls.characterUrl, isActive: true, componentType: "character", rigidbodyType: "dynamic", controllerOptions: props.controllerOptions, groundRay: props.groundRay, onAnimate: props.onAnimate, onFrame: props.onFrame, onReady: props.onReady, onDestory: props.onDestory, rigidBodyProps: props.rigidBodyProps, parts: props.parts }, refs, { children: children })));
5
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { activeVehicleInnerType } from "./type";
2
- export declare function VehicleRef(props: activeVehicleInnerType): any;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { VehicleInnerRef } from "../../inner/vehicle";
3
- export function VehicleRef(props) {
4
- return (_jsx(VehicleInnerRef, Object.assign({ name: "vehicle", isActive: true, currentAnimation: "idle", componentType: "vehicle", ridingUrl: props.ridingUrl }, props, { children: props.children })));
5
- }
@@ -1,3 +0,0 @@
1
- import { innerRefType } from "../../passive/type";
2
- import { passiveVehiclePropsType } from "../../passive/vehicle/type";
3
- export declare type activeVehicleInnerType = passiveVehiclePropsType & innerRefType;
@@ -1 +0,0 @@
1
- export {};
@@ -1,5 +0,0 @@
1
- import { controllerInnerType, refsType } from "../controller/type";
2
- export declare function GaesupComponent({ props, refs, }: {
3
- props: controllerInnerType;
4
- refs: refsType;
5
- }): any;
@@ -1,16 +0,0 @@
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 { GaesupWorldContext } from "../world/context";
5
- import { AirplaneRef } from "./active/airplane";
6
- import { CharacterRef } from "./active/character";
7
- import { VehicleRef } from "./active/vehicle";
8
- export function GaesupComponent({ props, refs, }) {
9
- const { mode, states, rideable, urls } = useContext(GaesupWorldContext);
10
- const { enableRiding, isRiderOn, rideableId } = states;
11
- return (_jsxs(_Fragment, { children: [mode.type === "character" && (_jsx(CharacterRef, Object.assign({ props: props, refs: refs, urls: urls }, { children: props.children }))), mode.type === "vehicle" && (_jsx(VehicleRef, Object.assign({ controllerOptions: props.controllerOptions, url: urls.vehicleUrl, wheelUrl: urls.wheelUrl, ridingUrl: urls.ridingUrl, enableRiding: enableRiding, isRiderOn: isRiderOn, groundRay: props.groundRay, offset: rideableId && rideable[rideableId]
12
- ? rideable[rideableId].offset
13
- : vec3() }, refs, { children: props.children }))), mode.type === "airplane" && (_jsx(AirplaneRef, Object.assign({ controllerOptions: props.controllerOptions, url: urls.airplaneUrl, ridingUrl: urls.ridingUrl, enableRiding: enableRiding, isRiderOn: isRiderOn, groundRay: props.groundRay, offset: rideableId && rideable[rideableId]
14
- ? rideable[rideableId].offset
15
- : vec3() }, refs, { children: props.children })))] }));
16
- }
@@ -1,2 +0,0 @@
1
- import { airplaneInnerType } from "./type";
2
- export declare function AirplaneInnerRef(props: airplaneInnerType): any;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { OuterGroupRef } from "../common/OuterGroupRef";
3
- import { RigidBodyRef } from "../common/RigidbodyRef";
4
- export function AirplaneInnerRef(props) {
5
- const { rigidBodyRef, outerGroupRef } = props;
6
- return (_jsx(OuterGroupRef, Object.assign({ ref: outerGroupRef }, { children: _jsx(RigidBodyRef, Object.assign({ ref: rigidBodyRef, name: props.name, componentType: "airplane", ridingUrl: props.ridingUrl }, props, { children: props.children })) })));
7
- }
@@ -1,5 +0,0 @@
1
- import { ridingType, rigidBodyRefType } from "../common/type";
2
- export declare type airplaneUrlType = {
3
- wheelUrl?: string;
4
- };
5
- export declare type airplaneInnerType = rigidBodyRefType & ridingType & airplaneUrlType;
@@ -1 +0,0 @@
1
- export {};
@@ -1,2 +0,0 @@
1
- import { characterInnerType } from "./type";
2
- export declare function CharacterInnerRef(props: characterInnerType): any;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { OuterGroupRef } from "../common/OuterGroupRef";
3
- import { RigidBodyRef } from "../common/RigidbodyRef";
4
- export function CharacterInnerRef(props) {
5
- const { outerGroupRef } = props;
6
- return (_jsx(OuterGroupRef, Object.assign({ ref: outerGroupRef }, { children: _jsx(RigidBodyRef, Object.assign({ name: "character", url: props.url, controllerOptions: props.controllerOptions, ref: props.rigidBodyRef, groundRay: props.groundRay, isNotColliding: props.isNotColliding }, props, { children: props.children })) })));
7
- }
@@ -1,10 +0,0 @@
1
- import { callbackType } from "../../../controller/initialize/callback/type";
2
- import { groundRayType, partsType } from "../../../controller/type";
3
- import { passiveCharacterPropsType } from "../../passive/character/type";
4
- import { componentTypeString, innerRefType } from "../../passive/type";
5
- export declare type characterInnerType = {
6
- componentType: componentTypeString;
7
- isActive?: boolean;
8
- groundRay: groundRayType;
9
- parts?: partsType;
10
- } & passiveCharacterPropsType & innerRefType & callbackType;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export declare const InnerGroupRef: any;
@@ -1,18 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- import * as THREE from "three";
4
- import RiderRef from "../rider";
5
- export const InnerGroupRef = forwardRef((props, ref) => {
6
- return (_jsxs("group", Object.assign({ receiveShadow: true, castShadow: true, ref: ref, userData: { intangible: true } }, { children: [props.isRiderOn &&
7
- props.enableRiding &&
8
- props.isActive &&
9
- props.ridingUrl && (_jsx(RiderRef, { url: props.ridingUrl, offset: props.offset })), props.children, props.objectNode && props.animationRef && (_jsx("primitive", { object: props.objectNode, visible: false, receiveShadow: true, castShadow: true, ref: props.animationRef })), Object.keys(props.nodes).map((name, key) => {
10
- const node = props.nodes[name];
11
- if (node instanceof THREE.SkinnedMesh) {
12
- return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry, skeleton: node.skeleton }, key));
13
- }
14
- else if (node instanceof THREE.Mesh) {
15
- return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry }, key));
16
- }
17
- })] })));
18
- });
@@ -1 +0,0 @@
1
- export declare const OuterGroupRef: any;
@@ -1,5 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- export const OuterGroupRef = forwardRef(({ children, }, ref) => {
4
- return (_jsx("group", Object.assign({ ref: ref, userData: { intangible: true } }, { children: children })));
5
- });
@@ -1 +0,0 @@
1
- export declare const RigidBodyRef: any;
@@ -1,248 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- // import { useAnimations, useGLTF } from "@react-three/drei";
3
- // import { useFrame, useGraph } from "@react-three/fiber";
4
- // import {
5
- // CapsuleCollider,
6
- // RapierRigidBody,
7
- // RigidBody,
8
- // euler,
9
- // } from "@react-three/rapier";
10
- // import { MutableRefObject, forwardRef, useContext, useMemo } from "react";
11
- // import * as THREE from "three";
12
- // import { SkeletonUtils } from "three-stdlib";
13
- // import playActions, { subscribeActions } from "../../../animation/actions";
14
- // import Camera from "../../../camera";
15
- // import { GaesupControllerContext } from "../../../controller/context";
16
- // import initCallback from "../../../controller/initialize/callback";
17
- // import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
18
- // import calculation from "../../../physics";
19
- // import { cameraPropType } from "../../../physics/type";
20
- // import { V3 } from "../../../utils";
21
- // import { GaesupWorldContext } from "../../../world/context";
22
- // import { InnerGroupRef } from "./InnerGroupRef";
23
- // import { PartsGroupRef } from "./partsGroupRef";
24
- // import { setGroundRay } from "./setGroundRay";
25
- // import { rigidBodyRefType } from "./type";
26
- //
27
- // export const RigidBodyRef = forwardRef(
28
- // (props: rigidBodyRefType, ref: MutableRefObject<RapierRigidBody>) => {
29
- // const { size } = useGltfAndSize({ url: props.url });
30
- //
31
- // props.groundRay &&
32
- // setGroundRay({
33
- // groundRay: props.groundRay,
34
- // length: 0.5,
35
- // colliderRef: props.colliderRef,
36
- // });
37
- // const { scene, animations } = useGLTF(props.url);
38
- // const { actions, ref: animationRef } = useAnimations(animations);
39
- // const worldContext = useContext(GaesupWorldContext);
40
- // const controllerContext = useContext(GaesupControllerContext);
41
- // if (props.isActive) {
42
- // subscribeActions({
43
- // type: props.componentType,
44
- // groundRay: props.groundRay,
45
- // animations: animations,
46
- // });
47
- // const cameraProps: cameraPropType = {
48
- // state: null,
49
- // worldContext,
50
- // controllerContext,
51
- // controllerOptions: props.controllerOptions,
52
- // };
53
- //
54
- // Camera(cameraProps);
55
- // calculation({
56
- // outerGroupRef: props.outerGroupRef,
57
- // innerGroupRef: props.innerGroupRef,
58
- // rigidBodyRef: ref,
59
- // colliderRef: props.colliderRef,
60
- // groundRay: props.groundRay,
61
- // });
62
- // }
63
- // playActions({
64
- // type: props.componentType,
65
- // actions,
66
- // animationRef,
67
- // currentAnimation: props.isActive ? undefined : props.currentAnimation,
68
- // isActive: props.isActive,
69
- // });
70
- // initCallback({
71
- // props,
72
- // actions,
73
- // componentType: props.componentType,
74
- // });
75
- // const clone = useMemo(() => SkeletonUtils.clone(scene), [scene]);
76
- // const { nodes } = useGraph(clone);
77
- // const objectNode = Object.values(nodes).find(
78
- // (node) => node.type === "Object3D"
79
- // );
80
- // useFrame(() => {
81
- // if (props.isActive || !props.position || !ref || !ref.current) return;
82
- // ref.current.setTranslation(
83
- // V3(
84
- // THREE.MathUtils.lerp(
85
- // ref.current.translation().x,
86
- // props.position.x,
87
- // props.controllerOptions.lerp.cameraPosition
88
- // ),
89
- // THREE.MathUtils.lerp(
90
- // ref.current.translation().y,
91
- // props.position.y,
92
- // props.controllerOptions.lerp.cameraPosition
93
- // ),
94
- // THREE.MathUtils.lerp(
95
- // ref.current.translation().z,
96
- // props.position.z,
97
- // props.controllerOptions.lerp.cameraPosition
98
- // )
99
- // ),
100
- // false
101
- // );
102
- // });
103
- // return (
104
- // <RigidBody
105
- // colliders={false}
106
- // ref={ref}
107
- // name={props.name}
108
- // rotation={euler()
109
- // .set(0, props.rotation?.clone().y || 0, 0)
110
- // .clone()}
111
- // userData={props.userData}
112
- // type={props.rigidbodyType || (props.isActive ? "dynamic" : "fixed")}
113
- // sensor={props.sensor}
114
- // onIntersectionEnter={props.onIntersectionEnter}
115
- // onCollisionEnter={props.onCollisionEnter}
116
- // {...props.rigidBodyProps}
117
- // >
118
- // {!props.isNotColliding && (
119
- // <CapsuleCollider
120
- // ref={props.colliderRef as any}
121
- // args={[(size.y / 2 - size.x) * 1.2, size.x * 1.2]}
122
- // position={[0, (size.y / 2 + size.x / 2) * 1.2, 0]}
123
- // />
124
- // )}
125
- // <InnerGroupRef
126
- // objectNode={objectNode}
127
- // animationRef={animationRef}
128
- // nodes={nodes}
129
- // ref={props.innerGroupRef}
130
- // isActive={props.isActive}
131
- // isRiderOn={props.isRiderOn}
132
- // enableRiding={props.enableRiding}
133
- // ridingUrl={props.ridingUrl}
134
- // offset={props.offset}
135
- // parts={props.parts}
136
- // >
137
- // {props.children}
138
- // {props.parts &&
139
- // props.parts.length > 0 &&
140
- // props.parts.map(({ url, color }, key) => {
141
- // if (!url) return null;
142
- // return (
143
- // <PartsGroupRef
144
- // url={url}
145
- // isActive={props.isActive}
146
- // componentType={props.componentType}
147
- // currentAnimation={props.currentAnimation}
148
- // color={color}
149
- // key={key + url}
150
- // />
151
- // );
152
- // })}
153
- // </InnerGroupRef>
154
- // </RigidBody>
155
- // );
156
- // }
157
- // );
158
- import { useAnimations, useGLTF } from "@react-three/drei";
159
- import { useFrame, useGraph } from "@react-three/fiber";
160
- import { CapsuleCollider, RigidBody, euler, } from "@react-three/rapier";
161
- import { forwardRef, useContext, useMemo } from "react";
162
- import * as THREE from "three";
163
- import { SkeletonUtils } from "three-stdlib";
164
- import playActions, { subscribeActions } from "../../../animation/actions";
165
- import Camera from "../../../camera";
166
- import { GaesupControllerContext } from "../../../controller/context";
167
- import initCallback from "../../../controller/initialize/callback";
168
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
169
- import calculation from "../../../physics";
170
- import { V3 } from "../../../utils";
171
- import { GaesupWorldContext } from "../../../world/context";
172
- import { InnerGroupRef } from "./InnerGroupRef";
173
- import { PartsGroupRef } from "./partsGroupRef";
174
- import { setGroundRay } from "./setGroundRay";
175
- export const RigidBodyRef = forwardRef((props, ref) => {
176
- var _a;
177
- const { size } = useGltfAndSize({ url: props.url });
178
- props.groundRay &&
179
- setGroundRay({
180
- groundRay: props.groundRay,
181
- length: 0.5,
182
- colliderRef: props.colliderRef,
183
- });
184
- const { scene, animations } = useGLTF(props.url);
185
- const { actions, ref: animationRef } = useAnimations(animations);
186
- const worldContext = useContext(GaesupWorldContext);
187
- const controllerContext = useContext(GaesupControllerContext);
188
- // skeleton을 추출하여 memoization
189
- const clone = useMemo(() => SkeletonUtils.clone(scene), [scene]);
190
- const skeleton = useMemo(() => {
191
- let skel = null;
192
- clone.traverse((child) => {
193
- if (child instanceof THREE.SkinnedMesh) {
194
- skel = child.skeleton;
195
- }
196
- });
197
- return skel;
198
- }, [clone]);
199
- if (props.isActive) {
200
- subscribeActions({
201
- type: props.componentType,
202
- groundRay: props.groundRay,
203
- animations: animations,
204
- });
205
- const cameraProps = {
206
- state: null,
207
- worldContext,
208
- controllerContext,
209
- controllerOptions: props.controllerOptions,
210
- };
211
- Camera(cameraProps);
212
- calculation({
213
- outerGroupRef: props.outerGroupRef,
214
- innerGroupRef: props.innerGroupRef,
215
- rigidBodyRef: ref,
216
- colliderRef: props.colliderRef,
217
- groundRay: props.groundRay,
218
- });
219
- }
220
- playActions({
221
- type: props.componentType,
222
- actions,
223
- animationRef,
224
- currentAnimation: props.isActive ? undefined : props.currentAnimation,
225
- isActive: props.isActive,
226
- });
227
- initCallback({
228
- props,
229
- actions,
230
- componentType: props.componentType,
231
- });
232
- const { nodes } = useGraph(clone);
233
- const objectNode = Object.values(nodes).find((node) => node.type === "Object3D");
234
- useFrame(() => {
235
- if (props.isActive || !props.position || !ref || !ref.current)
236
- return;
237
- ref.current.setTranslation(V3(THREE.MathUtils.lerp(ref.current.translation().x, props.position.x, props.controllerOptions.lerp.cameraPosition), THREE.MathUtils.lerp(ref.current.translation().y, props.position.y, props.controllerOptions.lerp.cameraPosition), THREE.MathUtils.lerp(ref.current.translation().z, props.position.z, props.controllerOptions.lerp.cameraPosition)), false);
238
- });
239
- return (_jsxs(RigidBody, Object.assign({ colliders: false, ref: ref, name: props.name, rotation: euler()
240
- .set(0, ((_a = props.rotation) === null || _a === void 0 ? void 0 : _a.clone().y) || 0, 0)
241
- .clone(), userData: props.userData, type: props.rigidbodyType || (props.isActive ? "dynamic" : "fixed"), sensor: props.sensor, onIntersectionEnter: props.onIntersectionEnter, onCollisionEnter: props.onCollisionEnter }, props.rigidBodyProps, { children: [!props.isNotColliding && (_jsx(CapsuleCollider, { ref: props.colliderRef, args: [(size.y / 2 - size.x) * 1.2, size.x * 1.2], position: [0, (size.y / 2 + size.x / 2) * 1.2, 0] })), _jsxs(InnerGroupRef, Object.assign({ objectNode: objectNode, animationRef: animationRef, nodes: nodes, ref: props.innerGroupRef, isActive: props.isActive, isRiderOn: props.isRiderOn, enableRiding: props.enableRiding, ridingUrl: props.ridingUrl, offset: props.offset, parts: props.parts }, { children: [props.children, props.parts &&
242
- props.parts.length > 0 &&
243
- props.parts.map(({ url, color }, key) => {
244
- if (!url)
245
- return null;
246
- return (_jsx(PartsGroupRef, { url: url, isActive: props.isActive, componentType: props.componentType, currentAnimation: props.currentAnimation, color: color, skeleton: skeleton }, key + url));
247
- })] }))] })));
248
- });
@@ -1,6 +0,0 @@
1
- export declare const calcCharacterColliderProps: (characterSize: THREE.Vector3) => {
2
- height: number;
3
- halfHeight: number;
4
- radius: number;
5
- diameter: number;
6
- };