gaesup-world 0.0.781 → 0.0.782

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 (144) hide show
  1. package/dist/gaesup/camera/control/normal.js +4 -2
  2. package/dist/gaesup/camera/control/orbit.js +7 -8
  3. package/dist/gaesup/camera/index.js +12 -21
  4. package/dist/gaesup/component/passive/airplane/index.js +3 -1
  5. package/dist/gaesup/component/passive/common/RigidbodyRef.js +4 -1
  6. package/dist/gaesup/controller/context/index.d.ts +1 -22
  7. package/dist/gaesup/controller/context/index.js +5 -29
  8. package/dist/gaesup/controller/context/reducer.d.ts +0 -4
  9. package/dist/gaesup/controller/context/type.d.ts +0 -33
  10. package/dist/gaesup/controller/debug/index.js +1 -54
  11. package/dist/gaesup/controller/index.js +0 -5
  12. package/dist/gaesup/controller/initialize/index.d.ts +1 -3
  13. package/dist/gaesup/controller/initialize/index.js +3 -3
  14. package/dist/gaesup/controller/type.d.ts +2 -6
  15. package/dist/gaesup/gaesupProps/index.d.ts +1 -2
  16. package/dist/gaesup/gaesupProps/index.js +2 -23
  17. package/dist/gaesup/physics/airplane/direction.js +14 -12
  18. package/dist/gaesup/physics/airplane/index.js +2 -4
  19. package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
  20. package/dist/gaesup/physics/{vehicle/currentSetting.js → airplane/innerCalc.js} +6 -2
  21. package/dist/gaesup/physics/character/direction.js +13 -13
  22. package/dist/gaesup/physics/character/innerCalc.js +7 -3
  23. package/dist/gaesup/physics/check/ground.d.ts +1 -1
  24. package/dist/gaesup/physics/check/ground.js +4 -2
  25. package/dist/gaesup/physics/check/moving.js +1 -2
  26. package/dist/gaesup/physics/vehicle/direction.d.ts +2 -0
  27. package/dist/gaesup/physics/vehicle/direction.js +30 -23
  28. package/dist/gaesup/physics/vehicle/impulse.js +1 -5
  29. package/dist/gaesup/physics/vehicle/index.js +2 -4
  30. package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
  31. package/dist/gaesup/physics/{airplane/currentSetting.js → vehicle/innerCalc.js} +3 -2
  32. package/dist/gaesup/tools/gameboy/GameBoyButton.d.ts +3 -3
  33. package/dist/gaesup/tools/gameboy/GameBoyButton.js +3 -7
  34. package/dist/gaesup/tools/gameboy/index.d.ts +1 -0
  35. package/dist/gaesup/tools/gameboy/index.js +2 -3
  36. package/dist/gaesup/tools/gameboy/type.d.ts +2 -2
  37. package/dist/gaesup/tools/gamepad/GamePadButton.d.ts +4 -3
  38. package/dist/gaesup/tools/gamepad/GamePadButton.js +4 -7
  39. package/dist/gaesup/tools/gamepad/index.d.ts +1 -0
  40. package/dist/gaesup/tools/gamepad/index.js +5 -6
  41. package/dist/gaesup/tools/gamepad/type.d.ts +2 -2
  42. package/dist/gaesup/tools/index.d.ts +1 -1
  43. package/dist/gaesup/tools/index.js +1 -1
  44. package/dist/gaesup/tools/joystick/index.d.ts +1 -0
  45. package/dist/gaesup/tools/joystick/index.js +17 -12
  46. package/dist/gaesup/tools/joystick/type.d.ts +2 -2
  47. package/dist/gaesup/tools/jumpPortal/index.d.ts +3 -0
  48. package/dist/gaesup/tools/jumpPortal/index.js +11 -0
  49. package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +1 -0
  50. package/dist/gaesup/tools/keyBoardToolTip/index.js +4 -6
  51. package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +2 -2
  52. package/dist/gaesup/tools/minimap/index.d.ts +1 -0
  53. package/dist/gaesup/tools/minimap/index.js +13 -16
  54. package/dist/gaesup/tools/minimap/type.d.ts +2 -2
  55. package/dist/gaesup/world/context/index.js +15 -1
  56. package/dist/gaesup/world/context/reducer.d.ts +1 -1
  57. package/dist/gaesup/world/context/type.d.ts +22 -5
  58. package/dist/gaesup/{controller → world}/debug/cameraOption.d.ts +20 -0
  59. package/dist/gaesup/{controller → world}/debug/cameraOption.js +20 -0
  60. package/dist/gaesup/world/debug/index.js +28 -4
  61. package/dist/gaesup/world/initalize/index.d.ts +1 -1
  62. package/dist/gaesup/world/initalize/index.js +1 -1
  63. package/dist/gaesup/world/type.d.ts +2 -1
  64. package/dist/index.d.ts +0 -1
  65. package/dist/index.js +0 -1
  66. package/package.json +6 -9
  67. package/dist/gaesup/camera/control/map.d.ts +0 -2
  68. package/dist/gaesup/camera/control/map.js +0 -5
  69. package/dist/gaesup/controller/debug/orthographicCamera.d.ts +0 -17
  70. package/dist/gaesup/controller/debug/orthographicCamera.js +0 -17
  71. package/dist/gaesup/controller/debug/perspectiveCamera.d.ts +0 -12
  72. package/dist/gaesup/controller/debug/perspectiveCamera.js +0 -12
  73. package/dist/gaesup/physics/airplane/currentSetting.d.ts +0 -2
  74. package/dist/gaesup/physics/airplane/turn.d.ts +0 -2
  75. package/dist/gaesup/physics/airplane/turn.js +0 -5
  76. package/dist/gaesup/physics/vehicle/currentSetting.d.ts +0 -2
  77. package/dist/gaesup/physics/vehicle/turn.d.ts +0 -2
  78. package/dist/gaesup/physics/vehicle/turn.js +0 -6
  79. package/dist/gaesup/styles.css.d.ts +0 -2
  80. package/dist/gaesup/styles.css.js +0 -24
  81. package/dist/gaesup/tools/gameboy/style.css.d.ts +0 -39
  82. package/dist/gaesup/tools/gameboy/style.css.js +0 -76
  83. package/dist/gaesup/tools/gamepad/style.css.d.ts +0 -15
  84. package/dist/gaesup/tools/gamepad/style.css.js +0 -68
  85. package/dist/gaesup/tools/joystick/style.css.d.ts +0 -2
  86. package/dist/gaesup/tools/joystick/style.css.js +0 -33
  87. package/dist/gaesup/tools/jumpPoint/index.d.ts +0 -3
  88. package/dist/gaesup/tools/jumpPoint/index.js +0 -22
  89. package/dist/gaesup/tools/jumpPoint/style.css.d.ts +0 -2
  90. package/dist/gaesup/tools/jumpPoint/style.css.js +0 -32
  91. package/dist/gaesup/tools/keyBoardToolTip/style.css.d.ts +0 -2
  92. package/dist/gaesup/tools/keyBoardToolTip/style.css.js +0 -26
  93. package/dist/gaesup/tools/minimap/style.css.d.ts +0 -41
  94. package/dist/gaesup/tools/minimap/style.css.js +0 -215
  95. package/dist/styles/constants/boxshadow.css.d.ts +0 -9
  96. package/dist/styles/constants/boxshadow.css.js +0 -9
  97. package/dist/styles/constants/constant.css.d.ts +0 -77
  98. package/dist/styles/constants/constant.css.js +0 -79
  99. package/dist/styles/constants/direction.css.d.ts +0 -160
  100. package/dist/styles/constants/direction.css.js +0 -166
  101. package/dist/styles/constants/flex.css.d.ts +0 -61
  102. package/dist/styles/constants/flex.css.js +0 -66
  103. package/dist/styles/constants/gradient.css.d.ts +0 -8
  104. package/dist/styles/constants/gradient.css.js +0 -8
  105. package/dist/styles/constants/grid.css.d.ts +0 -55
  106. package/dist/styles/constants/grid.css.js +0 -19
  107. package/dist/styles/constants/palette.css.d.ts +0 -77
  108. package/dist/styles/constants/palette.css.js +0 -80
  109. package/dist/styles/constants/translate.css.d.ts +0 -563
  110. package/dist/styles/constants/translate.css.js +0 -131
  111. package/dist/styles/global.css.d.ts +0 -1
  112. package/dist/styles/global.css.js +0 -68
  113. package/dist/styles/index.d.ts +0 -2
  114. package/dist/styles/index.js +0 -2
  115. package/dist/styles/recipe/base.css.d.ts +0 -22
  116. package/dist/styles/recipe/base.css.js +0 -21
  117. package/dist/styles/recipe/button.css.d.ts +0 -61
  118. package/dist/styles/recipe/button.css.js +0 -107
  119. package/dist/styles/recipe/index.css.d.ts +0 -4167
  120. package/dist/styles/recipe/index.css.js +0 -110
  121. package/dist/styles/recipe/input.css.d.ts +0 -21
  122. package/dist/styles/recipe/input.css.js +0 -32
  123. package/dist/styles/sprinkles/color.css.d.ts +0 -764
  124. package/dist/styles/sprinkles/color.css.js +0 -60
  125. package/dist/styles/sprinkles/direction.css.d.ts +0 -1047
  126. package/dist/styles/sprinkles/direction.css.js +0 -35
  127. package/dist/styles/sprinkles/display.css.d.ts +0 -208
  128. package/dist/styles/sprinkles/display.css.js +0 -24
  129. package/dist/styles/sprinkles/fontSize.css.d.ts +0 -529
  130. package/dist/styles/sprinkles/fontSize.css.js +0 -31
  131. package/dist/styles/sprinkles/grid.css.d.ts +0 -462
  132. package/dist/styles/sprinkles/grid.css.js +0 -24
  133. package/dist/styles/sprinkles/index.css.d.ts +0 -368
  134. package/dist/styles/sprinkles/index.css.js +0 -11
  135. package/dist/styles/sprinkles/margin.css.d.ts +0 -2212
  136. package/dist/styles/sprinkles/margin.css.js +0 -39
  137. package/dist/styles/sprinkles/padding.css.d.ts +0 -2212
  138. package/dist/styles/sprinkles/padding.css.js +0 -39
  139. package/dist/styles/sprinkles/position.css.d.ts +0 -48
  140. package/dist/styles/sprinkles/position.css.js +0 -13
  141. package/dist/styles/sprinkles/size.css.d.ts +0 -43
  142. package/dist/styles/sprinkles/size.css.js +0 -32
  143. package/dist/styles/theme.css.d.ts +0 -62
  144. package/dist/styles/theme.css.js +0 -75
