gaesup-world 0.0.781 → 0.0.783

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 (184) hide show
  1. package/LICENSE.txt +21 -0
  2. package/README.md +273 -8
  3. package/dist/gaesup/camera/control/normal.js +4 -2
  4. package/dist/gaesup/camera/control/orbit.d.ts +2 -0
  5. package/dist/gaesup/camera/control/orbit.js +13 -10
  6. package/dist/gaesup/camera/index.js +75 -20
  7. package/dist/gaesup/component/active/character/index.js +1 -1
  8. package/dist/gaesup/component/active/common/RigidbodyRef.d.ts +1 -0
  9. package/dist/gaesup/component/active/common/RigidbodyRef.js +2 -2
  10. package/dist/gaesup/component/active/common/WrapperRef.d.ts +2 -1
  11. package/dist/gaesup/component/active/common/WrapperRef.js +2 -2
  12. package/dist/gaesup/component/active/vehicle/collider.js +2 -2
  13. package/dist/gaesup/component/active/vehicle/wheel.js +1 -1
  14. package/dist/gaesup/component/index.js +1 -1
  15. package/dist/gaesup/component/passive/airplane/index.js +3 -1
  16. package/dist/gaesup/component/passive/common/RigidbodyRef.js +4 -1
  17. package/dist/gaesup/controller/context/index.d.ts +1 -22
  18. package/dist/gaesup/controller/context/index.js +5 -29
  19. package/dist/gaesup/controller/context/reducer.d.ts +0 -4
  20. package/dist/gaesup/controller/context/type.d.ts +0 -33
  21. package/dist/gaesup/controller/debug/index.js +1 -54
  22. package/dist/gaesup/controller/index.js +0 -5
  23. package/dist/gaesup/controller/initialize/index.d.ts +1 -3
  24. package/dist/gaesup/controller/initialize/index.js +2 -3
  25. package/dist/gaesup/controller/type.d.ts +3 -6
  26. package/dist/gaesup/gaesupProps/index.d.ts +1 -2
  27. package/dist/gaesup/gaesupProps/index.js +2 -23
  28. package/dist/gaesup/{tools/joystick/default.d.ts → hooks/useJoyStick/index.d.ts} +1 -1
  29. package/dist/gaesup/{tools/joystick/default.js → hooks/useJoyStick/index.js} +1 -1
  30. package/dist/gaesup/physics/airplane/direction.js +14 -12
  31. package/dist/gaesup/physics/airplane/index.js +2 -4
  32. package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
  33. package/dist/gaesup/physics/{vehicle/currentSetting.js → airplane/innerCalc.js} +6 -2
  34. package/dist/gaesup/physics/character/direction.d.ts +1 -1
  35. package/dist/gaesup/physics/character/direction.js +13 -13
  36. package/dist/gaesup/physics/character/innerCalc.js +7 -3
  37. package/dist/gaesup/physics/check/ground.d.ts +1 -1
  38. package/dist/gaesup/physics/check/ground.js +4 -2
  39. package/dist/gaesup/physics/check/moving.js +1 -2
  40. package/dist/gaesup/physics/index.js +8 -5
  41. package/dist/gaesup/physics/vehicle/direction.d.ts +2 -0
  42. package/dist/gaesup/physics/vehicle/direction.js +30 -23
  43. package/dist/gaesup/physics/vehicle/impulse.js +1 -5
  44. package/dist/gaesup/physics/vehicle/index.js +2 -4
  45. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
  46. package/dist/gaesup/physics/{airplane/currentSetting.js → vehicle/innerCalc.js} +3 -2
  47. package/dist/gaesup/tools/{gameboy → gameBoy}/GameBoyButton.d.ts +3 -3
  48. package/dist/gaesup/tools/gameBoy/GameBoyButton.js +16 -0
  49. package/dist/gaesup/tools/{gameboy → gameBoy}/index.d.ts +1 -0
  50. package/dist/gaesup/tools/{gameboy → gameBoy}/index.js +2 -3
  51. package/dist/gaesup/tools/gameBoy/type.d.ts +4 -0
  52. package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +7 -0
  53. package/dist/gaesup/tools/gamePad/GamePadButton.js +21 -0
  54. package/dist/gaesup/tools/gamePad/index.d.ts +6 -0
  55. package/dist/gaesup/tools/{gamepad → gamePad}/index.js +10 -8
  56. package/dist/gaesup/tools/gamePad/type.d.ts +6 -0
  57. package/dist/gaesup/tools/{joystick → joyStick}/index.d.ts +1 -0
  58. package/dist/gaesup/tools/{joystick → joyStick}/index.js +19 -20
  59. package/dist/gaesup/tools/{joystick → joyStick}/type.d.ts +2 -2
  60. package/dist/gaesup/tools/jumpPortal/index.d.ts +3 -0
  61. package/dist/gaesup/tools/jumpPortal/index.js +11 -0
  62. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +1 -0
  63. package/dist/gaesup/tools/keyBoardToolTip/index.js +4 -6
  64. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +2 -2
  65. package/dist/gaesup/tools/{minimap → miniMap}/index.d.ts +1 -0
  66. package/dist/gaesup/tools/{minimap → miniMap}/index.js +13 -16
  67. package/dist/gaesup/tools/{minimap → miniMap}/type.d.ts +2 -2
  68. package/dist/gaesup/tools/rideable/index.d.ts +9 -0
  69. package/dist/gaesup/tools/rideable/index.js +115 -0
  70. package/dist/gaesup/tools/zoomButton/index.d.ts +10 -0
  71. package/dist/gaesup/tools/zoomButton/index.js +99 -0
  72. package/dist/gaesup/world/context/index.js +25 -1
  73. package/dist/gaesup/world/context/reducer.d.ts +8 -3
  74. package/dist/gaesup/world/context/type.d.ts +35 -7
  75. package/dist/gaesup/{controller → world}/debug/cameraOption.d.ts +20 -0
  76. package/dist/gaesup/{controller → world}/debug/cameraOption.js +20 -0
  77. package/dist/gaesup/world/debug/index.js +28 -4
  78. package/dist/gaesup/world/index.d.ts +1 -0
  79. package/dist/gaesup/world/index.js +4 -2
  80. package/dist/gaesup/world/initalize/index.d.ts +8 -3
  81. package/dist/gaesup/world/initalize/index.js +12 -2
  82. package/dist/gaesup/world/type.d.ts +6 -1
  83. package/dist/index.d.ts +19 -2
  84. package/dist/index.js +19 -2
  85. package/package.json +8 -9
  86. package/yarn-error.log +12152 -0
  87. package/dist/gaesup/camera/control/map.d.ts +0 -2
  88. package/dist/gaesup/camera/control/map.js +0 -5
  89. package/dist/gaesup/controller/debug/orthographicCamera.d.ts +0 -17
  90. package/dist/gaesup/controller/debug/orthographicCamera.js +0 -17
  91. package/dist/gaesup/controller/debug/perspectiveCamera.d.ts +0 -12
  92. package/dist/gaesup/controller/debug/perspectiveCamera.js +0 -12
  93. package/dist/gaesup/index.d.ts +0 -11
  94. package/dist/gaesup/index.js +0 -11
  95. package/dist/gaesup/physics/airplane/currentSetting.d.ts +0 -2
  96. package/dist/gaesup/physics/airplane/turn.d.ts +0 -2
  97. package/dist/gaesup/physics/airplane/turn.js +0 -5
  98. package/dist/gaesup/physics/vehicle/currentSetting.d.ts +0 -2
  99. package/dist/gaesup/physics/vehicle/turn.d.ts +0 -2
  100. package/dist/gaesup/physics/vehicle/turn.js +0 -6
  101. package/dist/gaesup/styles.css.d.ts +0 -2
  102. package/dist/gaesup/styles.css.js +0 -24
  103. package/dist/gaesup/tools/gameboy/GameBoyButton.js +0 -20
  104. package/dist/gaesup/tools/gameboy/style.css.d.ts +0 -39
  105. package/dist/gaesup/tools/gameboy/style.css.js +0 -76
  106. package/dist/gaesup/tools/gameboy/type.d.ts +0 -4
  107. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +0 -6
  108. package/dist/gaesup/tools/gamepad/GamePadButton.js +0 -24
  109. package/dist/gaesup/tools/gamepad/default.d.ts +0 -3
  110. package/dist/gaesup/tools/gamepad/default.js +0 -3
  111. package/dist/gaesup/tools/gamepad/index.d.ts +0 -2
  112. package/dist/gaesup/tools/gamepad/style.css.d.ts +0 -15
  113. package/dist/gaesup/tools/gamepad/style.css.js +0 -68
  114. package/dist/gaesup/tools/gamepad/type.d.ts +0 -6
  115. package/dist/gaesup/tools/index.d.ts +0 -6
  116. package/dist/gaesup/tools/index.js +0 -6
  117. package/dist/gaesup/tools/joystick/style.css.d.ts +0 -2
  118. package/dist/gaesup/tools/joystick/style.css.js +0 -33
  119. package/dist/gaesup/tools/jumpPoint/index.d.ts +0 -3
  120. package/dist/gaesup/tools/jumpPoint/index.js +0 -22
  121. package/dist/gaesup/tools/jumpPoint/style.css.d.ts +0 -2
  122. package/dist/gaesup/tools/jumpPoint/style.css.js +0 -32
  123. package/dist/gaesup/tools/keyBoardToolTip/style.css.d.ts +0 -2
  124. package/dist/gaesup/tools/keyBoardToolTip/style.css.js +0 -26
  125. package/dist/gaesup/tools/minimap/style.css.d.ts +0 -41
  126. package/dist/gaesup/tools/minimap/style.css.js +0 -215
  127. package/dist/styles/constants/boxshadow.css.d.ts +0 -9
  128. package/dist/styles/constants/boxshadow.css.js +0 -9
  129. package/dist/styles/constants/constant.css.d.ts +0 -77
  130. package/dist/styles/constants/constant.css.js +0 -79
  131. package/dist/styles/constants/direction.css.d.ts +0 -160
  132. package/dist/styles/constants/direction.css.js +0 -166
  133. package/dist/styles/constants/flex.css.d.ts +0 -61
  134. package/dist/styles/constants/flex.css.js +0 -66
  135. package/dist/styles/constants/gradient.css.d.ts +0 -8
  136. package/dist/styles/constants/gradient.css.js +0 -8
  137. package/dist/styles/constants/grid.css.d.ts +0 -55
  138. package/dist/styles/constants/grid.css.js +0 -19
  139. package/dist/styles/constants/palette.css.d.ts +0 -77
  140. package/dist/styles/constants/palette.css.js +0 -80
  141. package/dist/styles/constants/translate.css.d.ts +0 -563
  142. package/dist/styles/constants/translate.css.js +0 -131
  143. package/dist/styles/global.css.d.ts +0 -1
  144. package/dist/styles/global.css.js +0 -68
  145. package/dist/styles/index.d.ts +0 -2
  146. package/dist/styles/index.js +0 -2
  147. package/dist/styles/recipe/base.css.d.ts +0 -22
  148. package/dist/styles/recipe/base.css.js +0 -21
  149. package/dist/styles/recipe/button.css.d.ts +0 -61
  150. package/dist/styles/recipe/button.css.js +0 -107
  151. package/dist/styles/recipe/index.css.d.ts +0 -4167
  152. package/dist/styles/recipe/index.css.js +0 -110
  153. package/dist/styles/recipe/input.css.d.ts +0 -21
  154. package/dist/styles/recipe/input.css.js +0 -32
  155. package/dist/styles/sprinkles/color.css.d.ts +0 -764
  156. package/dist/styles/sprinkles/color.css.js +0 -60
  157. package/dist/styles/sprinkles/direction.css.d.ts +0 -1047
  158. package/dist/styles/sprinkles/direction.css.js +0 -35
  159. package/dist/styles/sprinkles/display.css.d.ts +0 -208
  160. package/dist/styles/sprinkles/display.css.js +0 -24
  161. package/dist/styles/sprinkles/fontSize.css.d.ts +0 -529
  162. package/dist/styles/sprinkles/fontSize.css.js +0 -31
  163. package/dist/styles/sprinkles/grid.css.d.ts +0 -462
  164. package/dist/styles/sprinkles/grid.css.js +0 -24
  165. package/dist/styles/sprinkles/index.css.d.ts +0 -368
  166. package/dist/styles/sprinkles/index.css.js +0 -11
  167. package/dist/styles/sprinkles/margin.css.d.ts +0 -2212
  168. package/dist/styles/sprinkles/margin.css.js +0 -39
  169. package/dist/styles/sprinkles/padding.css.d.ts +0 -2212
  170. package/dist/styles/sprinkles/padding.css.js +0 -39
  171. package/dist/styles/sprinkles/position.css.d.ts +0 -48
  172. package/dist/styles/sprinkles/position.css.js +0 -13
  173. package/dist/styles/sprinkles/size.css.d.ts +0 -43
  174. package/dist/styles/sprinkles/size.css.js +0 -32
  175. package/dist/styles/theme.css.d.ts +0 -62
  176. package/dist/styles/theme.css.js +0 -75
  177. /package/dist/gaesup/{tools/pushKey → hooks/usePushKey}/index.d.ts +0 -0
  178. /package/dist/gaesup/{tools/pushKey → hooks/usePushKey}/index.js +0 -0
  179. /package/dist/gaesup/tools/{gameboy → gameBoy}/type.js +0 -0
  180. /package/dist/gaesup/tools/{gamepad → gamePad}/type.js +0 -0
  181. /package/dist/gaesup/tools/{joystick → joyStick}/type.js +0 -0
  182. /package/dist/gaesup/tools/{minimap → miniMap}/default.d.ts +0 -0
  183. /package/dist/gaesup/tools/{minimap → miniMap}/default.js +0 -0
  184. /package/dist/gaesup/tools/{minimap → miniMap}/type.js +0 -0
