gaesup-world 0.0.68 → 0.0.69

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 (153) hide show
  1. package/dist/gaesup/animation/actions.js +8 -8
  2. package/dist/gaesup/camera/cameraCollisionDetecter.d.ts +2 -2
  3. package/dist/gaesup/camera/index.d.ts +2 -2
  4. package/dist/gaesup/component/Airplane.d.ts +3 -3
  5. package/dist/gaesup/component/Airplane.js +3 -3
  6. package/dist/gaesup/component/Character.d.ts +3 -3
  7. package/dist/gaesup/component/Character.js +3 -3
  8. package/dist/gaesup/component/Vehicle.d.ts +3 -3
  9. package/dist/gaesup/component/Vehicle.js +3 -3
  10. package/dist/gaesup/component/gltf/CharacterGltf.d.ts +2 -5
  11. package/dist/gaesup/component/gltf/CharacterGltf.js +5 -7
  12. package/dist/gaesup/component/gltf/WheelJoint.d.ts +3 -3
  13. package/dist/gaesup/component/gltf/WheelJoint.js +4 -3
  14. package/dist/gaesup/component/ref/airplane.d.ts +4 -4
  15. package/dist/gaesup/component/ref/airplane.js +7 -7
  16. package/dist/gaesup/component/ref/character.d.ts +4 -4
  17. package/dist/gaesup/component/ref/character.js +9 -9
  18. package/dist/gaesup/component/ref/vehicle.d.ts +3 -3
  19. package/dist/gaesup/component/ref/vehicle.js +7 -7
  20. package/dist/gaesup/controller/context/index.d.ts +36 -9
  21. package/dist/gaesup/controller/context/index.js +36 -8
  22. package/dist/gaesup/controller/context/reducer.d.ts +10 -8
  23. package/dist/gaesup/controller/context/type.d.ts +51 -32
  24. package/dist/gaesup/controller/debug/airplane.d.ts +71 -0
  25. package/dist/gaesup/controller/debug/airplane.js +71 -0
  26. package/dist/gaesup/controller/debug/cameraOption.d.ts +27 -0
  27. package/dist/gaesup/controller/debug/cameraOption.js +27 -0
  28. package/dist/gaesup/controller/debug/character.d.ts +27 -0
  29. package/dist/gaesup/controller/debug/character.js +27 -0
  30. package/dist/gaesup/controller/debug/index.d.ts +6 -0
  31. package/dist/gaesup/controller/debug/index.js +100 -0
  32. package/dist/gaesup/controller/debug/orthographicCamera.d.ts +17 -0
  33. package/dist/gaesup/controller/debug/orthographicCamera.js +17 -0
  34. package/dist/gaesup/controller/debug/perspectiveCamera.d.ts +12 -0
  35. package/dist/gaesup/controller/debug/perspectiveCamera.js +12 -0
  36. package/dist/gaesup/controller/debug/vehicle.d.ts +27 -0
  37. package/dist/gaesup/controller/debug/vehicle.js +27 -0
  38. package/dist/gaesup/controller/index.js +34 -17
  39. package/dist/gaesup/controller/initialize/index.d.ts +27 -0
  40. package/dist/gaesup/{initial/controller → controller/initialize}/index.js +8 -42
  41. package/dist/gaesup/controller/type.d.ts +17 -51
  42. package/dist/gaesup/gaesupProps/index.js +4 -6
  43. package/dist/gaesup/index.d.ts +0 -1
  44. package/dist/gaesup/index.js +0 -1
  45. package/dist/gaesup/initial/callback/index.d.ts +1 -1
  46. package/dist/gaesup/initial/callback/index.js +28 -21
  47. package/dist/gaesup/initial/callback/type.d.ts +3 -7
  48. package/dist/gaesup/initial/index.d.ts +0 -2
  49. package/dist/gaesup/initial/index.js +0 -2
  50. package/dist/gaesup/physics/airplane/damping.js +3 -2
  51. package/dist/gaesup/physics/airplane/direction.js +2 -2
  52. package/dist/gaesup/physics/airplane/gravity.js +3 -2
  53. package/dist/gaesup/physics/character/accelaration.js +1 -1
  54. package/dist/gaesup/physics/character/damping.js +2 -2
  55. package/dist/gaesup/physics/character/jump.js +1 -2
  56. package/dist/gaesup/physics/character/turn.js +1 -2
  57. package/dist/gaesup/physics/index.d.ts +2 -2
  58. package/dist/gaesup/physics/type.d.ts +8 -7
  59. package/dist/gaesup/physics/vehicle/damping.js +3 -3
  60. package/dist/gaesup/physics/vehicle/impulse.js +4 -6
  61. package/dist/gaesup/tools/gameboy/GameBoyButton.d.ts +3 -1
  62. package/dist/gaesup/tools/gameboy/GameBoyButton.js +3 -5
  63. package/dist/gaesup/tools/gameboy/index.d.ts +2 -1
  64. package/dist/gaesup/tools/gameboy/index.js +8 -6
  65. package/dist/gaesup/tools/gameboy/style.css.d.ts +0 -1
  66. package/dist/gaesup/tools/gameboy/style.css.js +3 -15
  67. package/dist/gaesup/tools/gameboy/type.d.ts +2 -5
  68. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +3 -1
  69. package/dist/gaesup/tools/gamepad/GamePadButton.js +4 -5
  70. package/dist/gaesup/tools/gamepad/index.d.ts +2 -1
  71. package/dist/gaesup/tools/gamepad/index.js +9 -9
  72. package/dist/gaesup/tools/gamepad/style.css.js +1 -1
  73. package/dist/gaesup/tools/gamepad/type.d.ts +4 -6
  74. package/dist/gaesup/tools/joystick/default.d.ts +0 -4
  75. package/dist/gaesup/tools/joystick/default.js +0 -4
  76. package/dist/gaesup/tools/joystick/index.d.ts +2 -2
  77. package/dist/gaesup/tools/joystick/index.js +48 -29
  78. package/dist/gaesup/tools/joystick/style.css.d.ts +0 -1
  79. package/dist/gaesup/tools/joystick/style.css.js +0 -15
  80. package/dist/gaesup/tools/joystick/type.d.ts +2 -7
  81. package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -1
  82. package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -1
  83. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +2 -1
  84. package/dist/gaesup/tools/keyBoardToolTip/index.js +18 -14
  85. package/dist/gaesup/tools/keyBoardToolTip/style.css.d.ts +0 -1
  86. package/dist/gaesup/tools/keyBoardToolTip/style.css.js +1 -21
  87. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +8 -5
  88. package/dist/gaesup/tools/minimap/default.d.ts +4 -3
  89. package/dist/gaesup/tools/minimap/default.js +4 -3
  90. package/dist/gaesup/tools/minimap/index.d.ts +2 -1
  91. package/dist/gaesup/tools/minimap/index.js +49 -41
  92. package/dist/gaesup/tools/minimap/style.css.d.ts +32 -0
  93. package/dist/gaesup/tools/minimap/style.css.js +99 -19
  94. package/dist/gaesup/tools/minimap/type.d.ts +7 -11
  95. package/dist/gaesup/tools/type.d.ts +2 -26
  96. package/dist/gaesup/utils/context.d.ts +2 -0
  97. package/dist/gaesup/utils/context.js +3 -0
  98. package/dist/gaesup/utils/debug.d.ts +29 -0
  99. package/dist/gaesup/utils/debug.js +36 -0
  100. package/dist/gaesup/utils/type.d.ts +5 -0
  101. package/dist/gaesup/utils/vector.d.ts +1 -0
  102. package/dist/gaesup/utils/vector.js +3 -0
  103. package/dist/gaesup/world/context/index.d.ts +5 -4
  104. package/dist/gaesup/world/context/index.js +0 -2
  105. package/dist/gaesup/world/context/reducer.d.ts +4 -4
  106. package/dist/gaesup/world/context/reducer.js +0 -3
  107. package/dist/gaesup/world/context/type.d.ts +4 -12
  108. package/dist/gaesup/world/debug/index.d.ts +2 -0
  109. package/dist/gaesup/world/debug/index.js +27 -0
  110. package/dist/gaesup/world/debug/mode.d.ts +10 -0
  111. package/dist/gaesup/world/debug/mode.js +10 -0
  112. package/dist/gaesup/world/index.d.ts +2 -2
  113. package/dist/gaesup/world/index.js +1 -1
  114. package/dist/gaesup/world/initalize/collider/airplane.js +24 -0
  115. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/character.js +10 -13
  116. package/dist/gaesup/world/initalize/collider/index.d.ts +2 -0
  117. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/index.js +2 -1
  118. package/dist/gaesup/world/initalize/collider/vehicle.js +34 -0
  119. package/dist/gaesup/world/initalize/index.d.ts +33 -0
  120. package/dist/gaesup/{initial/gaesupWorld → world/initalize}/index.js +6 -4
  121. package/dist/gaesup/world/initalize/type.d.ts +13 -0
  122. package/dist/gaesup/world/initalize/type.js +1 -0
  123. package/dist/gaesup/world/type.d.ts +17 -7
  124. package/dist/index.d.ts +1 -1
  125. package/dist/index.js +1 -1
  126. package/dist/styles/sprinkles/color.css.d.ts +21 -21
  127. package/dist/styles/sprinkles/margin.css.d.ts +30 -30
  128. package/dist/styles/sprinkles/padding.css.d.ts +30 -30
  129. package/package.json +5 -2
  130. package/dist/gaesup/initial/controller/index.d.ts +0 -29
  131. package/dist/gaesup/initial/controller/initDebug.d.ts +0 -24
  132. package/dist/gaesup/initial/controller/initDebug.js +0 -110
  133. package/dist/gaesup/initial/gaesupWorld/collider/airplane.js +0 -25
  134. package/dist/gaesup/initial/gaesupWorld/collider/index.d.ts +0 -6
  135. package/dist/gaesup/initial/gaesupWorld/collider/vehicle.js +0 -40
  136. package/dist/gaesup/initial/gaesupWorld/index.d.ts +0 -33
  137. package/dist/gaesup/initial/gaesupWorld/type.d.ts +0 -28
  138. package/dist/gaesup/tools/context.d.ts +0 -4
  139. package/dist/gaesup/tools/context.js +0 -3
  140. package/dist/gaesup/tools/gameboy/default.d.ts +0 -3
  141. package/dist/gaesup/tools/gameboy/default.js +0 -3
  142. package/dist/gaesup/tools/index.d.ts +0 -2
  143. package/dist/gaesup/tools/index.js +0 -42
  144. package/dist/gaesup/tools/reducer.d.ts +0 -11
  145. package/dist/gaesup/tools/reducer.js +0 -24
  146. package/dist/gaesup/tools/style.css.d.ts +0 -3
  147. package/dist/gaesup/tools/style.css.js +0 -31
  148. /package/dist/gaesup/{initial/gaesupWorld → utils}/type.js +0 -0
  149. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/airplane.d.ts +0 -0
  150. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/character.d.ts +0 -0
  151. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/gltf.d.ts +0 -0
  152. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/gltf.js +0 -0
  153. /package/dist/gaesup/{initial/gaesupWorld → world/initalize}/collider/vehicle.d.ts +0 -0