@@ -1,9 +1,11 @@
1
1
  import { V3 } from "../../utils/vector";
2
2
  export default function normal(prop) {
3
- var state = prop.state, perspectiveCamera = prop.controllerContext.perspectiveCamera, activeState = prop.worldContext.activeState;
3
+ var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
4
+ if (!state || !state.camera)
5
+ return;
4
6
  var cameraPosition = activeState.position
5
7
  .clone()
6
- .add(V3(0, perspectiveCamera.YDistance, perspectiveCamera.XZDistance));
8
+ .add(V3(0, cameraOption.YDistance, cameraOption.XZDistance));
7
9
  state.camera.position.lerp(cameraPosition, 0.9);
8
10
  state.camera.lookAt(activeState.position.clone());
9
11
  }
@@ -1,18 +1,17 @@
1
1
  import { quat } from "@react-three/rapier";
2
2
  import { V3 } from "../../utils/vector";
3
3
  export default function orbit(prop) {
4
- var state = prop.state, perspectiveCamera = prop.controllerContext.perspectiveCamera, activeState = prop.worldContext.activeState;
4
+ var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
5
+ if (!state || !state.camera)
6
+ return;
5
7
  var cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 0, Math.cos(activeState.euler.y))
6
8
  .normalize()
7
9
  .clone()
