gaesup-world 0.2.35 → 0.2.36

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 (225) hide show
  1. package/package.json +1 -1
  2. package/dist/gaesup/animation/actions.d.ts +0 -44
  3. package/dist/gaesup/animation/actions.js +0 -103
  4. package/dist/gaesup/camera/control/normal.d.ts +0 -4
  5. package/dist/gaesup/camera/control/normal.js +0 -18
  6. package/dist/gaesup/camera/control/orbit.d.ts +0 -4
  7. package/dist/gaesup/camera/control/orbit.js +0 -22
  8. package/dist/gaesup/camera/detector/index.d.ts +0 -2
  9. package/dist/gaesup/camera/detector/index.js +0 -25
  10. package/dist/gaesup/camera/index.d.ts +0 -8
  11. package/dist/gaesup/camera/index.js +0 -110
  12. package/dist/gaesup/camera/type.d.ts +0 -13
  13. package/dist/gaesup/camera/type.js +0 -1
  14. package/dist/gaesup/component/active/airplane/index.d.ts +0 -11
  15. package/dist/gaesup/component/active/airplane/index.js +0 -6
  16. package/dist/gaesup/component/active/character/index.d.ts +0 -7
  17. package/dist/gaesup/component/active/character/index.js +0 -34
  18. package/dist/gaesup/component/active/vehicle/index.d.ts +0 -12
  19. package/dist/gaesup/component/active/vehicle/index.js +0 -31
  20. package/dist/gaesup/component/index.d.ts +0 -7
  21. package/dist/gaesup/component/index.js +0 -19
  22. package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
  23. package/dist/gaesup/component/inner/airplane/index.js +0 -16
  24. package/dist/gaesup/component/inner/character/index.d.ts +0 -25
  25. package/dist/gaesup/component/inner/character/index.js +0 -28
  26. package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -10
  27. package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -29
  28. package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -4
  29. package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -6
  30. package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -12
  31. package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -7
  32. package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -9
  33. package/dist/gaesup/component/inner/common/setGroundRay.js +0 -14
  34. package/dist/gaesup/component/inner/common/type.d.ts +0 -20
  35. package/dist/gaesup/component/inner/common/type.js +0 -1
  36. package/dist/gaesup/component/inner/rider/index.d.ts +0 -11
  37. package/dist/gaesup/component/inner/rider/index.js +0 -31
  38. package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -10
  39. package/dist/gaesup/component/inner/vehicle/collider.js +0 -19
  40. package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
  41. package/dist/gaesup/component/inner/vehicle/index.js +0 -17
  42. package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -7
  43. package/dist/gaesup/component/inner/vehicle/wheels.js +0 -64
  44. package/dist/gaesup/component/passive/airplane/index.d.ts +0 -13
  45. package/dist/gaesup/component/passive/airplane/index.js +0 -40
  46. package/dist/gaesup/component/passive/character/index.d.ts +0 -10
  47. package/dist/gaesup/component/passive/character/index.js +0 -46
  48. package/dist/gaesup/component/passive/type.d.ts +0 -20
  49. package/dist/gaesup/component/passive/type.js +0 -1
  50. package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -13
  51. package/dist/gaesup/component/passive/vehicle/index.js +0 -17
  52. package/dist/gaesup/component/type.d.ts +0 -17
  53. package/dist/gaesup/component/type.js +0 -1
  54. package/dist/gaesup/controller/context/index.d.ts +0 -49
  55. package/dist/gaesup/controller/context/index.js +0 -59
  56. package/dist/gaesup/controller/context/reducer.d.ts +0 -12
  57. package/dist/gaesup/controller/context/reducer.js +0 -21
  58. package/dist/gaesup/controller/context/type.d.ts +0 -38
  59. package/dist/gaesup/controller/context/type.js +0 -1
  60. package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
  61. package/dist/gaesup/controller/debug/airplane.js +0 -71
  62. package/dist/gaesup/controller/debug/character.d.ts +0 -27
  63. package/dist/gaesup/controller/debug/character.js +0 -27
  64. package/dist/gaesup/controller/debug/index.d.ts +0 -6
  65. package/dist/gaesup/controller/debug/index.js +0 -49
  66. package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
  67. package/dist/gaesup/controller/debug/vehicle.js +0 -27
  68. package/dist/gaesup/controller/index.d.ts +0 -3
  69. package/dist/gaesup/controller/index.js +0 -75
  70. package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -2
  71. package/dist/gaesup/controller/initialize/callback/index.js +0 -62
  72. package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -27
  73. package/dist/gaesup/controller/initialize/callback/type.js +0 -1
  74. package/dist/gaesup/controller/initialize/index.d.ts +0 -10
  75. package/dist/gaesup/controller/initialize/index.js +0 -75
  76. package/dist/gaesup/controller/style.css +0 -48
  77. package/dist/gaesup/controller/type.d.ts +0 -85
  78. package/dist/gaesup/controller/type.js +0 -1
  79. package/dist/gaesup/gaesupProps/index.d.ts +0 -7
  80. package/dist/gaesup/gaesupProps/index.js +0 -46
  81. package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
  82. package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
  83. package/dist/gaesup/hooks/useGaesupController/index.d.ts +0 -10
  84. package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
  85. package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
  86. package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -73
  87. package/dist/gaesup/hooks/useJoyStick/index.d.ts +0 -39
  88. package/dist/gaesup/hooks/useJoyStick/index.js +0 -61
  89. package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
  90. package/dist/gaesup/hooks/usePushKey/index.js +0 -29
  91. package/dist/gaesup/hooks/useRideable/index.d.ts +0 -28
  92. package/dist/gaesup/hooks/useRideable/index.js +0 -199
  93. package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
  94. package/dist/gaesup/hooks/useTeleport/index.js +0 -12
  95. package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
  96. package/dist/gaesup/physics/airplane/damping.js +0 -5
  97. package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
  98. package/dist/gaesup/physics/airplane/direction.js +0 -65
  99. package/dist/gaesup/physics/airplane/gravity.d.ts +0 -14
  100. package/dist/gaesup/physics/airplane/gravity.js +0 -18
  101. package/dist/gaesup/physics/airplane/impulse.d.ts +0 -16
  102. package/dist/gaesup/physics/airplane/impulse.js +0 -31
  103. package/dist/gaesup/physics/airplane/index.d.ts +0 -2
  104. package/dist/gaesup/physics/airplane/index.js +0 -14
  105. package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
  106. package/dist/gaesup/physics/airplane/innerCalc.js +0 -27
  107. package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
  108. package/dist/gaesup/physics/airplane/landing.js +0 -29
  109. package/dist/gaesup/physics/character/direction.d.ts +0 -23
  110. package/dist/gaesup/physics/character/direction.js +0 -55
  111. package/dist/gaesup/physics/character/impulse.d.ts +0 -2
  112. package/dist/gaesup/physics/character/impulse.js +0 -43
  113. package/dist/gaesup/physics/character/index.d.ts +0 -2
  114. package/dist/gaesup/physics/character/index.js +0 -8
  115. package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
  116. package/dist/gaesup/physics/character/innerCalc.js +0 -31
  117. package/dist/gaesup/physics/check/ground.d.ts +0 -2
  118. package/dist/gaesup/physics/check/ground.js +0 -15
  119. package/dist/gaesup/physics/check/index.d.ts +0 -2
  120. package/dist/gaesup/physics/check/index.js +0 -12
  121. package/dist/gaesup/physics/check/moving.d.ts +0 -2
  122. package/dist/gaesup/physics/check/moving.js +0 -16
  123. package/dist/gaesup/physics/check/push.d.ts +0 -2
  124. package/dist/gaesup/physics/check/push.js +0 -6
  125. package/dist/gaesup/physics/check/riding.d.ts +0 -2
  126. package/dist/gaesup/physics/check/riding.js +0 -7
  127. package/dist/gaesup/physics/check/rotate.d.ts +0 -2
  128. package/dist/gaesup/physics/check/rotate.js +0 -8
  129. package/dist/gaesup/physics/index.d.ts +0 -2
  130. package/dist/gaesup/physics/index.js +0 -58
  131. package/dist/gaesup/physics/type.d.ts +0 -36
  132. package/dist/gaesup/physics/type.js +0 -1
  133. package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
  134. package/dist/gaesup/physics/vehicle/damping.js +0 -6
  135. package/dist/gaesup/physics/vehicle/direction.d.ts +0 -4
  136. package/dist/gaesup/physics/vehicle/direction.js +0 -30
  137. package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -16
  138. package/dist/gaesup/physics/vehicle/impulse.js +0 -40
  139. package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
  140. package/dist/gaesup/physics/vehicle/index.js +0 -12
  141. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
  142. package/dist/gaesup/physics/vehicle/innerCalc.js +0 -24
  143. package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
  144. package/dist/gaesup/physics/vehicle/landing.js +0 -29
  145. package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +0 -9
  146. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +0 -16
  147. package/dist/gaesup/tools/gameBoy/index.d.ts +0 -8
  148. package/dist/gaesup/tools/gameBoy/index.js +0 -22
  149. package/dist/gaesup/tools/gameBoy/style.css +0 -92
  150. package/dist/gaesup/tools/gameBoy/type.d.ts +0 -4
  151. package/dist/gaesup/tools/gameBoy/type.js +0 -1
  152. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +0 -8
  153. package/dist/gaesup/tools/gamePad/GamePadButton.js +0 -21
  154. package/dist/gaesup/tools/gamePad/index.d.ts +0 -6
  155. package/dist/gaesup/tools/gamePad/index.js +0 -32
  156. package/dist/gaesup/tools/gamePad/style.css +0 -62
  157. package/dist/gaesup/tools/gamePad/type.d.ts +0 -6
  158. package/dist/gaesup/tools/gamePad/type.js +0 -1
  159. package/dist/gaesup/tools/joyStick/index.d.ts +0 -6
  160. package/dist/gaesup/tools/joyStick/index.js +0 -169
  161. package/dist/gaesup/tools/joyStick/style.css +0 -38
  162. package/dist/gaesup/tools/joyStick/type.d.ts +0 -19
  163. package/dist/gaesup/tools/joyStick/type.js +0 -1
  164. package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -16
  165. package/dist/gaesup/tools/jumpPortal/index.js +0 -18
  166. package/dist/gaesup/tools/jumpPortal/style.css +0 -16
  167. package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +0 -402
  168. package/dist/gaesup/tools/keyBoardToolTip/constant.js +0 -122
  169. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -10
  170. package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -12
  171. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +0 -3
  172. package/dist/gaesup/tools/keyBoardToolTip/index.js +0 -70
  173. package/dist/gaesup/tools/keyBoardToolTip/style.css +0 -24
  174. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +0 -37
  175. package/dist/gaesup/tools/keyBoardToolTip/type.js +0 -1
  176. package/dist/gaesup/tools/miniMap/default.d.ts +0 -9
  177. package/dist/gaesup/tools/miniMap/default.js +0 -9
  178. package/dist/gaesup/tools/miniMap/index.d.ts +0 -3
  179. package/dist/gaesup/tools/miniMap/index.js +0 -72
  180. package/dist/gaesup/tools/miniMap/style.css +0 -228
  181. package/dist/gaesup/tools/miniMap/type.d.ts +0 -25
  182. package/dist/gaesup/tools/miniMap/type.js +0 -1
  183. package/dist/gaesup/tools/rideable/index.d.ts +0 -3
  184. package/dist/gaesup/tools/rideable/index.js +0 -79
  185. package/dist/gaesup/tools/rideable/style.css +0 -16
  186. package/dist/gaesup/tools/type.d.ts +0 -2
  187. package/dist/gaesup/tools/type.js +0 -1
  188. package/dist/gaesup/tools/zoomButton/index.d.ts +0 -18
  189. package/dist/gaesup/tools/zoomButton/index.js +0 -146
  190. package/dist/gaesup/tools/zoomButton/style.css +0 -16
  191. package/dist/gaesup/utils/context.d.ts +0 -2
  192. package/dist/gaesup/utils/context.js +0 -3
  193. package/dist/gaesup/utils/debug.d.ts +0 -29
  194. package/dist/gaesup/utils/debug.js +0 -36
  195. package/dist/gaesup/utils/index.d.ts +0 -3
  196. package/dist/gaesup/utils/index.js +0 -3
  197. package/dist/gaesup/utils/ray.d.ts +0 -7
  198. package/dist/gaesup/utils/ray.js +0 -6
  199. package/dist/gaesup/utils/ref.d.ts +0 -2
  200. package/dist/gaesup/utils/ref.js +0 -16
  201. package/dist/gaesup/utils/type.d.ts +0 -5
  202. package/dist/gaesup/utils/type.js +0 -1
  203. package/dist/gaesup/utils/vector.d.ts +0 -10
  204. package/dist/gaesup/utils/vector.js +0 -33
  205. package/dist/gaesup/world/context/index.d.ts +0 -6
  206. package/dist/gaesup/world/context/index.js +0 -117
  207. package/dist/gaesup/world/context/reducer.d.ts +0 -29
  208. package/dist/gaesup/world/context/reducer.js +0 -21
  209. package/dist/gaesup/world/context/type.d.ts +0 -169
  210. package/dist/gaesup/world/context/type.js +0 -1
  211. package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
  212. package/dist/gaesup/world/debug/cameraOption.js +0 -47
  213. package/dist/gaesup/world/debug/index.d.ts +0 -6
  214. package/dist/gaesup/world/debug/index.js +0 -32
  215. package/dist/gaesup/world/debug/mode.d.ts +0 -10
  216. package/dist/gaesup/world/debug/mode.js +0 -10
  217. package/dist/gaesup/world/index.d.ts +0 -3
  218. package/dist/gaesup/world/index.js +0 -10
  219. package/dist/gaesup/world/initalize/index.d.ts +0 -35
  220. package/dist/gaesup/world/initalize/index.js +0 -62
  221. package/dist/gaesup/world/style.css +0 -13
  222. package/dist/gaesup/world/type.d.ts +0 -19
  223. package/dist/gaesup/world/type.js +0 -1
  224. package/dist/index.d.ts +0 -23
  225. package/dist/index.js +0 -23