@@ -12,33 +12,9 @@ var __assign = (this && this.__assign) || function () {
12
12
  import { createContext } from "react";
13
13
  import { V3 } from "../../utils/vector";
14
14
  export var gaesupControllerDefault = {
15
- cameraMode: {
16
- cameraType: "perspective",
17
- controlType: "normal",
18
- },
19
- cameraOption: {
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,
28
- },
29
- perspectiveCamera: {
30
- isFront: true,
31
- XZDistance: 8,
32
- YDistance: 1,
33
- },
34
- orthographicCamera: {
35
- zoom: 1,
36
- near: 0.1,
37
- far: 1000,
38
- },
39
15
  airplane: {
40
- angleDelta: V3(0.01, 0.005, 0.005),
41
- maxAngle: V3(0.1, 0.1, 0.1),
16
+ angleDelta: V3(Math.PI / 256, Math.PI / 256, Math.PI / 256),
17
+ maxAngle: V3(Math.PI / 8, Math.PI / 8, Math.PI / 8),
42
18
  maxSpeed: 60,
43
19
  accelRatio: 2,
44
20
  brakeRatio: 5,
@@ -53,10 +29,10 @@ export var gaesupControllerDefault = {
53
29
  linearDamping: 0.5,
54
30
  },
55
31
  character: {
56
- walkSpeed: 4,
57
- runSpeed: 10,
32
+ walkSpeed: 10,
33
+ runSpeed: 20,
58
34
  turnSpeed: 10,
59
- jumpSpeed: 0.5,
35
+ jumpSpeed: 1,
60
36
  linearDamping: 1,
61
37
  },
62
38
  callbacks: {
@@ -3,10 +3,6 @@ export declare function gaesupControllerReducer(props: gaesupControllerType, act
3
3
  type: string;
4
4
  payload?: Partial<gaesupControllerType>;
5
5
  }): {
6
- cameraMode: import("./type").gaesupCameraPropType;
7
- cameraOption: import("./type").cameraOptionType;
8
- perspectiveCamera: import("./type").perspectiveCameraPropType;
9
- orthographicCamera: import("@react-three/fiber").OrthographicCameraProps;
10
6
  airplane: import("./type").airplaneType;
11
7
  vehicle: import("./type").vehicleType;
12
8
  character: import("./type").characterType;
@@ -31,39 +31,6 @@ export interface vehicleType extends GroupProps, vehicleDebugType {
31
31
  }
32
32
  export interface characterType extends GroupProps, characterDebugType {
33
33
  }
34
- export type perspectiveCameraType = {
35
- cameraType?: "perspective";
36
- controlType?: "orbit" | "normal";
37
- };
38
- export type orthographicCameraType = {
39
- cameraType?: "orthographic";
40
- controlType?: "orbit";
41
- };
42
- export type gaesupCameraPropType = perspectiveCameraType | orthographicCameraType;
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 = {
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;
63
- };
64
- export type perspectiveCameraPropType = {
65
- isFront?: boolean;
66
- } & perspectiveCameraDebugType;
67
34
  export type gaesupControllerType = gaesupControllerContextPropType & {
68
35
  callbacks?: callbackType;
69
36
  refs?: refsType;
@@ -10,42 +10,17 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { useContext, useEffect } from "react";
13
- import { buttonGroup, useControls } from "leva";
14
13
  import { update } from "../../utils/context";
15
14
  import debug from "../../utils/debug";
16
15
  import { GaesupWorldContext } from "../../world/context";
17
16
  import { airplaneDebugMap } from "./airplane";
18
- import { cameraOptionDebugMap } from "./cameraOption";
19
17
  import { characterDebugMap } from "./character";
20
- import { orthographicCameraDebugMap } from "./orthographicCamera";
21
- import { perspectiveCameraDebugMap } from "./perspectiveCamera";
22
18
  import { vehicleDebugMap } from "./vehicle";
23
19
  export default function initDebug(_a) {
24
20
  var controllerContext = _a.controllerContext, controllerDispatch = _a.controllerDispatch;
25
21
  var worldDebug = useContext(GaesupWorldContext).debug;
26
- var cameraMode = controllerContext.cameraMode;
27
22
  if (!worldDebug)
28
23
  return;
29
- var _b = useControls(function () { return ({
30
- cameraType: cameraMode.cameraType,
31
- " ": buttonGroup({
32
- perspective: function () { return setcameraType({ cameraType: "perspective" }); },
33
- orthographic: function () { return setcameraType({ cameraType: "orthographic" }); },
34
- }),
35
- }); }), cameraType = _b[0], setcameraType = _b[1];
36
- var _c = useControls(function () { return ({
37
- controlType: cameraMode.controlType,
38
- " ": buttonGroup({
39
- orbit: function () { return controlTypeSet({ controlType: "orbit" }); },
40
- normal: function () { return controlTypeSet({ controlType: "normal" }); },
41
- }),
42
- }); }), controlType = _c[0], controlTypeSet = _c[1];
43
- var cameraOptionValue = debug({
44
- debug: worldDebug,
45
- debugProps: controllerContext.cameraOption,
46
- tag: "cameraOption",
47
- debugMap: cameraOptionDebugMap,
48
- });
49
24
  var characterOptionValue = debug({
50
25
  debug: worldDebug,
51
26
  debugProps: controllerContext.character,
@@ -64,39 +39,11 @@ export default function initDebug(_a) {
64
39
  tag: "airplane",
65
40
  debugMap: airplaneDebugMap,
66
41
  });
67
- var orthographicCameraOptionValue = debug({
68
- debug: worldDebug,
69
- debugProps: controllerContext.orthographicCamera,
70
- tag: "orthographicCamera",
71
- debugMap: orthographicCameraDebugMap,
72
- });
73
- var perspectiveCameraOptionValue = debug({
74
- debug: worldDebug,
75
- debugProps: controllerContext.perspectiveCamera,
76
- tag: "perspectiveCamera",
77
- debugMap: perspectiveCameraDebugMap,
78
- });
79
42
  useEffect(function () {
80
43
  update({
81
- cameraOption: __assign({}, cameraOptionValue),
82
44
  character: __assign({}, characterOptionValue),
83
45
  vehicle: __assign({}, vehicleOptionValue),
84
46
  airplane: __assign({}, airplaneOptionValue),
85
- perspectiveCamera: __assign(__assign({}, controllerContext.perspectiveCamera), perspectiveCameraOptionValue),
86
- orthographicCamera: __assign(__assign({}, controllerContext.orthographicCamera), orthographicCameraOptionValue),
87
- cameraMode: {
88
- cameraType: cameraType.cameraType,
89
- controlType: controlType.controlType,
90
- },
91
47
  }, controllerDispatch);
92
- }, [
93
- cameraOptionValue,
94
- characterOptionValue,
95
- vehicleOptionValue,
96
- airplaneOptionValue,
97
- perspectiveCameraOptionValue,
98
- orthographicCameraOptionValue,
99
- cameraType,
100
- controlType,
101
- ]);
48
+ }, [characterOptionValue, vehicleOptionValue, airplaneOptionValue]);
102
49
  }
@@ -26,10 +26,6 @@ export function GaesupController(props) {
26
26
  var characterInnerRef = useRef(null);
27
27
  var passiveRigidBodyRef = useRef(null);
28
28
  var _a = useReducer(gaesupControllerReducer, {
29
- cameraMode: Object.assign(gaesupControllerDefault.cameraMode, props.cameraMode || {}),
30
- cameraOption: Object.assign(gaesupControllerDefault.cameraOption, props.cameraOption || {}),
31
- perspectiveCamera: Object.assign(gaesupControllerDefault.perspectiveCamera, props.perspectiveCamera || {}),
32
- orthographicCamera: Object.assign(gaesupControllerDefault.orthographicCamera, props.orthographicCamera || {}),
33
29
  airplane: Object.assign(gaesupControllerDefault.airplane, props.airplane || {}),
34
30
  vehicle: Object.assign(gaesupControllerDefault.vehicle, props.vehicle || {}),
35
31
  character: Object.assign(gaesupControllerDefault.character, props.character || {}),
@@ -65,7 +61,6 @@ export function GaesupController(props) {
65
61
  };
66
62
  }, []);
67
63
  var prop = __assign(__assign(__assign(__assign({}, initControllerProps({
68
- controllerContext: gaesupControl.value,
69
64
  refs: refs,
70
65
  })), { children: props.children, groupProps: props.groupProps }), gaesupControl.value.callbacks), refs);
71
66
  initDebug({
@@ -1,9 +1,7 @@
1
1
  import { groundRayType, refsType, slopeRayType } from "../../controller/type";
2
2
  import { cameraRayType } from "../../camera/type";
3
3
  import { keyControlType } from "../../world/context/type";
4
- import { gaesupControllerType } from "../context/type";
5
- export default function initControllerProps({ controllerContext, refs, }: {
6
- controllerContext: gaesupControllerType;
4
+ export default function initControllerProps({ refs }: {
7
5
  refs: refsType;
8
6
  }): {
9
7
  slopeRay: slopeRayType;
@@ -16,7 +16,7 @@ import * as THREE from "three";
16
16
  import { update } from "../../utils/context";
17
17
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
18
18
  export default function initControllerProps(_a) {
19
- var controllerContext = _a.controllerContext, refs = _a.refs;
19
+ var refs = _a.refs;
20
20
  var context = useContext(GaesupWorldContext);
21
21
  var dispatch = useContext(GaesupWorldDispatchContext);
22
22
  var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
@@ -63,13 +63,12 @@ export default function initControllerProps(_a) {
63
63
  rayCast: new THREE.Raycaster(vec3(), vec3(), 0, -7),
64
64
  dir: vec3(),
65
65
  position: vec3(),
66
- length: -controllerContext.cameraOption.maxDistance,
66
+ length: -context.cameraOption.maxDistance,
67
67
  detected: [],
68
68
  intersects: [],
69
69
  intersectObjectMap: {},
70
70
  };
71
71
  }, []);
72
- cameraRay.rayCast = new THREE.Raycaster(cameraRay.origin, cameraRay.dir, 0, -controllerContext.cameraOption.maxDistance);
73
72
  var initRefs = useCallback(function (refs) {
74
73
  update({
75
74
  refs: __assign({}, refs),
@@ -1,11 +1,11 @@
1
1
  import { Collider, Ray, RayColliderToi } from "@dimforge/rapier3d-compat";
2
- import { GroupProps, OrthographicCameraProps } from "@react-three/fiber";
2
+ import { GroupProps } from "@react-three/fiber";
3
3
  import { RapierRigidBody, RigidBodyProps } from "@react-three/rapier";
4
4
  import { ReactNode, RefObject } from "react";
5
5
  import * as THREE from "three";
6
6
  import { cameraRayType } from "../camera/type";
7
7
  import { keyControlType } from "../world/context/type";
8
- import { airplaneType, cameraOptionType, characterType, gaesupCameraPropType, perspectiveCameraPropType, vehicleType } from "./context/type";
8
+ import { airplaneType, characterType, vehicleType } from "./context/type";
9
9
  import { callbackType } from "./initialize/callback/type";
10
10
  export type optionsType = {
11
11
  debug: boolean;
@@ -44,6 +44,7 @@ export type slopeRayType = Omit<rayType, "parent">;
44
44
  export type groundRayType = Omit<rayType, "current" | "angle">;
45
45
  export type controllerInnerType = {
46
46
  isRider?: boolean;
47
+ name?: string;
47
48
  slopeRay: slopeRayType;
48
49
  groundRay: groundRayType;
49
50
  cameraRay: cameraRayType;
@@ -73,10 +74,6 @@ export type refsType = {
73
74
  characterInnerRef: RefObject<THREE.Group>;
74
75
  };
75
76
  export type gaesupControllerContextPropType = {
76
- cameraMode: gaesupCameraPropType;
77
- cameraOption: cameraOptionType;
78
- perspectiveCamera: perspectiveCameraPropType;
79
- orthographicCamera: OrthographicCameraProps;
80
77
  airplane: airplaneType;
81
78
  vehicle: vehicleType;
82
79
  character: characterType;
@@ -1,7 +1,6 @@
1
1
  /// <reference types="react" />
2
- export declare function GaeSupProps({ text, position, jumpPoint, children, }: {
2
+ export declare function GaeSupProps({ text, position, children, }: {
3
3
  text?: string;
4
4
  position?: [number, number, number];
5
- jumpPoint?: boolean;
6
5
  children: React.ReactNode;
7
6
  }): import("react/jsx-runtime").JSX.Element;
@@ -9,38 +9,17 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
13
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
14
- if (ar || !(i in from)) {
15
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
16
- ar[i] = from[i];
17
- }
18
- }
19
- return to.concat(ar || Array.prototype.slice.call(from));
20
- };
21
12
  import { jsx as _jsx } from "react/jsx-runtime";
22
13
  import { vec3 } from "@react-three/rapier";
23
14
  import { Suspense, useContext, useEffect, useRef } from "react";
24
15
  import * as THREE from "three";
25
16
  import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context/index.js";
26
17
  export function GaeSupProps(_a) {
27
- var text = _a.text, position = _a.position, jumpPoint = _a.jumpPoint, children = _a.children;
18
+ var text = _a.text, position = _a.position, children = _a.children;
28
19
  var groupRef = useRef(null);
29
- var _b = useContext(GaesupWorldContext), minimap = _b.minimap, points = _b.points;
20
+ var minimap = useContext(GaesupWorldContext).minimap;
30
21
  var dispatch = useContext(GaesupWorldDispatchContext);
31
22
  useEffect(function () {
32
- if (jumpPoint && position) {
33
- points.push({
34
- text: text || null,
35
- position: vec3().set(position[0], 5, position[2]),
36
- });
37
- dispatch({
38
- type: "update",
39
- payload: {
40
- points: __spreadArray([], points, true),
41
- },
42
- });
43
- }
44
23
  if (groupRef.current) {
45
24
  var box = new THREE.Box3().setFromObject(groupRef.current);
46
25
  var size = vec3(box.getSize(new THREE.Vector3())).clone();
@@ -1,4 +1,4 @@
1
- import { joyStickBallType, joyStickOriginType } from "./type.js";
1
+ import { joyStickBallType, joyStickOriginType } from "../../tools/joyStick/type";
2
2
  export declare const joyStickBallDefault: {
3
3
  top: string;
4
4
  left: string;
@@ -10,7 +10,7 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { useContext } from "react";
13
- import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context/index.js";
13
+ import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
14
14
  export var joyStickBallDefault = {
15
15
  top: "50%",
16
16
  left: "50%",
@@ -1,7 +1,7 @@
1
1
  import { quat } from "@react-three/rapier";
2
2
  import { V3 } from "../../utils/vector";
3
3
  export default function direction(prop) {
4
- var state = prop.state, innerGroupRef = prop.innerGroupRef, _a = prop.worldContext, joystick = _a.joystick, activeState = _a.activeState, control = _a.control, mode = _a.mode, airplane = prop.controllerContext.airplane;
4
+ var state = prop.state, innerGroupRef = prop.innerGroupRef, _a = prop.worldContext, joystick = _a.joystick, activeState = _a.activeState, control = _a.control, mode = _a.mode, airplane = prop.controllerContext.airplane, delta = prop.delta;
5
5
  var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward, shift = control.shift, space = control.space;
6
6
  var angleDelta = airplane.angleDelta, maxAngle = airplane.maxAngle, accelRatio = airplane.accelRatio;
7
7
  var boost = 0;
@@ -23,16 +23,12 @@ export default function direction(prop) {
23
23
  var _euler = activeState.euler.clone();
24
24
  var __euler = activeState.euler.clone();
25
25
  if (mode.controller === "joystick") {
26
- __euler.y =
27
- -state.camera.rotation.y - joystick.joyStickOrigin.angle - Math.PI / 2;
26
+ __euler.y = -Math.PI / 2 + joystick.joyStickOrigin.angle;
27
+ activeState.euler.setFromQuaternion(quat().setFromEuler(_euler).slerp(quat().setFromEuler(__euler), 1));
28
28
  }
29
29
  else {
30
30
  activeState.euler.y += -leftRight * angleDelta.y;
31
31
  }
32
- if (mode.controller === "joystick")
33
- activeState.euler.setFromQuaternion(quat()
34
- .setFromEuler(_euler)
35
- .slerp(quat().setFromEuler(__euler), joystick.joyStickOrigin.isIn ? 0.01 : 0.1));
36
32
  var X = maxAngle.x * upDown;
37
33
  var Z = maxAngle.z * leftRight;
38
34
  var _x = innerGroupRef.current.rotation.x;
@@ -40,23 +36,29 @@ export default function direction(prop) {
40
36
  var maxX = maxAngle.x;
41
37
  var maxZ = maxAngle.z;
42
38
  var innerGrounRefRotation = innerGroupRef.current.clone();
43
- if (_x < -maxX)
39
+ if (_x < -maxX) {
44
40
  innerGrounRefRotation.rotation.x = -maxX + X;
45
- else if (_x > maxX)
41
+ }
42
+ else if (_x > maxX) {
46
43
  innerGrounRefRotation.rotation.x = maxX + X;
47
- else
44
+ }
45
+ else {
48
46
  innerGrounRefRotation.rotateX(X);
47
+ }
49
48
  if (_z < -maxZ)
50
49
  innerGrounRefRotation.rotation.z = -maxZ + Z;
51
50
  else if (_z > maxZ)
52
51
  innerGrounRefRotation.rotation.z = maxZ + Z;
53
52
  else
54
53
  innerGrounRefRotation.rotateZ(Z);
54
+ activeState.euler.x = innerGrounRefRotation.rotation.x;
55
+ activeState.euler.z = innerGrounRefRotation.rotation.z;
56
+ innerGrounRefRotation.rotation.y = 0;
55
57
  innerGroupRef.current.setRotationFromQuaternion(quat()
56
58
  .setFromEuler(innerGroupRef.current.rotation.clone())
57
- .slerp(quat().setFromEuler(innerGrounRefRotation.rotation), 0.1));
59
+ .slerp(quat().setFromEuler(innerGrounRefRotation.rotation.clone()), 0.2));
58
60
  activeState.rotation = innerGrounRefRotation.rotation;
59
61
  activeState.direction = front.multiply(V3(Math.sin(activeState.euler.y), -upDown, Math.cos(activeState.euler.y)));
60
62
  activeState.dir = activeState.direction.normalize();
61
- activeState.euler = innerGroupRef.current.rotation;
63
+ // activeState.euler = innerGroupRef.current.rotation;
62
64
  }
@@ -1,14 +1,12 @@
1
- import currentSetting from "./currentSetting";
2
1
  import damping from "./damping";
3
2
  import direction from "./direction";
4
3
  import gravity from "./gravity";
5
4
  import impulse from "./impulse";
6
- import turn from "./turn";
5
+ import innerCalc from "./innerCalc";
7
6
  export default function airplaneCalculation(calcProp) {
8
7
  direction(calcProp);
9
- turn(calcProp);
10
8
  impulse(calcProp);
11
9
  damping(calcProp);
12
10
  gravity(calcProp);
13
- currentSetting(calcProp);
11
+ innerCalc(calcProp);
14
12
  }
@@ -0,0 +1,2 @@
1
+ import { calcPropType } from "../type";
2
+ export default function innerCalc(prop: calcPropType): void;
@@ -9,11 +9,15 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { vec3 } from "@react-three/rapier";
13
- export default function currentSetting(prop) {
12
+ import { quat, vec3 } from "@react-three/rapier";
13
+ export default function innerCalc(prop) {
14
14
  var rigidBodyRef = prop.rigidBodyRef, activeState = prop.worldContext.activeState, dispatch = prop.dispatch;
15
15
  activeState.position = vec3(rigidBodyRef.current.translation());
16
16
  activeState.velocity = vec3(rigidBodyRef.current.linvel());
17
+ var _euler = activeState.euler.clone();
18
+ _euler.x = 0;
19
+ _euler.z = 0;
20
+ rigidBodyRef.current.setRotation(quat().setFromEuler(_euler), true);
17
21
  dispatch({
18
22
  type: "update",
19
23
  payload: {
@@ -1,5 +1,5 @@
1
1
  import { RootState } from "@react-three/fiber";
2
- import { joyStickInnerType } from "../../tools/joystick/type";
2
+ import { joyStickInnerType } from "../../tools/joyStick/type";
3
3
  import { activeStateType, modeType } from "../../world/context/type";
4
4
  import { calcPropType } from "../type";
5
5
  export declare function orbitDirection({ activeState, control, mode, joystick, state, }: {
@@ -4,16 +4,16 @@ export function orbitDirection(_a) {
4
4
  var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward;
5
5
  var dirX = Number(leftward) - Number(rightward);
6
6
  var dirZ = Number(forward) - Number(backward);
7
- if (dirX === 0 && dirZ === 0)
8
- return;
9
7
  var start = 0;
10
8
  if (mode.controller === "joystick") {
11
- if (!joystick.joyStickOrigin.isCenter)
12
- activeState.euler.y =
13
- -state.camera.rotation.y - joystick.joyStickOrigin.angle - Math.PI / 2;
14
- start = joystick.joyStickOrigin.isOn ? 1 : 0;
9
+ if (joystick.joyStickOrigin.isCenter)
10
+ return;
11
+ activeState.euler.y = Math.PI / 2 - joystick.joyStickOrigin.angle;
12
+ start = 1;
15
13
  }
16
14
  else {
15
+ if (dirX === 0 && dirZ === 0)
16
+ return;
17
17
  activeState.euler.y += (dirX * Math.PI) / 32;
18
18
  start = dirZ;
19
19
  }
@@ -26,10 +26,10 @@ export function normalDirection(_a) {
26
26
  var forward = control.forward, backward = control.backward, leftward = control.leftward, rightward = control.rightward;
27
27
  var start = 0;
28
28
  if (mode.controller === "joystick") {
29
- if (!joystick.joyStickOrigin.isCenter)
30
- activeState.euler.y =
31
- -state.camera.rotation.y - joystick.joyStickOrigin.angle - Math.PI / 2;
32
- start = joystick.joyStickOrigin.isOn ? 1 : 0;
29
+ if (joystick.joyStickOrigin.isCenter)
30
+ return;
31
+ activeState.euler.y = Math.PI / 2 - joystick.joyStickOrigin.angle;
32
+ start = 1;
33
33
  }
34
34
  else {
35
35
  // 일반 컨트롤
@@ -45,11 +45,11 @@ export function normalDirection(_a) {
45
45
  }
46
46
  }
47
47
  export default function direction(prop) {
48
- var state = prop.state, _a = prop.worldContext, joystick = _a.joystick, mode = _a.mode, activeState = _a.activeState, control = _a.control, cameraMode = prop.controllerContext.cameraMode;
49
- if (cameraMode.controlType === "normal") {
48
+ var state = prop.state, _a = prop.worldContext, joystick = _a.joystick, mode = _a.mode, activeState = _a.activeState, control = _a.control;
49
+ if (mode.control === "normal") {
50
50
  normalDirection({ activeState: activeState, control: control, mode: mode, joystick: joystick, state: state });
51
51
  }
52
- else if (cameraMode.controlType === "orbit") {
52
+ else if (mode.control === "orbit") {
53
53
  orbitDirection({ activeState: activeState, control: control, mode: mode, joystick: joystick, state: state });
54
54
  }
55
55
  }
@@ -11,12 +11,16 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { quat, vec3 } from "@react-three/rapier";
13
13
  export default function innerCalc(prop) {
14
- var rigidBodyRef = prop.rigidBodyRef, innerGroupRef = prop.innerGroupRef, linearDamping = prop.controllerContext.character.linearDamping, activeState = prop.worldContext.activeState, dispatch = prop.dispatch, delta = prop.delta;
14
+ var rigidBodyRef = prop.rigidBodyRef, innerGroupRef = prop.innerGroupRef, linearDamping = prop.controllerContext.character.linearDamping, _a = prop.worldContext, activeState = _a.activeState, states = _a.states, dispatch = prop.dispatch, delta = prop.delta;
15
15
  activeState.position = vec3(rigidBodyRef.current.translation());
16
16
  activeState.velocity = vec3(rigidBodyRef.current.linvel());
17
- rigidBodyRef.current.setLinearDamping(linearDamping);
17
+ if (states.isJumping || rigidBodyRef.current.linvel().y < 0) {
18
+ rigidBodyRef.current.setLinearDamping(linearDamping);
19
+ }
20
+ else {
21
+ rigidBodyRef.current.setLinearDamping(states.isNotMoving ? linearDamping * 5 : linearDamping);
22
+ }
18
23
  rigidBodyRef.current.setEnabledRotations(false, false, false, false);
19
- // rigidBodyRef.current.setTranslation(activeState.position.clone(), false);
20
24
  innerGroupRef.current.quaternion.rotateTowards(quat().setFromEuler(activeState.euler), 10 * delta);
21
25
  dispatch({
22
26
  type: "update",
@@ -1,2 +1,2 @@
1
1
  import { calcPropType } from "../type";
2
- export default function checkOnTheGround(prop: calcPropType): any;
2
+ export default function checkOnTheGround(prop: calcPropType): void;
@@ -2,8 +2,10 @@ import { vec3 } from "@react-three/rapier";
2
2
  export default function checkOnTheGround(prop) {
3
3
  var capsuleColliderRef = prop.capsuleColliderRef, groundRay = prop.groundRay, _a = prop.worldContext, collider = _a.characterCollider, states = _a.states, activeState = _a.activeState;
4
4
  groundRay.origin.addVectors(activeState.position, vec3(groundRay.offset));
5
- if (!groundRay.hit || !groundRay.rayCast || !capsuleColliderRef.current)
6
- return null;
5
+ if (!groundRay.hit || !groundRay.rayCast || !capsuleColliderRef.current) {
6
+ states.isOnTheGround = false;
7
+ return;
8
+ }
7
9
  if (groundRay.hit.toi < collider.radius + 0.4) {
8
10
  states.isOnTheGround = true;
9
11
  }
@@ -10,8 +10,7 @@ export default function moving(prop) {
10
10
  else if (mode.controller === "joystick") {
11
11
  states.isMoving = joystick.joyStickOrigin.isOn;
12
12
  states.isNotMoving = !joystick.joyStickOrigin.isOn;
13
- states.isRunning =
14
- joystick.joyStickOrigin.isOn && joystick.joyStickOrigin.isIn;
13
+ states.isRunning = shift && states.isMoving;
15
14
  states.isJumping = space;
16
15
  }
17
16
  }
@@ -24,13 +24,14 @@ export default function calculation(prop) {
24
24
  var worldContext = useContext(GaesupWorldContext);
25
25
  var controllerContext = useContext(GaesupControllerContext);
26
26
  var dispatch = useContext(GaesupWorldDispatchContext);
27
- var mode = worldContext.mode, activeState = worldContext.activeState;
27
+ var mode = worldContext.mode, activeState = worldContext.activeState, controlBlock = worldContext.controlBlock;
28
28
  useEffect(function () {
29
- var _a;
30
29
  var rigidBodyRef = prop.rigidBodyRef;
31
- if (rigidBodyRef.current)
32
- (_a = rigidBodyRef.current) === null || _a === void 0 ? void 0 : _a.setTranslation(activeState.position.add(V3(0, 1, 0)), false);
33
- }, []);
30
+ if (rigidBodyRef.current) {
31
+ rigidBodyRef.current.lockRotations(true, true);
32
+ rigidBodyRef.current.setTranslation(activeState.position.clone().add(V3(0, 5, 0)), true);
33
+ }
34
+ }, [mode.type]);
34
35
  useFrame(function (state, delta) {
35
36
  var rigidBodyRef = prop.rigidBodyRef, outerGroupRef = prop.outerGroupRef, innerGroupRef = prop.innerGroupRef;
36
37
  if (!rigidBodyRef ||
@@ -40,6 +41,8 @@ export default function calculation(prop) {
40
41
  !innerGroupRef ||
41
42
  !innerGroupRef.current)
42
43
  return null;
44
+ if (controlBlock)
45
+ return null;
43
46
  var calcProp = __assign(__assign({}, prop), { state: state, delta: delta, worldContext: worldContext, controllerContext: controllerContext, dispatch: dispatch, world: world });
44
47
  if (mode.type === "vehicle")
45
48
  vehicleCalculation(calcProp);
@@ -1,2 +1,4 @@
1
1
  import { calcPropType } from "../type";
2
+ export declare function joystick(prop: calcPropType): import("three").Vector3;
3
+ export declare function normal(prop: calcPropType): import("three").Vector3;
2
4
  export default function direction(prop: calcPropType): void;