8
- .multiplyScalar(perspectiveCamera.XZDistance)
9
- .multiplyScalar(perspectiveCamera.isFront ? -1 : 1)
10
- .add(V3(0, perspectiveCamera.YDistance, 0)));
11
- state.camera.position.lerp(cameraPosition, 0.9);
10
+ .multiplyScalar(-cameraOption.XZDistance)
11
+ .add(V3(0, cameraOption.YDistance, 0)));
12
+ state.camera.position.lerp(cameraPosition, 1);
12
13
  state.camera.quaternion.copy(activeState.quat
13
14
  .clone()
14
- .multiply(perspectiveCamera.isFront
15
- ? quat().setFromAxisAngle(V3(0, 1, 0), Math.PI)
16
- : quat()));
15
+ .multiply(quat().setFromAxisAngle(V3(0, 1, 0), Math.PI)));
17
16
  state.camera.lookAt(activeState.position.clone());
18
17
  }
@@ -9,24 +9,24 @@ var __assign = (this && this.__assign) || function () {
9
9
  };
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { MapControls, OrbitControls, OrthographicCamera, PerspectiveCamera, } from "@react-three/drei";
12
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
13
+ import { CameraControls } from "@react-three/drei";
14
14
  import { useFrame, useThree } from "@react-three/fiber";