@@ -1,6 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from "react";
3
- export var OuterGroupRef = forwardRef(function (_a, ref) {
4
- var children = _a.children;
5
- return (_jsx("group", { ref: ref, userData: { intangible: true }, children: children }));
6
- });
@@ -1,12 +0,0 @@
1
- import { CollisionEnterPayload, RapierRigidBody } from "@react-three/rapier";
2
- import { ReactNode } from "react";
3
- export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
4
- children: ReactNode;
5
- name?: string;
6
- position?: THREE.Vector3;
7
- rotation?: THREE.Euler;
8
- userData?: {
9
- intangible: boolean;
10
- };
11
- onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
12
- } & import("react").RefAttributes<RapierRigidBody>>;
@@ -1,7 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { RigidBody, euler, } from "@react-three/rapier";
3
- import { forwardRef } from "react";
4
- export var RigidBodyRef = forwardRef(function (_a, ref) {
5
- var children = _a.children, name = _a.name, position = _a.position, rotation = _a.rotation, userData = _a.userData, onCollisionEnter = _a.onCollisionEnter;
6
- return (_jsx(RigidBody, { colliders: false, ref: ref, name: name, position: position, rotation: euler().set(0, (rotation === null || rotation === void 0 ? void 0 : rotation.clone().y) || 0, 0), userData: userData, onCollisionEnter: onCollisionEnter, children: children }));
7
- });
@@ -1,9 +0,0 @@
1
- import { Collider } from "@dimforge/rapier3d-compat";
2
- import { RefObject } from "react";
3
- import { groundRayType } from "../../../controller/type";
4
- export type setGroundRayType = {
5
- groundRay: groundRayType;
6
- length: number;
7
- colliderRef: RefObject<Collider>;
8
- };
9
- export declare function setGroundRay({ groundRay, length, colliderRef, }: setGroundRayType): void;
@@ -1,14 +0,0 @@
1
- import { useRapier } from "@react-three/rapier";
2
- import { getRayHit } from "../../../utils";
3
- export function setGroundRay(_a) {
4
- var _b;
5
- var groundRay = _a.groundRay, length = _a.length, colliderRef = _a.colliderRef;
6
- var rapier = useRapier().rapier;
7
- groundRay.length = length;
8
- groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
9
- groundRay.hit = getRayHit({
10
- ray: groundRay,
11
- ref: colliderRef,
12
- });
13
- groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
14
- }
@@ -1,20 +0,0 @@
1
- /// <reference types="react" />
2
- import { CollisionEnterPayload } from "@react-three/rapier";
3
- import { refsType } from "../../../controller/type";
4
- import { urlsType } from "../../../world/context/type";
5
- export type refPropsType = {
6
- children: React.ReactNode;
7
- refs: Partial<refsType>;
8
- urls: urlsType;
9
- isRiderOn?: boolean;
10
- enableRiding?: boolean;
11
- offset?: THREE.Vector3;
12
- name?: string;
13
- position?: THREE.Vector3;
14
- rotation?: THREE.Euler;
15
- userData?: {
16
- intangible: boolean;
17
- };
18
- currentAnimation?: string;
19
- onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
20
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,11 +0,0 @@
1
- import { ReactNode } from "react";
2
- import * as THREE from "three";
3
- import { urlsType } from "../../../world/context/type";
4
- export type riderRefType = {
5
- urls: urlsType;
6
- children?: ReactNode;
7
- offset?: THREE.Vector3;
8
- euler?: THREE.Euler;
9
- currentAnimation?: string;
10
- };
11
- export default function RiderRef({ urls, children, offset, euler, currentAnimation, }: riderRefType): import("react/jsx-runtime").JSX.Element;
@@ -1,31 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useAnimations } from "@react-three/drei";
3
- import { useGraph } from "@react-three/fiber";
4
- import { useMemo } from "react";
5
- import * as THREE from "three";
6
- import { SkeletonUtils } from "three-stdlib";
7
- import playActions from "../../../animation/actions";
8
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
9
- export default function RiderRef(_a) {
10
- var urls = _a.urls, children = _a.children, offset = _a.offset, euler = _a.euler, currentAnimation = _a.currentAnimation;
11
- var gltf = useGltfAndSize({ url: urls.characterUrl }).gltf;
12
- var animations = gltf.animations, scene = gltf.scene;
13
- var animationResult = useAnimations(animations);
14
- var animationRef = playActions({
15
- type: "character",
16
- animationResult: animationResult,
17
- currentAnimation: currentAnimation || "ride",
18
- }).animationRef;
19
- var characterClone = useMemo(function () { return SkeletonUtils.clone(scene); }, [scene]);
20
- var characterNodes = useGraph(characterClone).nodes;
21
- var characterObjectNode = Object.values(characterNodes).find(function (node) { return node.type === "Object3D"; });
22
- return (_jsx(_Fragment, { children: _jsxs("group", { position: offset, rotation: euler, children: [characterObjectNode && (_jsx("primitive", { object: characterObjectNode, visible: false, receiveShadow: true, castShadow: true, ref: animationRef })), Object.keys(characterNodes).map(function (name, key) {
23
- var characterNode = characterNodes[name];
24
- if (characterNode instanceof THREE.SkinnedMesh) {
25
- return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: characterNode.material, geometry: characterNode.geometry, skeleton: characterNode.skeleton }, key));
26
- }
27
- else if (characterNode instanceof THREE.Mesh) {
28
- return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: characterNode.material, geometry: characterNode.geometry }, key));
29
- }
30
- }), children] }) }));
31
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { Collider } from "@dimforge/rapier3d-compat";
3
- import { urlsType } from "../../../world/context/type";
4
- export declare const VehicleWheelCollider: import("react").ForwardRefExoticComponent<{
5
- urls: urlsType;
6
- vehicleSize: THREE.Vector3;
7
- } & import("react").RefAttributes<Collider>>;
8
- export declare const VehicleCollider: import("react").ForwardRefExoticComponent<{
9
- vehicleSize: THREE.Vector3;
10
- } & import("react").RefAttributes<Collider>>;
@@ -1,19 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { CuboidCollider } from "@react-three/rapier";
3
- import { forwardRef } from "react";
4
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
5
- export var VehicleWheelCollider = forwardRef(function (_a, ref) {
6
- var urls = _a.urls, vehicleSize = _a.vehicleSize;
7
- var wheelSize = useGltfAndSize({
8
- url: urls.wheelUrl,
9
- }).size;
10
- return (_jsx(CuboidCollider, { ref: ref, args: [
11
- vehicleSize.x / 2,
12
- vehicleSize.y / 2 - wheelSize.y / 2,
13
- vehicleSize.z / 2,
14
- ], position: [0, vehicleSize.y / 2 + wheelSize.y / 2, 0] }));
15
- });
16
- export var VehicleCollider = forwardRef(function (_a, ref) {
17
- var vehicleSize = _a.vehicleSize;
18
- return (_jsx(CuboidCollider, { ref: ref, args: [vehicleSize.x / 2, vehicleSize.y / 2, vehicleSize.z / 2], position: [0, vehicleSize.y / 2, 0] }));
19
- });
@@ -1,2 +0,0 @@
1
- import { refPropsType } from "../common/type";
2
- export declare function VehicleInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, currentAnimation, onCollisionEnter, }: refPropsType): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
3
- import { InnerGroupRef } from "../common/InnerGroupRef";
4
- import { OuterGroupRef } from "../common/OuterGroupRef";
5
- import { RigidBodyRef } from "../common/RigidbodyRef";
6
- import RiderRef from "../rider";
7
- import { VehicleCollider, VehicleWheelCollider } from "./collider";
8
- import { WheelsRef } from "./wheels";
9
- export function VehicleInnerRef(_a) {
10
- 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, currentAnimation = _a.currentAnimation, onCollisionEnter = _a.onCollisionEnter;
11
- var vehicleUrl = urls.vehicleUrl, wheelUrl = urls.wheelUrl;
12
- var rigidBodyRef = refs.rigidBodyRef, innerGroupRef = refs.innerGroupRef, outerGroupRef = refs.outerGroupRef;
13
- var vehicleSize = useGltfAndSize({
14
- url: urls.vehicleUrl,
15
- }).size;
16
- return (_jsxs(OuterGroupRef, { ref: outerGroupRef, children: [vehicleUrl && rigidBodyRef && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, children: [wheelUrl ? (_jsx(VehicleWheelCollider, { urls: urls, vehicleSize: vehicleSize })) : (_jsx(VehicleCollider, { vehicleSize: vehicleSize })), enableRiding && isRiderOn && urls.characterUrl && (_jsx(RiderRef, { urls: urls, offset: offset })), children, _jsx(InnerGroupRef, { type: "vehicle", url: vehicleUrl, currentAnimation: currentAnimation, ref: innerGroupRef })] })), wheelUrl && (_jsx(WheelsRef, { refs: refs, urls: urls, vehicleSize: vehicleSize }))] }));
17
- }
@@ -1,7 +0,0 @@
1
- import { refsType } from "../../../controller/type";
2
- import { urlsType } from "../../../world/context/type";
3
- export declare function WheelsRef({ vehicleSize, refs, urls, }: {
4
- vehicleSize: THREE.Vector3;
5
- refs: Partial<refsType>;
6
- urls: urlsType;
7
- }): import("react/jsx-runtime").JSX.Element;
@@ -1,64 +0,0 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Gltf } from "@react-three/drei";
3
- import { useFrame } from "@react-three/fiber";
4
- import { CylinderCollider, RigidBody, useRevoluteJoint, } from "@react-three/rapier";
5
- import { createRef, useContext, useRef } from "react";
6
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
7
- import { GaesupWorldContext } from "../../../world/context";
8
- var WheelJoint = function (_a) {
9
- var body = _a.body, wheel = _a.wheel, bodyAnchor = _a.bodyAnchor, wheelAnchor = _a.wheelAnchor, rotationAxis = _a.rotationAxis;
10
- var joint = useRevoluteJoint(body, wheel, [
11
- bodyAnchor,
12
- wheelAnchor,
13
- rotationAxis,
14
- ]);
15
- var activeState = useContext(GaesupWorldContext).activeState;
16
- useFrame(function () {
17
- if (joint.current) {
18
- joint.current.configureMotorPosition(activeState.position.length(), 0.8, 0);
19
- }
20
- });
21
- return null;
22
- };
23
- export function WheelsRef(_a) {
24
- var vehicleSize = _a.vehicleSize, refs = _a.refs, urls = _a.urls;
25
- var wheelUrl = urls.wheelUrl;
26
- var rigidBodyRef = refs.rigidBodyRef;
27
- var wheelSize = useGltfAndSize({
28
- url: urls.wheelUrl,
29
- }).size;
30
- var X = (vehicleSize.x - wheelSize.x) / 2;
31
- var Z = (vehicleSize.z - 2 * wheelSize.z) / 2;
32
- var wheelPositions = [
33
- [-X, 0, Z],
34
- [-X, 0, -Z],
35
- [X, 0, Z],
36
- [X, 0, -Z],
37
- ];
38
- var wheelRefs = useRef(wheelPositions.map(function () { return createRef(); }));
39
- return (_jsxs(_Fragment, { children: [rigidBodyRef &&
40
- wheelUrl &&
41
- wheelRefs &&
42
- wheelPositions.map(function (wheelPosition, index) {
43
- if (!wheelRefs ||
44
- !wheelRefs.current ||
45
- !wheelRefs.current[index] ||
46
- !wheelSize.x ||
47
- !wheelSize.y)
48
- return _jsx(_Fragment, {});
49
- var wheelRef = wheelRefs.current[index];
50
- return (_jsxs(RigidBody, { position: wheelPosition, colliders: false, type: "dynamic", ref: wheelRef, rotation: [0, 0, Math.PI / 2], children: [_jsx(CylinderCollider, { rotation: [0, 0, Math.PI / 2], args: [wheelSize.x / 2, wheelSize.y / 2] }), _jsx(Gltf, { src: wheelUrl })] }, index));
51
- }), rigidBodyRef &&
52
- wheelUrl &&
53
- wheelRefs &&
54
- wheelPositions.map(function (wheelPosition, index) {
55
- if (!wheelRefs ||
56
- !wheelRefs.current ||
57
- !wheelRefs.current[index] ||
58
- !wheelSize.x ||
59
- !wheelSize.y)
60
- return _jsx(_Fragment, {});
61
- var wheelRef = wheelRefs.current[index];
62
- return (_jsx(WheelJoint, { body: rigidBodyRef, wheel: wheelRef, bodyAnchor: wheelPosition, wheelAnchor: [0, 0, 0], rotationAxis: [1, 0, 0] }, index));
63
- })] }));
64
- }
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { CollisionEnterPayload } from "@react-three/rapier";
3
- import { urlsType } from "../../../world/context/type";
4
- export type passiveAirplanePropsType = {
5
- position: THREE.Vector3;
6
- euler: THREE.Euler;
7
- urls: urlsType;
8
- currentAnimation: string;
9
- offset?: THREE.Vector3;
10
- children?: React.ReactNode;
11
- onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
12
- };
13
- export declare function PassiveAirplane(props: passiveAirplanePropsType): import("react/jsx-runtime").JSX.Element;
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useFrame } from "@react-three/fiber";
3
- import { quat, } from "@react-three/rapier";
4
- import { useMemo, useRef } from "react";
5
- import { AirplaneInnerRef } from "../../inner/airplane";
6
- export function PassiveAirplane(props) {
7
- var rigidBodyRef = useRef(null);
8
- var outerGroupRef = useRef(null);
9
- var innerGroupRef = useRef(null);
10
- var colliderRef = useRef(null);
11
- var refs = {
12
- rigidBodyRef: rigidBodyRef,
13
- outerGroupRef: outerGroupRef,
14
- innerGroupRef: innerGroupRef,
15
- colliderRef: colliderRef,
16
- };
17
- var _a = useMemo(function () {
18
- return {
19
- position: props.position,
20
- euler: props.euler,
21
- currentAnimation: props.currentAnimation,
22
- urls: props.urls,
23
- };
24
- }, [props]), position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation, urls = _a.urls;
25
- useFrame(function () {
26
- if (innerGroupRef && innerGroupRef.current) {
27
- var _euler = euler.clone();
28
- _euler.y = 0;
29
- innerGroupRef.current.setRotationFromQuaternion(quat()
30
- .setFromEuler(innerGroupRef.current.rotation.clone())
31
- .slerp(quat().setFromEuler(_euler), 0.2));
32
- }
33
- if (rigidBodyRef && rigidBodyRef.current) {
34
- rigidBodyRef.current.setGravityScale(props.position.y < 10
35
- ? ((1 - 0.1) / (0 - 10)) * props.position.y + 1
36
- : 0.1, false);
37
- }
38
- });
39
- return (_jsx(AirplaneInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: props.currentAnimation, children: props.children }));
40
- }
@@ -1,10 +0,0 @@
1
- /// <reference types="react" />
2
- import { urlsType } from "../../../world/context/type";
3
- export type passiveCharacterPropsType = {
4
- position: THREE.Vector3;
5
- euler: THREE.Euler;
6
- urls: urlsType;
7
- currentAnimation: string;
8
- children?: React.ReactNode;
9
- };
10
- export declare function PassiveCharacter(props: passiveCharacterPropsType): import("react/jsx-runtime").JSX.Element;
@@ -1,46 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useAnimations } from "@react-three/drei";
3
- import { useFrame } from "@react-three/fiber";
4
- import { quat } from "@react-three/rapier";
5
- import { useEffect, useMemo, useRef } from "react";
6
- import playActions from "../../../animation/actions";
7
- import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
8
- import { CharacterInnerRef } from "../../inner/character";
9
- export function PassiveCharacter(props) {
10
- var rigidBodyRef = useRef(null);
11
- var outerGroupRef = useRef(null);
12
- var innerGroupRef = useRef(null);
13
- var colliderRef = useRef(null);
14
- var refs = {
15
- rigidBodyRef: rigidBodyRef,
16
- outerGroupRef: outerGroupRef,
17
- innerGroupRef: innerGroupRef,
18
- colliderRef: colliderRef,
19
- };
20
- var _a = useMemo(function () {
21
- return {
22
- position: props.position,
23
- euler: props.euler,
24
- currentAnimation: props.currentAnimation,
25
- characterUrl: props.urls.characterUrl,
26
- };
27
- }, [props]), position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation;
28
- useEffect(function () {
29
- if (rigidBodyRef || rigidBodyRef.current) {
30
- rigidBodyRef.current.setEnabledRotations(false, false, false, false);
31
- }
32
- }, []);
33
- useFrame(function (_, delta) {
34
- if (innerGroupRef && innerGroupRef.current) {
35
- innerGroupRef.current.quaternion.rotateTowards(quat().setFromEuler(euler), 10 * delta);
36
- }
37
- });
38
- var gltf = useGltfAndSize({ url: props.urls.characterUrl }).gltf;
39
- var animationResult = useAnimations(gltf.animations);
40
- var animationRef = playActions({
41
- type: "character",
42
- animationResult: animationResult,
43
- currentAnimation: currentAnimation,
44
- }).animationRef;
45
- return (_jsx(CharacterInnerRef, { animationRef: animationRef, position: position, refs: refs, urls: props.urls, children: props.children }));
46
- }
@@ -1,20 +0,0 @@
1
- import { gaesupPassivePropsType } from "../../hooks/useGaesupController";
2
- import { activeStateType, modeType, wheelsStateType } from "../../world/context/type";
3
- export type passiveComponentType = {
4
- props: gaesupPassivePropsType;
5
- };
6
- export type passiveCharacterType = {
7
- mode: modeType;
8
- state: activeStateType;
9
- current: string;
10
- url: string;
11
- };
12
- export type passiveVehicleType = {
13
- mode: modeType;
14
- state: activeStateType;
15
- wheelsState?: wheelsStateType;
16
- wheelPositions?: number[][];
17
- current: string;
18
- url: string;
19
- wheelUrl?: string;
20
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,13 +0,0 @@
1
- /// <reference types="react" />
2
- import { CollisionEnterPayload } from "@react-three/rapier";
3
- import { urlsType } from "../../../world/context/type";
4
- export type passiveVehiclePropsType = {
5
- position: THREE.Vector3;
6
- euler: THREE.Euler;
7
- urls: urlsType;
8
- currentAnimation: string;
9
- children?: React.ReactNode;
10
- offset?: THREE.Vector3;
11
- onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
12
- };
13
- export declare function PassiveVehicle(props: passiveVehiclePropsType): import("react/jsx-runtime").JSX.Element;
@@ -1,17 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { useRef } from "react";
3
- import { VehicleInnerRef } from "../../inner/vehicle";
4
- export function PassiveVehicle(props) {
5
- var rigidBodyRef = useRef(null);
6
- var outerGroupRef = useRef(null);
7
- var innerGroupRef = useRef(null);
8
- var colliderRef = useRef(null);
9
- var refs = {
10
- rigidBodyRef: rigidBodyRef,
11
- outerGroupRef: outerGroupRef,
12
- innerGroupRef: innerGroupRef,
13
- colliderRef: colliderRef,
14
- };
15
- var position = props.position, euler = props.euler, currentAnimation = props.currentAnimation, urls = props.urls;
16
- return (_jsx(VehicleInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: currentAnimation, children: props.children }));
17
- }
@@ -1,17 +0,0 @@
1
- import { ObjectMap } from "@react-three/fiber";
2
- import { RapierRigidBody } from "@react-three/rapier";
3
- import { RefObject } from "react";
4
- import { GLTF } from "three-stdlib";
5
- export type GLTFResult = GLTF & {
6
- nodes: {
7
- [name: string]: THREE.Mesh | THREE.SkinnedMesh;
8
- };
9
- materials: {
10
- [name: string]: THREE.Material | THREE.MeshStandardMaterial;
11
- };
12
- } & ObjectMap;
13
- export type passiveRefsType = {
14
- rigidBodyRef: RefObject<RapierRigidBody>;
15
- outerGroupRef: RefObject<THREE.Group>;
16
- innerGroupRef: RefObject<THREE.Group>;
17
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,49 +0,0 @@
1
- /// <reference types="react" />
2
- import { dispatchType } from "../../utils/type";
3
- import { gaesupControllerType } from "./type";
4
- export declare const gaesupControllerDefault: {
5
- airplane: {
6
- angleDelta: import("three").Vector3;
7
- maxAngle: import("three").Vector3;
8
- maxSpeed: number;
9
- accelRatio: number;
10
- brakeRatio: number;
11
- buoyancy: number;
12
- linearDamping: number;
13
- };
14
- vehicle: {
15
- maxSpeed: number;
16
- accelRatio: number;
17
- brakeRatio: number;
18
- wheelOffset: number;
19
- linearDamping: number;
20
- };
21
- character: {
22
- walkSpeed: number;
23
- runSpeed: number;
24
- turnSpeed: number;
25
- jumpSpeed: number;
26
- linearDamping: number;
27
- };
28
- callbacks: {
29
- onReady: () => void;
30
- onFrame: () => void;
31
- onDestory: () => void;
32
- onAnimate: () => void;
33
- };
34
- refs: {
35
- colliderRef: any;
36
- rigidBodyRef: any;
37
- outerGroupRef: any;
38
- innerGroupRef: any;
39
- characterInnerRef: any;
40
- };
41
- urls: {
42
- airplaneUrl: any;
43
- vehicleUrl: any;
44
- characterUrl: any;
45
- wheelUrl: any;
46
- };
47
- };
48
- export declare const GaesupControllerContext: import("react").Context<gaesupControllerType>;
49
- export declare const GaesupControllerDispatchContext: import("react").Context<dispatchType<gaesupControllerType>>;
@@ -1,59 +0,0 @@
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 { createContext } from "react";
13
- import { V3 } from "../../utils/vector";
14
- export var gaesupControllerDefault = {
15
- airplane: {
16
- angleDelta: V3(Math.PI / 256, Math.PI / 256, Math.PI / 256),
17
- maxAngle: V3(Math.PI / 8, Math.PI / 8, Math.PI / 8),
18
- maxSpeed: 60,
19
- accelRatio: 2,
20
- brakeRatio: 5,
21
- buoyancy: 0.2,
22
- linearDamping: 1,
23
- },
24
- vehicle: {
25
- maxSpeed: 60,
26
- accelRatio: 2,
27
- brakeRatio: 5,
28
- wheelOffset: 0.1,
29
- linearDamping: 0.5,
30
- },
31
- character: {
32
- walkSpeed: 10,
33
- runSpeed: 20,
34
- turnSpeed: 10,
35
- jumpSpeed: 1,
36
- linearDamping: 1,
37
- },
38
- callbacks: {
39
- onReady: function () { },
40
- onFrame: function () { },
41
- onDestory: function () { },
42
- onAnimate: function () { },
43
- },
44
- refs: {
45
- colliderRef: null,
46
- rigidBodyRef: null,
47
- outerGroupRef: null,
48
- innerGroupRef: null,
49
- characterInnerRef: null,
50
- },
51
- urls: {
52
- airplaneUrl: null,
53
- vehicleUrl: null,
54
- characterUrl: null,
55
- wheelUrl: null,
56
- },
57
- };
58
- export var GaesupControllerContext = createContext(__assign({}, gaesupControllerDefault));
59
- export var GaesupControllerDispatchContext = createContext(null);
@@ -1,12 +0,0 @@
1
- import { gaesupControllerType } from "./type";
2
- export declare function gaesupControllerReducer(props: gaesupControllerType, action: {
3
- type: string;
4
- payload?: Partial<gaesupControllerType>;
5
- }): {
6
- airplane: import("./type").airplaneType;
7
- vehicle: import("./type").vehicleType;
8
- character: import("./type").characterType;
9
- urls: import("../../world/context/type").urlsType;
10
- callbacks?: import("../initialize/callback/type").callbackType;
11
- refs?: import("../type").refsType;
12
- };
@@ -1,21 +0,0 @@
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
- export function gaesupControllerReducer(props, action) {
13
- switch (action.type) {
14
- case "init": {
15
- return __assign({}, props);
16
- }
17
- case "update": {
18
- return __assign(__assign({}, props), action.payload);
19
- }
20
- }
21
- }
@@ -1,38 +0,0 @@
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>;
@@ -1 +0,0 @@
1
- export {};