@@ -29,7 +29,7 @@ export default function playActions(_a) {
29
29
  },
30
30
  });
31
31
  }, [control]);
32
- var playAnimation = function (tag) {
32
+ var play = function (tag) {
33
33
  characterAnimations.current = tag;
34
34
  dispatch({
35
35
  type: "update",
@@ -50,13 +50,13 @@ export default function playActions(_a) {
50
50
  },
51
51
  });
52
52
  };
53
- var resetAni = function () { return playAnimation("idle"); };
54
- var playIdle = function () { return playAnimation("idle"); };
55
- var playWalk = function () { return playAnimation("walk"); };
56
- var playRun = function () { return playAnimation("run"); };
57
- var playJump = function () { return playAnimation("jump"); };
58
- var playFall = function () { return playAnimation("fall"); };
59
- var playRide = function () { return playAnimation("ride"); };
53
+ var resetAni = function () { return play("idle"); };
54
+ var playIdle = function () { return play("idle"); };
55
+ var playWalk = function () { return play("walk"); };
56
+ var playRun = function () { return play("run"); };
57
+ var playJump = function () { return play("jump"); };
58
+ var playFall = function () { return play("fall"); };
59
+ var playRide = function () { return play("ride"); };
60
60
  useEffect(function () {
61
61
  return function () {
62
62
  resetAni();
@@ -1,4 +1,4 @@
1
- import { propType } from "../controller/type";
2
- export default function cameraCollisionDetector(prop: propType): {
1
+ import { controllerInnerType } from "../controller/type";
2
+ export default function cameraCollisionDetector(prop: controllerInnerType): {
3
3
  checkCollision: (delta: number) => void;
4
4
  };
@@ -1,7 +1,7 @@
1
- import { propType, refsType } from "../controller/type";
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
2
  export default function Camera({ refs, prop, control, }: {
3
3
  refs: refsType;
4
- prop: propType;
4
+ prop: controllerInnerType;
5
5
  control: {
6
6
  [key: string]: boolean;
7
7
  };
@@ -1,5 +1,5 @@
1
- import { propType, refsType } from "../controller/type";
2
- export declare function Airplane({ controllerProps, refs, }: {
3
- controllerProps: propType;
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ export declare function Airplane({ props, refs, }: {
3
+ props: controllerInnerType;
4
4
  refs: refsType;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -6,9 +6,9 @@ import { CharacterInnerGroupRef } from "./gltf/CharacterGltf";
6
6
  import { AirplaneCollider, AirplaneGroup, AirplaneRigidBody, } from "./ref/airplane";
7
7
  import setInit from "./setInit";
8
8
  export function Airplane(_a) {
9
- var controllerProps = _a.controllerProps, refs = _a.refs;
9
+ var props = _a.props, refs = _a.refs;
10
10
  var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, capsuleColliderRef = refs.capsuleColliderRef, innerGroupRef = refs.innerGroupRef, characterInnerRef = refs.characterInnerRef;
11
- calculation(controllerProps);
11
+ calculation(props);
12
12
  setInit(rigidBodyRef);
13
- return (_jsx(_Fragment, { children: _jsx(AirplaneGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: _jsxs(AirplaneRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(AirplaneCollider, { prop: controllerProps, ref: capsuleColliderRef }), controllerProps.isRider && (_jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, isRider: controllerProps.isRider, ref: characterInnerRef })), _jsx(AirplaneInnerGroupRef, { ref: innerGroupRef })] }) }) }));
13
+ return (_jsx(_Fragment, { children: _jsx(AirplaneGroup, { ref: outerGroupRef, props: props, children: _jsxs(AirplaneRigidBody, { ref: rigidBodyRef, props: props, children: [_jsx(AirplaneCollider, { prop: props, ref: capsuleColliderRef }), props.isRider && (_jsx(CharacterInnerGroupRef, { props: props, groundRay: props.groundRay, refs: refs, ref: characterInnerRef })), _jsx(AirplaneInnerGroupRef, { ref: innerGroupRef })] }) }) }));
14
14
  }
@@ -1,5 +1,5 @@
1
- import { propType, refsType } from "../controller/type";
2
- export declare function Character({ controllerProps, refs, }: {
3
- controllerProps: propType;
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ export declare function Character({ props, refs, }: {
3
+ props: controllerInnerType;
4
4
  refs: refsType;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -5,9 +5,9 @@ import { CharacterInnerGroupRef, InnerGroupRef } from "./gltf/CharacterGltf";
5
5
  import { CharacterCapsuleCollider, CharacterGroup, CharacterRigidBody, CharacterSlopeRay, } from "./ref/character";
6
6
  import setInit from "./setInit";
7
7
  export function Character(_a) {
8
- var controllerProps = _a.controllerProps, refs = _a.refs;
8
+ var props = _a.props, refs = _a.refs;
9
9
  var capsuleColliderRef = refs.capsuleColliderRef, rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, slopeRayOriginRef = refs.slopeRayOriginRef, characterInnerRef = refs.characterInnerRef, innerGroupRef = refs.innerGroupRef;
10
- calculation(controllerProps);
10
+ calculation(props);
11
11
  setInit(rigidBodyRef);
12
- return (_jsxs(CharacterRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(CharacterCapsuleCollider, { prop: controllerProps, ref: capsuleColliderRef }), _jsxs(CharacterGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: [_jsx(CharacterSlopeRay, { slopeRay: controllerProps.slopeRay, groundRay: controllerProps.groundRay, ref: slopeRayOriginRef }), controllerProps.children, _jsx(InnerGroupRef, { ref: innerGroupRef }), _jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, ref: characterInnerRef, isRider: false })] })] }));
12
+ return (_jsxs(CharacterRigidBody, { ref: rigidBodyRef, props: props, children: [_jsx(CharacterCapsuleCollider, { props: props, ref: capsuleColliderRef }), _jsxs(CharacterGroup, { ref: outerGroupRef, props: props, children: [_jsx(CharacterSlopeRay, { slopeRay: props.slopeRay, groundRay: props.groundRay, ref: slopeRayOriginRef }), props.children, _jsx(InnerGroupRef, { ref: innerGroupRef }), _jsx(CharacterInnerGroupRef, { props: props, groundRay: props.groundRay, refs: refs, ref: characterInnerRef })] })] }));
13
13
  }
@@ -1,5 +1,5 @@
1
- import { propType, refsType } from "../controller/type";
2
- export declare function Vehicle({ controllerProps, refs, }: {
3
- controllerProps: propType;
1
+ import { controllerInnerType, refsType } from "../controller/type";
2
+ export declare function Vehicle({ props, refs, }: {
3
+ props: controllerInnerType;
4
4
  refs: refsType;
5
5
  }): import("react/jsx-runtime").JSX.Element;
@@ -7,9 +7,9 @@ import { Wheels } from "./gltf/WheelJoint";
7
7
  import { VehicleCollider, VehicleGroup, VehicleRigidBody } from "./ref/vehicle";
8
8
  import setInit from "./setInit";
9
9
  export function Vehicle(_a) {
10
- var controllerProps = _a.controllerProps, refs = _a.refs;
10
+ var props = _a.props, refs = _a.refs;
11
11
  var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef, characterInnerRef = refs.characterInnerRef, innerGroupRef = refs.innerGroupRef;
12
- calculation(controllerProps);
12
+ calculation(props);
13
13
  setInit(rigidBodyRef);
14
- return (_jsxs(VehicleGroup, { ref: outerGroupRef, controllerProps: controllerProps, children: [_jsxs(VehicleRigidBody, { ref: rigidBodyRef, controllerProps: controllerProps, children: [_jsx(VehicleCollider, {}), controllerProps.isRider && (_jsx(CharacterInnerGroupRef, { prop: controllerProps, groupProps: controllerProps.groupProps, groundRay: controllerProps.groundRay, refs: refs, callbacks: controllerProps.callbacks, ref: characterInnerRef, isRider: true })), _jsx(VehicleInnerGroupRef, { ref: innerGroupRef })] }), _jsx(Wheels, { prop: controllerProps })] }));
14
+ return (_jsxs(VehicleGroup, { ref: outerGroupRef, props: props, children: [_jsxs(VehicleRigidBody, { ref: rigidBodyRef, props: props, children: [_jsx(VehicleCollider, {}), props.isRider && (_jsx(CharacterInnerGroupRef, { props: props, groundRay: props.groundRay, refs: refs, ref: characterInnerRef })), _jsx(VehicleInnerGroupRef, { ref: innerGroupRef })] }), _jsx(Wheels, { props: props })] }));
15
15
  }
@@ -1,14 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { GroupProps } from "@react-three/fiber";
3
- import { groundRayType, propType, refsType } from "../../controller/type";
2
+ import { controllerInnerType, groundRayType, refsType } from "../../controller/type";
4
3
  import { callbackType } from "../../initial/callback/type";
5
4
  export type characterGltfType = {
6
- prop: propType;
7
- groupProps?: GroupProps;
5
+ props: controllerInnerType;
8
6
  groundRay: groundRayType;
9
7
  refs: refsType;
10
8
  callbacks?: callbackType;
11
- isRider?: boolean;
12
9
  };
13
10
  export declare const InnerGroupRef: import("react").ForwardRefExoticComponent<import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
14
11
  export declare const CharacterInnerGroupRef: import("react").ForwardRefExoticComponent<characterGltfType & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
@@ -18,23 +18,21 @@ export var InnerGroupRef = forwardRef(function (_, ref) {
18
18
  return _jsx("group", { ref: ref, visible: false });
19
19
  });
20
20
  export var CharacterInnerGroupRef = forwardRef(function (_a, ref) {
21
- var prop = _a.prop, groupProps = _a.groupProps, groundRay = _a.groundRay, refs = _a.refs, callbacks = _a.callbacks, isRider = _a.isRider;
21
+ var props = _a.props, groundRay = _a.groundRay, refs = _a.refs;
22
22
  var gltf = useContext(GaesupWorldContext).characterGltf;
23
23
  var materials = gltf.materials, nodes = gltf.nodes;
24
24
  var _b = useContext(GaesupWorldContext), characterCollider = _b.characterCollider, vehicleCollider = _b.vehicleCollider;
25
25
  initCallback({
26
- prop: prop,
27
- callbacks: callbacks,
28
- outerGroupRef: refs.outerGroupRef,
26
+ props: props,
29
27
  });
30
28
  playActions({
31
29
  outerGroupRef: refs.outerGroupRef,
32
30
  groundRay: groundRay,
33
- isRider: isRider,
31
+ isRider: props.isRider,
34
32
  });
35
- return (_jsx(_Fragment, { children: nodes && materials && (_jsxs("group", __assign({ receiveShadow: true, castShadow: true }, groupProps, { position: [
33
+ return (_jsx(_Fragment, { children: nodes && materials && (_jsxs("group", __assign({ receiveShadow: true, castShadow: true }, props.groupProps, { position: [
36
34
  0,
37
- isRider
35
+ props.isRider
38
36
  ? vehicleCollider.vehicleSizeY / 2
39
37
  : -characterCollider.height,
40
38
  0,
@@ -1,4 +1,4 @@
1
- import { propType } from "../../controller/type";
2
- export declare function Wheels({ prop }: {
3
- prop: propType;
1
+ import { controllerInnerType } from "../../controller/type";
2
+ export declare function Wheels({ props }: {
3
+ props: controllerInnerType;
4
4
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { createRef, useContext, useRef } from "react";
3
+ import { GaesupControllerContext } from "../../controller/context";
3
4
  import { GaesupWorldContext } from "../../world/context";
4
5
  import { WheelRegidBodyRef } from "../ref/vehicle";
5
6
  export function Wheels(_a) {
6
- var prop = _a.prop;
7
- var rigidBodyRef = prop.rigidBodyRef, constant = prop.constant;
8
- var wheelOffset = constant.wheelOffset;
7
+ var props = _a.props;
8
+ var rigidBodyRef = props.rigidBodyRef;
9
+ var wheelOffset = useContext(GaesupControllerContext).vehicle.wheelOffset;
9
10
  var collider = useContext(GaesupWorldContext).vehicleCollider;
10
11
  var vehicleSizeX = collider.vehicleSizeX, vehicleSizeZ = collider.vehicleSizeZ, wheelSizeX = collider.wheelSizeX, wheelSizeZ = collider.wheelSizeZ;
11
12
  var X = (vehicleSizeX + wheelSizeX) / 2 + wheelOffset;
@@ -2,15 +2,15 @@ import { Collider } from "@dimforge/rapier3d-compat";
2
2
  import { RapierRigidBody } from "@react-three/rapier";
3
3
  import { ReactNode } from "react";
4
4
  import * as THREE from "three";
5
- import { controllerType, propType } from "../../controller/type";
5
+ import { controllerInnerType, controllerType } from "../../controller/type";
6
6
  export declare const AirplaneRigidBody: import("react").ForwardRefExoticComponent<{
7
- controllerProps: propType;
7
+ props: controllerInnerType;
8
8
  children: ReactNode;
9
9
  } & import("react").RefAttributes<RapierRigidBody>>;
10
10
  export declare const AirplaneCollider: import("react").ForwardRefExoticComponent<{
11
- prop: propType;
11
+ prop: controllerInnerType;
12
12
  } & import("react").RefAttributes<Collider>>;
13
13
  export declare const AirplaneGroup: import("react").ForwardRefExoticComponent<{
14
- controllerProps: controllerType;
14
+ props: controllerType;
15
15
  children: ReactNode;
16
16
  } & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
@@ -16,11 +16,11 @@ import { getRayHit } from "../../utils/ray";
16
16
  import { useForwardRef } from "../../utils/ref";
17
17
  import { GaesupWorldContext } from "../../world/context";
18
18
  export var AirplaneRigidBody = forwardRef(function (_a, ref) {
19
- var controllerProps = _a.controllerProps, children = _a.children;
20
- return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
21
- controllerProps.groundRay.dir,
22
- controllerProps.groundRay.origin,
23
- controllerProps.groundRay.length,
19
+ var props = _a.props, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, props.rigidBodyProps, { children: [props.debug && (_jsx("mesh", { visible: props.debug, children: _jsx("arrowHelper", { args: [
21
+ props.groundRay.dir,
22
+ props.groundRay.origin,
23
+ props.groundRay.length,
24
24
  ] }) })), children] })));
25
25
  });
26
26
  export var AirplaneCollider = forwardRef(function (_a, ref) {
@@ -41,6 +41,6 @@ export var AirplaneCollider = forwardRef(function (_a, ref) {
41
41
  return (_jsx(CuboidCollider, { ref: ref, args: [airplaneSizeX / 2, airplaneSizeY / 2, airplaneSizeZ / 2], position: [0, airplaneSizeY / 2, 0] }));
42
42
  });
43
43
  export var AirplaneGroup = forwardRef(function (_a, ref) {
44
- var controllerProps = _a.controllerProps, children = _a.children;
45
- return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.airplane, { children: children })));
44
+ var props = _a.props, children = _a.children;
45
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.airplane, { children: children })));
46
46
  });
@@ -2,16 +2,16 @@ import { Collider } from "@dimforge/rapier3d-compat";
2
2
  import { RapierRigidBody } from "@react-three/rapier";
3
3
  import { ReactNode } from "react";
4
4
  import * as THREE from "three";
5
- import { controllerType, groundRayType, propType, slopeRayType } from "../../controller/type";
5
+ import { controllerInnerType, controllerType, groundRayType, slopeRayType } from "../../controller/type";
6
6
  export declare const CharacterRigidBody: import("react").ForwardRefExoticComponent<{
7
- controllerProps: propType;
7
+ props: controllerInnerType;
8
8
  children: ReactNode;
9
9
  } & import("react").RefAttributes<RapierRigidBody>>;
10
10
  export declare const CharacterCapsuleCollider: import("react").ForwardRefExoticComponent<{
11
- prop: propType;
11
+ props: controllerInnerType;
12
12
  } & import("react").RefAttributes<Collider>>;
13
13
  export declare const CharacterGroup: import("react").ForwardRefExoticComponent<{
14
- controllerProps: controllerType;
14
+ props: controllerType;
15
15
  children: ReactNode;
16
16
  } & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
17
17
  export declare const CharacterSlopeRay: import("react").ForwardRefExoticComponent<{
@@ -16,20 +16,20 @@ import { getRayHit } from "../../utils/ray";
16
16
  import { useForwardRef } from "../../utils/ref";
17
17
  import { GaesupWorldContext } from "../../world/context";
18
18
  export var CharacterRigidBody = forwardRef(function (_a, ref) {
19
- var controllerProps = _a.controllerProps, children = _a.children;
20
- return (_jsxs(RigidBody, __assign({ colliders: false, canSleep: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
21
- controllerProps.groundRay.dir,
22
- controllerProps.groundRay.origin,
23
- controllerProps.groundRay.length,
19
+ var props = _a.props, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, canSleep: false, ref: ref }, props.rigidBodyProps, { children: [props.debug && (_jsx("mesh", { visible: props.debug, children: _jsx("arrowHelper", { args: [
21
+ props.groundRay.dir,
22
+ props.groundRay.origin,
23
+ props.groundRay.length,
24
24
  ] }) })), children] })));
25
25
  });
26
26
  export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
27
27
  var _b;
28
- var prop = _a.prop;
28
+ var props = _a.props;
29
29
  var collider = useContext(GaesupWorldContext).characterCollider;
30
30
  var colliderRef = useForwardRef(ref);
31
31
  var rapier = useRapier().rapier;
32
- var groundRay = prop.groundRay, slopeRay = prop.slopeRay;
32
+ var groundRay = props.groundRay, slopeRay = props.slopeRay;
33
33
  groundRay.length = collider.radius + 2;
34
34
  groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
35
35
  groundRay.hit = getRayHit({
@@ -43,8 +43,8 @@ export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
43
43
  return (_jsx(CapsuleCollider, { ref: ref, args: [collider.height, collider.radius] }));
44
44
  });
45
45
  export var CharacterGroup = forwardRef(function (_a, ref) {
46
- var controllerProps = _a.controllerProps, children = _a.children;
47
- return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.character, { children: children })));
46
+ var props = _a.props, children = _a.children;
47
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.character, { children: children })));
48
48
  });
49
49
  export var CharacterSlopeRay = forwardRef(function (_a, ref) {
50
50
  var groundRay = _a.groundRay, slopeRay = _a.slopeRay;
@@ -2,14 +2,14 @@ import { Collider } from "@dimforge/rapier3d-compat";
2
2
  import { RapierRigidBody } from "@react-three/rapier";
3
3
  import { ReactNode, RefObject } from "react";
4
4
  import * as THREE from "three";
5
- import { controllerType, propType } from "../../controller/type";
5
+ import { controllerInnerType, controllerType } from "../../controller/type";
6
6
  export declare const VehicleRigidBody: import("react").ForwardRefExoticComponent<{
7
- controllerProps: propType;
7
+ props: controllerInnerType;
8
8
  children: ReactNode;
9
9
  } & import("react").RefAttributes<RapierRigidBody>>;
10
10
  export declare const VehicleCollider: import("react").ForwardRefExoticComponent<import("react").RefAttributes<Collider>>;
11
11
  export declare const VehicleGroup: import("react").ForwardRefExoticComponent<{
12
- controllerProps: controllerType;
12
+ props: controllerType;
13
13
  children: ReactNode;
14
14
  } & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
15
15
  export type wheelRegidBodyType = {
@@ -16,11 +16,11 @@ import { forwardRef, useContext } from "react";
16
16
  import { S3 } from "../../utils/constant";
17
17
  import { GaesupWorldContext } from "../../world/context";
18
18
  export var VehicleRigidBody = forwardRef(function (_a, ref) {
19
- var controllerProps = _a.controllerProps, children = _a.children;
20
- return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, controllerProps.rigidBodyProps, { children: [controllerProps.debug && (_jsx("mesh", { visible: controllerProps.debug, children: _jsx("arrowHelper", { args: [
21
- controllerProps.groundRay.dir,
22
- controllerProps.groundRay.origin,
23
- controllerProps.groundRay.length,
19
+ var props = _a.props, children = _a.children;
20
+ return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, props.rigidBodyProps, { children: [props.debug && (_jsx("mesh", { visible: props.debug, children: _jsx("arrowHelper", { args: [
21
+ props.groundRay.dir,
22
+ props.groundRay.origin,
23
+ props.groundRay.length,
24
24
  ] }) })), children] })));
25
25
  });
26
26
  export var VehicleCollider = forwardRef(function (_, ref) {
@@ -29,8 +29,8 @@ export var VehicleCollider = forwardRef(function (_, ref) {
29
29
  return (_jsx(CuboidCollider, { ref: ref, args: [vehicleSizeX / 2, vehicleSizeY / 2, vehicleSizeZ / 2], position: [0, vehicleSizeY / 2, 0] }));
30
30
  });
31
31
  export var VehicleGroup = forwardRef(function (_a, ref) {
32
- var controllerProps = _a.controllerProps, children = _a.children;
33
- return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, controllerProps.vehicle, { children: children })));
32
+ var props = _a.props, children = _a.children;
33
+ return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.vehicle, { children: children })));
34
34
  });
35
35
  export var WheelRegidBodyRef = forwardRef(function (_a, ref) {
36
36
  var wheelPosition = _a.wheelPosition, wheelsUrl = _a.wheelsUrl, bodyRef = _a.bodyRef, wheel = _a.wheel, bodyAnchor = _a.bodyAnchor, wheelAnchor = _a.wheelAnchor, rotationAxis = _a.rotationAxis;
@@ -1,10 +1,17 @@
1
1
  /// <reference types="react" />
2
- import { dispatchType } from "../../tools/type.js";
3
- import { gaesupControllerType, orthographicCameraType, perspectiveCameraType } from "./type.js";
2
+ import { dispatchType } from "../../utils/type";
3
+ import { gaesupControllerType, orthographicCameraType, perspectiveCameraType } from "./type";
4
4
  export declare const gaesupControllerDefault: {
5
5
  cameraMode: perspectiveCameraType | orthographicCameraType;
6
6
  cameraOption: {
7
7
  offset: import("three").Vector3;
8
+ initDistance: number;
9
+ maxDistance: number;
10
+ minDistance: number;
11
+ initDir: number;
12
+ collisionOff: number;
13
+ distance: number;
14
+ camFollow: number;
8
15
  };
9
16
  perspectiveCamera: {
10
17
  isFront: boolean;
@@ -17,22 +24,42 @@ export declare const gaesupControllerDefault: {
17
24
  far: number;
18
25
  };
19
26
  airplane: {
20
- angleChange: import("three").Vector3;
27
+ angleDelta: import("three").Vector3;
21
28
  maxAngle: import("three").Vector3;
22
29
  maxSpeed: number;
23
30
  accelRatio: number;
31
+ brakeRatio: number;
32
+ buoyancy: number;
33
+ linearDamping: number;
24
34
  };
25
35
  vehicle: {
26
- angleChange: import("three").Vector3;
27
- maxAngle: import("three").Vector3;
28
36
  maxSpeed: number;
29
37
  accelRatio: number;
38
+ brakeRatio: number;
39
+ wheelOffset: number;
40
+ linearDamping: number;
30
41
  };
31
42
  character: {
32
- angleChange: import("three").Vector3;
33
- maxAngle: import("three").Vector3;
34
- maxSpeed: number;
35
- accelRatio: number;
43
+ walkSpeed: number;
44
+ runSpeed: number;
45
+ turnSpeed: number;
46
+ jumpSpeed: number;
47
+ linearDamping: number;
48
+ };
49
+ callbacks: {
50
+ onReady: () => void;
51
+ onFrame: () => void;
52
+ onDestory: () => void;
53
+ onAnimate: () => void;
54
+ };
55
+ refs: {
56
+ capsuleColliderRef: any;
57
+ rigidBodyRef: any;
58
+ outerGroupRef: any;
59
+ innerGroupRef: any;
60
+ slopeRayOriginRef: any;
61
+ characterInnerRef: any;
62
+ jointRefs: any;
36
63
  };
37
64
  isRider: boolean;
38
65
  };
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { createContext } from "react";
13
- import { V3 } from "../../utils/vector.js";
13
+ import { V3 } from "../../utils/vector";
14
14
  export var gaesupControllerDefault = {
15
15
  cameraMode: {
16
16
  cameraType: "perspective",
@@ -18,6 +18,13 @@ export var gaesupControllerDefault = {
18
18
  },
19
19
  cameraOption: {
20
20
  offset: V3(-10, -10, -10),
21
+ initDistance: -5,
22
+ maxDistance: -7,
23
+ minDistance: -0.7,
24
+ initDir: 0,
25
+ collisionOff: 0.7,
26
+ distance: -1,
27
+ camFollow: 11,
21
28
  },
22
29
  perspectiveCamera: {
23
30
  isFront: true,
@@ -30,22 +37,43 @@ export var gaesupControllerDefault = {
30
37
  far: 1000,
31
38
  },
32
39
  airplane: {
33
- angleChange: V3(0.01, 0.005, 0.005),
40
+ angleDelta: V3(0.01, 0.005, 0.005),
34
41
  maxAngle: V3(0.1, 0.1, 0.1),
35
42
  maxSpeed: 60,
36
43
  accelRatio: 2,
44
+ brakeRatio: 5,
45
+ buoyancy: 0.5,
46
+ linearDamping: 1,
37
47
  },
38
48
  vehicle: {
39
- angleChange: V3(0.01, 0.005, 0.005),
40
- maxAngle: V3(0.1, 0.1, 0.1),
41
49
  maxSpeed: 60,
42
50
  accelRatio: 2,
51
+ brakeRatio: 5,
52
+ wheelOffset: 0.1,
53
+ linearDamping: 0.5,
43
54
  },
44
55
  character: {
45
- angleChange: V3(0.01, 0.005, 0.005),
46
- maxAngle: V3(0.1, 0.1, 0.1),
47
- maxSpeed: 60,
48
- accelRatio: 2,
56
+ // constant
57
+ walkSpeed: 4,
58
+ runSpeed: 10,
59
+ turnSpeed: 10,
60
+ jumpSpeed: 5,
61
+ linearDamping: 1,
62
+ },
63
+ callbacks: {
64
+ onReady: function () { },
65
+ onFrame: function () { },
66
+ onDestory: function () { },
67
+ onAnimate: function () { },
68
+ },
69
+ refs: {
70
+ capsuleColliderRef: null,
71
+ rigidBodyRef: null,
72
+ outerGroupRef: null,
73
+ innerGroupRef: null,
74
+ slopeRayOriginRef: null,
75
+ characterInnerRef: null,
76
+ jointRefs: null,
49
77
  },
50
78
  isRider: false,
51
79
  };
@@ -1,14 +1,16 @@
1
- import { gaesupControllerType } from "./type.js";
1
+ import { gaesupControllerType } from "./type";
2
2
  export declare function gaesupControllerReducer(props: gaesupControllerType, action: {
3
3
  type: string;
4
- payload?: gaesupControllerType;
4
+ payload?: Partial<gaesupControllerType>;
5
5
  }): {
6
- cameraMode: import("./type.js").gaesupCameraPropType;
7
- cameraOption: import("./type.js").gaesupCameraOptionType;
8
- perspectiveCamera: import("./type.js").perspectiveCameraPropType;
6
+ cameraMode: import("./type").gaesupCameraPropType;
7
+ cameraOption: import("./type").cameraOptionType;
8
+ perspectiveCamera: import("./type").perspectiveCameraPropType;
9
9
  orthographicCamera: import("@react-three/fiber").OrthographicCameraProps;
10
- airplane: import("./type.js").airplaneType;
11
- vehicle: import("./type.js").vehicleType;
12
- character: import("./type.js").characterType;
10
+ airplane: import("./type").airplaneType;
11
+ vehicle: import("./type").vehicleType;
12
+ character: import("./type").characterType;
13
13
  isRider: boolean;
14
+ callbacks: import("../../initial/callback/type").callbackType;
15
+ refs: import("../type").refsType;
14
16
  };
@@ -1,22 +1,35 @@
1
- import { GroupProps, OrthographicCameraProps } from "@react-three/fiber";
2
- import { Dispatch } from "react";
3
- export interface airplaneType extends GroupProps {
4
- angleChange?: THREE.Vector3;
1
+ import { GroupProps } from "@react-three/fiber";
2
+ import { callbackType } from "../../initial/callback/type";
3
+ import { dispatchType } from "../../utils/type";
4
+ import { gaesupControllerContextPropType, refsType } from "../type";
5
+ export type airplaneDebugType = {
6
+ angleDelta?: THREE.Vector3;
5
7
  maxAngle?: THREE.Vector3;
8
+ buoyancy?: number;
6
9
  maxSpeed?: number;
7
10
  accelRatio?: number;
8
- }
9
- export interface vehicleType extends GroupProps {
10
- angleChange?: THREE.Vector3;
11
- maxAngle?: THREE.Vector3;
11
+ brakeRatio?: number;
12
+ linearDamping?: number;
13
+ };
14
+ export type vehicleDebugType = {
12
15
  maxSpeed?: number;
13
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 {
14
29
  }
15
- export interface characterType extends GroupProps {
16
- angleChange?: THREE.Vector3;
17
- maxAngle?: THREE.Vector3;
18
- maxSpeed?: number;
19
- accelRatio?: number;
30
+ export interface vehicleType extends GroupProps, vehicleDebugType {
31
+ }
32
+ export interface characterType extends GroupProps, characterDebugType {
20
33
  }
21
34
  export type perspectiveCameraType = {
22
35
  cameraType?: "perspective";
@@ -27,26 +40,32 @@ export type orthographicCameraType = {
27
40
  controlType?: "orbit";
28
41
  };
29
42
  export type gaesupCameraPropType = perspectiveCameraType | orthographicCameraType;
30
- export type gaesupCameraOptionType = {
43
+ export type gaesupCameraOptionDebugType = {
44
+ initDistance?: number;
45
+ maxDistance?: number;
46
+ minDistance?: number;
47
+ initDir?: number;
48
+ distance?: number;
49
+ camFollow?: number;
50
+ };
51
+ export type cameraOptionType = {
31
52
  offset?: THREE.Vector3;
53
+ collisionOff?: number;
54
+ } & gaesupCameraOptionDebugType;
55
+ export type perspectiveCameraDebugType = {
56
+ XZDistance?: number;
57
+ YDistance?: number;
58
+ };
59
+ export type orthographicCameraDebugType = {
60
+ zoom?: number;
61
+ near?: number;
62
+ far?: number;
32
63
  };
33
64
  export type perspectiveCameraPropType = {
34
65
  isFront: boolean;
35
- XZDistance: number;
36
- YDistance: number;
37
- };
38
- export type gaesupControllerType = {
39
- cameraMode: gaesupCameraPropType;
40
- cameraOption: gaesupCameraOptionType;
41
- perspectiveCamera: perspectiveCameraPropType;
42
- orthographicCamera: OrthographicCameraProps;
43
- airplane: airplaneType;
44
- vehicle: vehicleType;
45
- character: characterType;
46
- isRider: boolean;
47
- };
48
- export type gaesupControllerPartialType = Partial<gaesupControllerType>;
49
- export type gaesupDisptachType = Dispatch<{
50
- type: string;
51
- payload?: Partial<gaesupControllerType>;
52
- }>;
66
+ } & perspectiveCameraDebugType;
67
+ export type gaesupControllerType = gaesupControllerContextPropType & {
68
+ callbacks: callbackType;
69
+ refs: refsType;
70
+ };
71
+ export type gaesupDisptachType = dispatchType<gaesupControllerType>;