15
- import { useContext, useEffect, useMemo } from "react";
15
+ import { useContext, useEffect, useMemo, useRef } from "react";
16
16
  import * as THREE from "three";
17
17
  import { GaesupControllerContext } from "../controller/context";
18
18
  import { GaesupWorldContext } from "../world/context";
19
- import mapControl from "./control/map";
20
19
  import normal from "./control/normal";
21
20
  import orbit from "./control/orbit";
22
21
  export default function Camera(_a) {
23
22
  var refs = _a.refs, prop = _a.prop, control = _a.control;
24
23
  var worldContext = useContext(GaesupWorldContext);
25
24
  var controllerContext = useContext(GaesupControllerContext);
26
- var cameraMode = controllerContext.cameraMode, perspectiveCamera = controllerContext.perspectiveCamera, orthographicCamera = controllerContext.orthographicCamera;
25
+ var mode = worldContext.mode, activeState = worldContext.activeState;
27
26
  var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef;
28
27
  var scene = useThree().scene;
29
- var activeState = worldContext.activeState;
28
+ var state = useThree();
29
+ var cameraRef = useRef();
30
30
  var intersectObjectMap = useMemo(function () { return ({}); }, []);
31
31
  var cameraProp = __assign(__assign({}, prop), { control: control, controllerContext: controllerContext, worldContext: worldContext, intersectObjectMap: intersectObjectMap });
32
32
  var getMeshs = function (object) {
@@ -49,23 +49,14 @@ export default function Camera(_a) {
49
49
  !outerGroupRef ||
50
50
  !outerGroupRef.current)
51
51
  return null;
52
- cameraProp.state = state;
53
52
  cameraProp.delta = delta;
54
- if (cameraMode.cameraType === "perspective") {
55
- if (cameraMode.controlType === "orbit") {
56
- orbit(cameraProp);
57
- }
58
- else if (cameraMode.controlType === "normal") {
59
- normal(cameraProp);
60
- }
53
+ cameraProp.state = state;
54
+ if (mode.control === "orbit") {
55
+ orbit(cameraProp);
61
56
  }
62
- else if (cameraMode.cameraType === "orthographic") {
63
- mapControl(cameraProp);
57
+ else if (mode.control === "normal") {
58
+ normal(cameraProp);
64
59
  }
65
- // const distV3 = camera.position.clone().sub(activeState.position);
66
- // cameraRay.origin.copy(camera.position);
67
- // cameraRay.dir.copy(distV3.negate().normalize());
68
- // detector(cameraProp);
69
60
  });
70
- return (_jsxs(_Fragment, { children: [cameraMode.cameraType === "perspective" && (_jsxs(_Fragment, { children: [_jsx(OrbitControls, { target: activeState.position }), _jsx(PerspectiveCamera, __assign({ makeDefault: true }, perspectiveCamera))] })), cameraMode.cameraType === "orthographic" && (_jsxs(_Fragment, { children: [_jsx(MapControls, { target: activeState.position }), _jsx(OrthographicCamera, __assign({ makeDefault: true }, orthographicCamera))] }))] }));
61
+ return (_jsx(_Fragment, { children: _jsx(CameraControls, { ref: cameraRef }) }));
71
62
  }
@@ -27,9 +27,11 @@ export function PassiveAirplane(props) {
27
27
  }, [props]), position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation, airplaneUrl = _a.airplaneUrl;
28
28
  useFrame(function () {
29
29
  if (innerGroupRef && innerGroupRef.current) {
30
+ var _euler = euler.clone();
31
+ _euler.y = 0;
30
32
  innerGroupRef.current.setRotationFromQuaternion(quat()
31
33
  .setFromEuler(innerGroupRef.current.rotation.clone())
32
- .slerp(quat().setFromEuler(euler), 0.1));
34
+ .slerp(quat().setFromEuler(_euler), 0.2));
33
35
  }
34
36
  if (rigidBodyRef && rigidBodyRef.current) {
35
37
  rigidBodyRef.current.setGravityScale(props.gravity, false);
@@ -3,5 +3,8 @@ import { RigidBody } from "@react-three/rapier";
3
3
  import { forwardRef } from "react";
4
4
  export var RigidBodyRef = forwardRef(function (_a, ref) {
5
5
  var children = _a.children, position = _a.position, rotation = _a.rotation;
6
- return (_jsx(RigidBody, { colliders: false, ref: ref, position: position, rotation: rotation, userData: { intangible: true }, children: children }));
6
+ var _euler = rotation.clone();
7
+ _euler.x = 0;
8
+ _euler.z = 0;
9
+ return (_jsx(RigidBody, { colliders: false, ref: ref, position: position, rotation: _euler, userData: { intangible: true }, children: children }));
7
10
  });
@@ -1,28 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import { dispatchType } from "../../utils/type";
3
- import { gaesupControllerType, orthographicCameraType, perspectiveCameraType } from "./type";
3
+ import { gaesupControllerType } from "./type";
4
4
  export declare const gaesupControllerDefault: {
5
- cameraMode: perspectiveCameraType | orthographicCameraType;
6
- cameraOption: {
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;
15
- };
16
- perspectiveCamera: {
17
- isFront: boolean;
18
- XZDistance: number;
19
- YDistance: number;
20
- };
21
- orthographicCamera: {
22
- zoom: number;
23
- near: number;
24
- far: number;
25
- };
26
5
  airplane: {
27
6
  angleDelta: import("three").Vector3;
28
7
  maxAngle: import("three").Vector3;
@@ -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,13 @@ 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);
72
+ cameraRay.rayCast = new THREE.Raycaster(cameraRay.origin, cameraRay.dir, 0, -context.cameraOption.maxDistance);
73
73
  var initRefs = useCallback(function (refs) {
74
74
  update({
75
75
  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;
@@ -73,10 +73,6 @@ export type refsType = {
73
73
  characterInnerRef: RefObject<THREE.Group>;
74
74
  };
75
75
  export type gaesupControllerContextPropType = {
76
- cameraMode: gaesupCameraPropType;
77
- cameraOption: cameraOptionType;
78
- perspectiveCamera: perspectiveCameraPropType;
79
- orthographicCamera: OrthographicCameraProps;
80
76
  airplane: airplaneType;
81
77
  vehicle: vehicleType;
82
78
  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,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: {
@@ -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
  }