gaesup-world 0.0.6 → 0.0.62

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 (149) hide show
  1. package/README.md +101 -25
  2. package/dist/examples/select/platform/ControlledInput.js +8 -19
  3. package/dist/examples/select/platform/DynamicPlatforms.js +7 -7
  4. package/dist/examples/select/platform/FloatMove.js +8 -8
  5. package/dist/examples/select/platform/RoughPlane.js +3 -3
  6. package/dist/examples/select/platform/Slopes.js +6 -8
  7. package/dist/examples/select/platform/style.css.js +1 -1
  8. package/dist/examples/select/src/index.js +44 -66
  9. package/dist/examples/select/src/keyboardMap/character.js +2 -2
  10. package/dist/examples/select/src/keyboardMap/vehicle.js +1 -1
  11. package/dist/examples/select/src/style.css.js +5 -5
  12. package/dist/src/gaesup/animation/actions.js +29 -42
  13. package/dist/src/gaesup/animation/index.d.ts +1 -1
  14. package/dist/src/gaesup/animation/index.js +1 -1
  15. package/dist/src/gaesup/camera/cameraCollisionDetecter.js +2 -2
  16. package/dist/src/gaesup/camera/control/map.js +2 -2
  17. package/dist/src/gaesup/camera/control/normal.js +2 -2
  18. package/dist/src/gaesup/camera/control/orbit.js +2 -2
  19. package/dist/src/gaesup/camera/index.js +19 -28
  20. package/dist/src/gaesup/component/Airplane.js +2 -3
  21. package/dist/src/gaesup/component/Character.js +2 -3
  22. package/dist/src/gaesup/component/Vehicle.js +2 -3
  23. package/dist/src/gaesup/component/gltf/AirplaneGltf.js +4 -4
  24. package/dist/src/gaesup/component/gltf/CharacterGltf.js +10 -22
  25. package/dist/src/gaesup/component/gltf/VehicleGltf.js +4 -4
  26. package/dist/src/gaesup/component/gltf/WheelJoint.js +10 -11
  27. package/dist/src/gaesup/component/gltf/index.d.ts +4 -4
  28. package/dist/src/gaesup/component/gltf/index.js +4 -4
  29. package/dist/src/gaesup/component/index.d.ts +4 -4
  30. package/dist/src/gaesup/component/index.js +4 -4
  31. package/dist/src/gaesup/component/ref/airplane.js +12 -26
  32. package/dist/src/gaesup/component/ref/character.js +12 -27
  33. package/dist/src/gaesup/component/ref/index.d.ts +3 -3
  34. package/dist/src/gaesup/component/ref/index.js +3 -3
  35. package/dist/src/gaesup/component/ref/vehicle.js +10 -24
  36. package/dist/src/gaesup/component/setInit.js +2 -2
  37. package/dist/src/gaesup/controller/context/index.js +3 -14
  38. package/dist/src/gaesup/controller/context/reducer.js +2 -13
  39. package/dist/src/gaesup/controller/index.js +23 -34
  40. package/dist/src/gaesup/gaesupProps/index.js +15 -36
  41. package/dist/src/gaesup/index.d.ts +7 -7
  42. package/dist/src/gaesup/index.js +7 -7
  43. package/dist/src/gaesup/initial/callback/index.js +16 -26
  44. package/dist/src/gaesup/initial/controller/index.js +22 -34
  45. package/dist/src/gaesup/initial/controller/initDebug.js +2 -13
  46. package/dist/src/gaesup/initial/gaesupWorld/collider/airplane.js +4 -5
  47. package/dist/src/gaesup/initial/gaesupWorld/collider/character.js +13 -14
  48. package/dist/src/gaesup/initial/gaesupWorld/collider/gltf.js +16 -17
  49. package/dist/src/gaesup/initial/gaesupWorld/collider/index.js +4 -4
  50. package/dist/src/gaesup/initial/gaesupWorld/collider/vehicle.js +4 -5
  51. package/dist/src/gaesup/initial/gaesupWorld/index.js +8 -19
  52. package/dist/src/gaesup/physics/airplane/currentSetting.js +2 -13
  53. package/dist/src/gaesup/physics/airplane/damping.js +1 -1
  54. package/dist/src/gaesup/physics/airplane/direction.js +16 -16
  55. package/dist/src/gaesup/physics/airplane/gravity.js +1 -1
  56. package/dist/src/gaesup/physics/airplane/impulse.js +4 -4
  57. package/dist/src/gaesup/physics/airplane/turn.js +1 -1
  58. package/dist/src/gaesup/physics/character/accelaration.js +4 -4
  59. package/dist/src/gaesup/physics/character/currentSetting.js +2 -13
  60. package/dist/src/gaesup/physics/character/damping.js +1 -1
  61. package/dist/src/gaesup/physics/character/direction.js +11 -13
  62. package/dist/src/gaesup/physics/character/impulse.js +5 -5
  63. package/dist/src/gaesup/physics/character/jump.js +3 -3
  64. package/dist/src/gaesup/physics/character/stabilizing.js +1 -1
  65. package/dist/src/gaesup/physics/character/turn.js +2 -2
  66. package/dist/src/gaesup/physics/check/ground.js +1 -1
  67. package/dist/src/gaesup/physics/check/moving.js +2 -2
  68. package/dist/src/gaesup/physics/check/rotate.js +1 -1
  69. package/dist/src/gaesup/physics/check/slope.js +3 -3
  70. package/dist/src/gaesup/physics/index.js +13 -19
  71. package/dist/src/gaesup/physics/vehicle/currentSetting.js +2 -13
  72. package/dist/src/gaesup/physics/vehicle/damping.js +3 -3
  73. package/dist/src/gaesup/physics/vehicle/direction.js +6 -6
  74. package/dist/src/gaesup/physics/vehicle/impulse.js +7 -7
  75. package/dist/src/gaesup/physics/vehicle/turn.js +1 -1
  76. package/dist/src/gaesup/styles.css.js +2 -2
  77. package/dist/src/gaesup/tools/context.js +2 -2
  78. package/dist/src/gaesup/tools/gameboy/GameBoyButton.js +8 -9
  79. package/dist/src/gaesup/tools/gameboy/default.js +1 -1
  80. package/dist/src/gaesup/tools/gameboy/index.js +3 -3
  81. package/dist/src/gaesup/tools/gameboy/style.css.js +3 -3
  82. package/dist/src/gaesup/tools/gamepad/GamePadButton.js +8 -9
  83. package/dist/src/gaesup/tools/gamepad/default.js +1 -1
  84. package/dist/src/gaesup/tools/gamepad/index.js +8 -10
  85. package/dist/src/gaesup/tools/gamepad/style.css.js +3 -3
  86. package/dist/src/gaesup/tools/index.js +7 -8
  87. package/dist/src/gaesup/tools/joystick/default.js +15 -26
  88. package/dist/src/gaesup/tools/joystick/index.js +108 -107
  89. package/dist/src/gaesup/tools/joystick/style.css.js +5 -5
  90. package/dist/src/gaesup/tools/jumpPoint/index.js +3 -3
  91. package/dist/src/gaesup/tools/jumpPoint/style.css.js +2 -2
  92. package/dist/src/gaesup/tools/keyBoardToolTip/constant.js +8 -19
  93. package/dist/src/gaesup/tools/keyBoardToolTip/default.js +2 -2
  94. package/dist/src/gaesup/tools/keyBoardToolTip/index.js +22 -33
  95. package/dist/src/gaesup/tools/keyBoardToolTip/style.css.js +3 -3
  96. package/dist/src/gaesup/tools/minimap/default.js +2 -2
  97. package/dist/src/gaesup/tools/minimap/index.js +18 -29
  98. package/dist/src/gaesup/tools/minimap/style.css.js +12 -12
  99. package/dist/src/gaesup/tools/pushKey/index.js +5 -16
  100. package/dist/src/gaesup/tools/reducer.js +2 -13
  101. package/dist/src/gaesup/tools/style.css.js +3 -3
  102. package/dist/src/gaesup/utils/constant.js +1 -1
  103. package/dist/src/gaesup/utils/ray.js +2 -3
  104. package/dist/src/gaesup/utils/ref.js +3 -4
  105. package/dist/src/gaesup/world/context/index.js +4 -4
  106. package/dist/src/gaesup/world/context/reducer.js +2 -13
  107. package/dist/src/gaesup/world/index.js +1 -1
  108. package/dist/src/index.d.ts +1 -1
  109. package/dist/src/index.js +1 -1
  110. package/dist/src/styles/constants/boxshadow.css.js +2 -2
  111. package/dist/src/styles/constants/constant.css.js +6 -6
  112. package/dist/src/styles/constants/direction.css.js +3 -3
  113. package/dist/src/styles/constants/flex.css.js +6 -6
  114. package/dist/src/styles/constants/gradient.css.js +1 -1
  115. package/dist/src/styles/constants/grid.css.js +4 -15
  116. package/dist/src/styles/constants/palette.css.js +26 -26
  117. package/dist/src/styles/constants/translate.css.js +4 -15
  118. package/dist/src/styles/recipe/base.css.js +6 -6
  119. package/dist/src/styles/recipe/button.css.js +4 -4
  120. package/dist/src/styles/recipe/index.css.js +20 -31
  121. package/dist/src/styles/recipe/input.css.js +1 -1
  122. package/dist/src/styles/sprinkles/color.css.js +4 -15
  123. package/dist/src/styles/sprinkles/direction.css.js +2 -13
  124. package/dist/src/styles/sprinkles/display.css.js +1 -1
  125. package/dist/src/styles/sprinkles/fontSize.css.js +2 -13
  126. package/dist/src/styles/sprinkles/grid.css.js +1 -1
  127. package/dist/src/styles/sprinkles/index.css.js +1 -1
  128. package/dist/src/styles/sprinkles/margin.css.js +2 -13
  129. package/dist/src/styles/sprinkles/padding.css.js +2 -13
  130. package/dist/src/styles/sprinkles/position.css.js +1 -1
  131. package/dist/src/styles/sprinkles/size.css.js +2 -13
  132. package/dist/src/styles/theme.css.js +4 -15
  133. package/index.ts +7 -0
  134. package/package.json +1 -1
  135. package/src/gaesup/animation/index.ts +1 -1
  136. package/src/gaesup/component/gltf/index.ts +4 -4
  137. package/src/gaesup/component/gltf/type.ts +1 -1
  138. package/src/gaesup/component/index.ts +4 -4
  139. package/src/gaesup/component/ref/index.ts +8 -3
  140. package/src/gaesup/index.ts +7 -7
  141. package/src/gaesup/initial/gaesupWorld/collider/gltf.ts +8 -2
  142. package/src/gaesup/tools/gamepad/index.tsx +1 -1
  143. package/src/gaesup/tools/joystick/index.tsx +358 -129
  144. package/src/gaesup/tools/joystick/style.css.ts +2 -2
  145. package/src/gaesup/world/context/index.ts +8 -8
  146. package/src/gaesup/world/context/type.ts +1 -1
  147. package/src/index.ts +7 -1
  148. package/tsconfig.json +2 -2
  149. package/index.html +0 -14
package/README.md CHANGED
@@ -2,50 +2,126 @@
2
2
 
3
3
  Web 3D Character Controller and World Platform Library
4
4
 
5
- [![npm (tag)](https://img.shields.io/npm/v/leva?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/leva)
5
+ [![Version](https://img.shields.io/npm/v/gaesup-world?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/zustand)
6
+ [![Downloads](https://img.shields.io/npm/dt/gaesup-world.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/gaesup-world)
6
7
 
7
- @react-three/fiber
8
- @react-three/drei
9
- three @types/three
10
- @react-three/rapier
8
+ ---
11
9
 
12
- Gaesup World는 @react/three-fiber, @react/three-drei, rapier 를 사용하여 웹 3D 환경에서 캐릭터, 비행기, 자동자 등의 컨트롤 도구를 제공하는 라이브러리입니다.
10
+ ## introduction
13
11
 
14
- 이 컨트롤러는 캐릭터의 움직임, 애니메이션, 상호작용을 쉽게 관리할 수 있도록 설계되었습니다. 가상의 세계에서 캐릭터를 움직이거나 탈것을 쉽게 활용할 수 있고, 미니맵이나 조이스틱 등의 유틸 등도 설계되어 있습니다
12
+ Gaesup World is a library that uses @react/three-fiber, @react/three-drei, and rapier to provide control tools for characters, airplanes, cars, and more in a web 3D environment. This controller is designed to easily manage character movement, animation, and interaction. It allows for easy manipulation of characters or vehicles in a virtual world, and is also equipped with utilities like minimaps and joysticks.
15
13
 
16
- ## 특징
14
+ ### Features
17
15
 
18
- - React Three Fiber를 기반으로 하는 3D 캐릭터 컨트롤
19
- - 간단한 API를 통한 캐릭터 움직임 및 애니메이션 제어
20
- - 확장 가능한 구조로 다양한 커스터마이징 지원
21
- - 가벼운 라이브러리로 빠른 로딩 및 성능 최적화
16
+ - 3D character control based on React Three Fiber.
17
+ - Simple API for controlling character movement and animation.
18
+ - Extensible structure for various customizations.
19
+ - Lightweight library for fast loading and performance optimization.
22
20
 
23
- ## 설치 방법
21
+ ### Installation
24
22
 
25
23
  ```bash
26
24
  npm install @react-three/fiber @react-three/drei three @types/three @react-three/rapier gaesup-world
27
25
  ```
28
26
 
29
- 또는
27
+ Or
30
28
 
31
29
  ```bash
32
30
  yarn add @react-three/fiber @react-three/drei three @types/three @react-three/rapier gaesup-world
33
31
  ```
34
32
 
35
- ## 문서
33
+ ### Documentation
36
34
 
37
- 더 자세한 사용 방법 및 API 문서는 [여기](#)를 참조하세요.
35
+ it is detailed usage methods and API documentation
38
36
 
39
- ## 기여 방법
37
+ - [how to contribute](#how-to-contribute)
40
38
 
41
- 이 프로젝트에 기여하고 싶으시다면, 다음 단계를 따라주세요:
39
+ ### How to Contribute
42
40
 
43
- 1. 프로젝트를 Fork합니다.
44
- 2. 새로운 Feature 브랜치를 생성합니다 (`git checkout -b feature/AmazingFeature`).
45
- 3. 변경사항을 Commit합니다 (`git commit -m 'Add some AmazingFeature'`).
46
- 4. 브랜치에 Push합니다 (`git push origin feature/AmazingFeature`).
47
- 5. Pull Request를 생성합니다.
41
+ If you would like to contribute to this project, please follow these steps:
48
42
 
49
- ## 라이센스
43
+ 1. Fork the project.
44
+ 2. Create a new Feature branch (`git checkout -b feature/AmazingFeature`).
45
+ 3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
46
+ 4. Push to the branch (`git push origin feature/AmazingFeature`).
47
+ 5. Create a Pull Request.
50
48
 
51
- 이 프로젝트는 [MIT 라이센스](LICENSE) 하에 배포됩니다.
49
+ ### License
50
+
51
+ This project is distributed under the MIT License.
52
+
53
+ ---
54
+
55
+ ## Controller
56
+
57
+ #### [Controller](#controller)
58
+
59
+ - [Character](#character)
60
+ - [Vehicle](#vehicle)
61
+ - [Airplane](#airplane)
62
+
63
+ ## Character
64
+
65
+ This is the character control in Gaesup World.
66
+
67
+ - Possible Camera Types
68
+
69
+ | Name | Camera | Control | Info |
70
+ | ------ | ------------------- | ------------- | --------------------------------------------------------------------------------------------- |
71
+ | Normal | Perspective Camera | Orbit Control | Positioned parallel to the Z-axis from the character's location and not affected by rotation. |
72
+ | Orbit | Perspective Camera | Orbit Control | Moves with the character and rotates according to the character's direction. |
73
+ | Map | Orthographic Camera | Map Control | A top-down control view. |
74
+
75
+ - Controller Tools
76
+
77
+ | Name | Info |
78
+ | -------- | ----------------------------------------------------------------------- |
79
+ | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
80
+ | Joystick | A joystick implementation tool. It works on mobile devices. |
81
+ | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
82
+
83
+ ## Vehicle
84
+
85
+ This is the vehicle control in Gaesup World. Characters can board the vehicle.
86
+
87
+ - Possible Camera Types
88
+
89
+ | Name | Camera | Control | Info |
90
+ | ------ | ------------------- | ------------- | --------------------------------------------------------------------------------------------- |
91
+ | Normal | Perspective Camera | Orbit Control | Positioned parallel to the Z-axis from the character's location and not affected by rotation. |
92
+ | Orbit | Perspective Camera | Orbit Control | Moves with the character and rotates according to the character's direction. |
93
+ | Map | Orthographic Camera | Map Control | A top-down control view. |
94
+
95
+ - Controller Tools
96
+
97
+ | Name | Info |
98
+ | -------- | ----------------------------------------------------------------------- |
99
+ | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
100
+ | Joystick | A joystick implementation tool. It works on mobile devices. |
101
+ | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
102
+
103
+ ## Airplane
104
+
105
+ This is the airplane control in Gaesup World. Characters can board the airplane.
106
+
107
+ - Possible Camera Types
108
+
109
+ | Name | Camera | Control | Info |
110
+ | ------ | ------------------- | ------------- | --------------------------------------------------------------------------------------------- |
111
+ | Normal | Perspective Camera | Orbit Control | Positioned parallel to the Z-axis from the character's location and not affected by rotation. |
112
+ | Orbit | Perspective Camera | Orbit Control | Moves with the character and rotates according to the character's direction. |
113
+ | Map | Orthographic Camera | Map Control | A top-down control view. |
114
+
115
+ - Controller Tools
116
+
117
+ | Name | Info |
118
+ | -------- | ----------------------------------------------------------------------- |
119
+ | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
120
+ | Joystick | A joystick implementation tool. It works on mobile devices. |
121
+ | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
122
+
123
+ ---
124
+
125
+ ## Tools
126
+
127
+ #### [Tools](#tools)
@@ -1,14 +1,3 @@
1
- var __assign = (this && this.__assign) || function () {
2
- __assign = Object.assign || function(t) {
3
- for (var s, i = 1, n = arguments.length; i < n; i++) {
4
- s = arguments[i];
5
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
- t[p] = s[p];
7
- }
8
- return t;
9
- };
10
- return __assign.apply(this, arguments);
11
- };
12
1
  var __rest = (this && this.__rest) || function (s, e) {
13
2
  var t = {};
14
3
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -23,18 +12,18 @@ var __rest = (this && this.__rest) || function (s, e) {
23
12
  import { jsx as _jsx } from "react/jsx-runtime";
24
13
  import { useEffect, useRef, useState } from "react";
25
14
  import * as style from "./style.css";
26
- export var ControlledInput = function (props) {
27
- var value = props.value, onChange = props.onChange, rest = __rest(props, ["value", "onChange"]);
28
- var _a = useState(null), cursor = _a[0], setCursor = _a[1];
29
- var ref = useRef(null);
30
- useEffect(function () {
31
- var input = ref.current;
15
+ export const ControlledInput = (props) => {
16
+ const { value, onChange } = props, rest = __rest(props, ["value", "onChange"]);
17
+ const [cursor, setCursor] = useState(null);
18
+ const ref = useRef(null);
19
+ useEffect(() => {
20
+ const input = ref.current;
32
21
  if (input)
33
22
  input.setSelectionRange(cursor, cursor);
34
23
  }, [ref, cursor, value]);
35
- var handleChange = function (e) {
24
+ const handleChange = (e) => {
36
25
  setCursor(e.target.selectionStart);
37
26
  onChange && onChange(e);
38
27
  };
39
- return (_jsx("input", __assign({ ref: ref, value: value, onChange: handleChange }, rest, { className: style.input })));
28
+ return (_jsx("input", Object.assign({ ref: ref, value: value, onChange: handleChange }, rest, { className: style.input })));
40
29
  };
@@ -7,12 +7,12 @@ import { useMemo, useRef } from "react";
7
7
  import GaeSupProps from "../../../src/gaesup/gaesupProps";
8
8
  import { Qt, V3 } from "../../../src/gaesup/utils/vector";
9
9
  export default function DynamicPlatforms() {
10
- var sideMovePlatformRef = useRef(null);
11
- var verticalMovePlatformRef = useRef(null);
12
- var rotatePlatformRef = useRef(null);
13
- var rotationDrumRef = useRef(null);
10
+ const sideMovePlatformRef = useRef(null);
11
+ const verticalMovePlatformRef = useRef(null);
12
+ const rotatePlatformRef = useRef(null);
13
+ const rotationDrumRef = useRef(null);
14
14
  // Initializ animation settings
15
- var dynamic = useMemo(function () {
15
+ const dynamic = useMemo(() => {
16
16
  return {
17
17
  time: null,
18
18
  X: V3(1, 0, 0),
@@ -20,10 +20,10 @@ export default function DynamicPlatforms() {
20
20
  Qt: Qt(),
21
21
  };
22
22
  }, []);
23
- useFrame(function (state) {
23
+ useFrame((state) => {
24
24
  var _a, _b, _c, _d, _e;
25
25
  dynamic.time = state.clock.elapsedTime;
26
- var time = dynamic.time, Qt = dynamic.Qt, X = dynamic.X, Y = dynamic.Y;
26
+ const { time, Qt, X, Y } = dynamic;
27
27
  if (dynamic.time) {
28
28
  // Move platform
29
29
  (_a = sideMovePlatformRef.current) === null || _a === void 0 ? void 0 : _a.setNextKinematicTranslation({
@@ -5,10 +5,10 @@ import { useEffect, useMemo, useRef } from "react";
5
5
  import GaeSupProps from "../../../src/gaesup/gaesupProps";
6
6
  export default function FloatMove() {
7
7
  // Preset
8
- var cuboidColliderRef = useRef(null);
9
- var rigidBodyRef = useRef(null);
10
- var _a = useRapier(), rapier = _a.rapier, world = _a.world;
11
- var ray = useMemo(function () {
8
+ const cuboidColliderRef = useRef(null);
9
+ const rigidBodyRef = useRef(null);
10
+ const { rapier, world } = useRapier();
11
+ const ray = useMemo(() => {
12
12
  return {
13
13
  origin: vec3(),
14
14
  dir: vec3({ x: 0, y: -1, z: 0 }),
@@ -22,14 +22,14 @@ export default function FloatMove() {
22
22
  };
23
23
  }, []);
24
24
  ray.rayCast = new rapier.Ray(ray.origin, ray.dir);
25
- var movingDir = 1;
26
- useEffect(function () {
25
+ let movingDir = 1;
26
+ useEffect(() => {
27
27
  if (rigidBodyRef.current) {
28
28
  rigidBodyRef.current.setEnabledRotations(false, true, false, false);
29
29
  rigidBodyRef.current.setEnabledTranslations(true, true, false, false);
30
30
  }
31
31
  }, []);
32
- useFrame(function () {
32
+ useFrame(() => {
33
33
  // Ray cast for moving platform
34
34
  if (rigidBodyRef.current && ray.rayCast && cuboidColliderRef.current) {
35
35
  ray.origin.set(rigidBodyRef.current.translation().x, rigidBodyRef.current.translation().y, rigidBodyRef.current.translation().z);
@@ -51,7 +51,7 @@ export default function FloatMove() {
51
51
  // Ray for moving platform
52
52
  if (ray.hit && rigidBodyRef.current) {
53
53
  if (ray.hit.collider.parent()) {
54
- var floatingForceMove = 2.5 * (0.8 - ray.hit.toi) - rigidBodyRef.current.linvel().y * 0.15;
54
+ const floatingForceMove = 2.5 * (0.8 - ray.hit.toi) - rigidBodyRef.current.linvel().y * 0.15;
55
55
  rigidBodyRef.current.applyImpulse(vec3().set(0, floatingForceMove, 0), true);
56
56
  }
57
57
  }
@@ -7,9 +7,9 @@ import * as THREE from "three";
7
7
  import GaeSupProps from "../../../src/gaesup/gaesupProps";
8
8
  import { S3 } from "../../../src/gaesup/utils/constant";
9
9
  export default function RoughPlane() {
10
- var roughPlane = useGLTF(S3 + "/roughPlane.glb");
11
- useEffect(function () {
12
- roughPlane.scene.traverse(function (child) {
10
+ const roughPlane = useGLTF(S3 + "/roughPlane.glb");
11
+ useEffect(() => {
12
+ roughPlane.scene.traverse((child) => {
13
13
  if (child instanceof THREE.Mesh &&
14
14
  child.material instanceof THREE.MeshStandardMaterial) {
15
15
  child.receiveShadow = true;
@@ -9,19 +9,17 @@ import { S3 } from "../../../src/gaesup/utils/constant";
9
9
  import { ControlledInput } from "./ControlledInput";
10
10
  export default function Slopes() {
11
11
  // Load models
12
- var slopes = useGLTF(S3 + "/slopes.glb");
13
- var _a = useState(25), angle = _a[0], setAngle = _a[1];
14
- var rigidBodyRef = useRef(null);
15
- useEffect(function () {
12
+ const slopes = useGLTF(S3 + "/slopes.glb");
13
+ const [angle, setAngle] = useState(25);
14
+ const rigidBodyRef = useRef(null);
15
+ useEffect(() => {
16
16
  // Receive Shadows
17
- slopes.scene.traverse(function (child) {
17
+ slopes.scene.traverse((child) => {
18
18
  if (child instanceof THREE.Mesh &&
19
19
  child.material instanceof THREE.MeshStandardMaterial) {
20
20
  child.receiveShadow = true;
21
21
  }
22
22
  });
23
23
  }, []);
24
- return (_jsxs(GaeSupProps, { text: "Slopes", jumpPoint: true, position: [-15, -0.8, 15], children: [_jsx(RigidBody, { type: "fixed", colliders: "hull", ref: rigidBodyRef, rotation: [-(angle * Math.PI) / 180, 0, 0], children: _jsxs("mesh", { receiveShadow: true, castShadow: true, children: [_jsx("boxGeometry", { args: [10, 1, 10] }), _jsx("meshBasicMaterial", { transparent: true, opacity: 0.9 })] }) }), _jsx(Html, { zIndexRange: [1, 0], children: _jsx(ControlledInput, { type: angle, onChange: function (e) {
25
- return setAngle(e.target.value);
26
- }, value: angle }) })] }));
24
+ return (_jsxs(GaeSupProps, { text: "Slopes", jumpPoint: true, position: [-15, -0.8, 15], children: [_jsx(RigidBody, { type: "fixed", colliders: "hull", ref: rigidBodyRef, rotation: [-(angle * Math.PI) / 180, 0, 0], children: _jsxs("mesh", { receiveShadow: true, castShadow: true, children: [_jsx("boxGeometry", { args: [10, 1, 10] }), _jsx("meshBasicMaterial", { transparent: true, opacity: 0.9 })] }) }), _jsx(Html, { zIndexRange: [1, 0], children: _jsx(ControlledInput, { type: angle, onChange: (e) => setAngle(e.target.value), value: angle }) })] }));
27
25
  }
@@ -1,5 +1,5 @@
1
1
  import { style } from "@vanilla-extract/css";
2
- export var input = style([
2
+ export const input = style([
3
3
  {
4
4
  width: "20rem",
5
5
  borderRadius: "1rem",
@@ -1,15 +1,4 @@
1
1
  "use client";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
3
  import { Environment, KeyboardControls } from "@react-three/drei";
15
4
  import { Canvas } from "@react-three/fiber";
@@ -26,7 +15,7 @@ import RigidObjects from "../platform/RigidObjects";
26
15
  import RoughPlane from "../platform/RoughPlane";
27
16
  import * as style from "./style.css";
28
17
  import { button } from "./style.css";
29
- export var keyboardMap = [
18
+ export const keyboardMap = [
30
19
  { name: "forward", keys: ["ArrowUp", "KeyW"] },
31
20
  { name: "backward", keys: ["ArrowDown", "KeyS"] },
32
21
  { name: "leftward", keys: ["ArrowLeft", "KeyA"] },
@@ -36,92 +25,81 @@ export var keyboardMap = [
36
25
  { name: "keyZ", keys: ["KeyZ"] },
37
26
  ];
38
27
  export default function Selected() {
39
- var CHARACTER_URL = "./gaesupyee.glb";
40
- var AIRPLANE_URL = "./airplane.glb";
41
- var VEHICLE_URL = S3 + "/kart2.glb";
42
- var _a = useState({
28
+ const CHARACTER_URL = "./gaesupyee.glb";
29
+ const AIRPLANE_URL = "./airplane.glb";
30
+ const VEHICLE_URL = S3 + "/kart2.glb";
31
+ const [mode, changeMode] = useState({
43
32
  type: "character",
44
33
  controller: isMobile ? "joystick" : "joystick",
45
- }), mode = _a[0], changeMode = _a[1];
46
- var _b = useState({
34
+ });
35
+ const [camera, changeCamera] = useState({
47
36
  cameraType: "perspective",
48
37
  controlType: "orbit",
49
- }), camera = _b[0], changeCamera = _b[1];
50
- return (_jsxs(GaesupWorld, { debug: true, mode: __assign({}, mode), url: {
38
+ });
39
+ return (_jsxs(GaesupWorld, { debug: true, mode: Object.assign({}, mode), url: {
51
40
  characterUrl: CHARACTER_URL,
52
41
  vehicleUrl: VEHICLE_URL,
53
42
  airplaneUrl: AIRPLANE_URL,
54
43
  }, children: [_jsx(GaeSupTools, {}), _jsxs("div", { className: style.mainButtonContainer, children: [_jsx("button", { className: button({
55
44
  selected: mode.type === "character",
56
- }), onClick: function () {
57
- return changeMode(function (mode) { return ({
58
- type: "character",
59
- controller: mode.controller,
60
- }); });
61
- }, children: "CHARACTER" }), _jsx("button", { className: button({
45
+ }), onClick: () => changeMode((mode) => ({
46
+ type: "character",
47
+ controller: mode.controller,
48
+ })), children: "CHARACTER" }), _jsx("button", { className: button({
62
49
  selected: mode.type === "vehicle",
63
- }), onClick: function () {
64
- return changeMode(function (mode) { return ({
65
- type: "vehicle",
66
- controller: mode.controller,
67
- }); });
68
- }, children: "VEHICLE" }), _jsx("button", { className: button({
50
+ }), onClick: () => changeMode((mode) => ({
51
+ type: "vehicle",
52
+ controller: mode.controller,
53
+ })), children: "VEHICLE" }), _jsx("button", { className: button({
69
54
  selected: mode.type === "airplane",
70
- }), onClick: function () {
71
- return changeMode(function (mode) { return ({
72
- type: "airplane",
73
- controller: mode.controller,
74
- }); });
75
- }, children: "AIRPLANE" }), _jsx("button", { className: button({
55
+ }), onClick: () => changeMode((mode) => ({
56
+ type: "airplane",
57
+ controller: mode.controller,
58
+ })), children: "AIRPLANE" }), _jsx("button", { className: button({
76
59
  selected: camera.controlType === "normal",
77
- }), onClick: function () {
78
- return changeCamera(function () { return ({
79
- cameraType: "perspective",
80
- controlType: "normal",
81
- }); });
82
- }, children: "NORMAL" }), _jsx("button", { className: button({
60
+ }), onClick: () => changeCamera(() => ({
61
+ cameraType: "perspective",
62
+ controlType: "normal",
63
+ })), children: "NORMAL" }), _jsx("button", { className: button({
83
64
  selected: camera.controlType === "orbit" &&
84
65
  camera.cameraType === "perspective",
85
- }), onClick: function () {
86
- return changeCamera(function () { return ({
87
- cameraType: "perspective",
88
- controlType: "orbit",
89
- }); });
90
- }, children: "ORBIT" }), _jsx("button", { className: button({
66
+ }), onClick: () => changeCamera(() => ({
67
+ cameraType: "perspective",
68
+ controlType: "orbit",
69
+ })), children: "ORBIT" }), _jsx("button", { className: button({
91
70
  selected: camera.cameraType === "orthographic",
92
- }), onClick: function () {
93
- changeCamera(function () { return ({
71
+ }), onClick: () => {
72
+ changeCamera(() => ({
94
73
  cameraType: "orthographic",
95
74
  controlType: "orbit",
96
- }); });
75
+ }));
97
76
  }, children: "MAP" }), !isMobile && (_jsx("button", { className: button({
98
77
  selected: mode.controller === "keyboard",
99
- }), onClick: function () {
100
- changeMode(function (mode) { return ({
78
+ }), onClick: () => {
79
+ changeMode((mode) => ({
101
80
  type: mode.type,
102
81
  controller: "keyboard",
103
- }); });
82
+ }));
104
83
  }, children: "\uD0A4\uBCF4\uB4DC" })), _jsx("button", { className: button({
105
84
  selected: mode.controller === "joystick",
106
- }), onClick: function () {
107
- changeMode(function (mode) { return ({
85
+ }), onClick: () => {
86
+ changeMode((mode) => ({
108
87
  type: mode.type,
109
88
  controller: "joystick",
110
- }); });
89
+ }));
111
90
  }, children: "\uC870\uC774\uC2A4\uD2F1" }), _jsx("button", { className: button({
112
91
  selected: mode.controller === "gameboy",
113
- }), onClick: function () {
114
- changeMode(function (mode) { return ({
92
+ }), onClick: () => {
93
+ changeMode((mode) => ({
115
94
  type: mode.type,
116
95
  controller: "gameboy",
117
- }); });
118
- }, children: "\uAC8C\uC784\uBCF4\uC774" })] }), _jsxs(Canvas, { shadows: true, dpr: [1, 2], style: { width: "100dvw", height: "100dvh" }, children: [_jsx(Environment, { background: true, preset: "sunset", blur: 0.8 }), _jsx("directionalLight", { castShadow: true, "shadow-normalBias": 0.06, position: [20, 30, 10], intensity: 0.5, "shadow-mapSize": [1024, 1024], "shadow-camera-near": 1, "shadow-camera-far": 50, "shadow-camera-top": 50, "shadow-camera-right": 50, "shadow-camera-bottom": -50, "shadow-camera-left": -50 }), _jsx("ambientLight", { intensity: 0.5 }), _jsxs(Physics, { debug: true, children: [_jsx(KeyboardControls, { map: keyboardMap, children: _jsx(GaesupController, { isRider: mode.type === "vehicle" ? true : false, cameraMode: __assign({}, camera), orthographicCamera: {
96
+ }));
97
+ }, children: "\uAC8C\uC784\uBCF4\uC774" })] }), _jsxs(Canvas, { shadows: true, dpr: [1, 2], style: { width: "100dvw", height: "100dvh" }, children: [_jsx(Environment, { background: true, preset: "sunset", blur: 0.8 }), _jsx("directionalLight", { castShadow: true, "shadow-normalBias": 0.06, position: [20, 30, 10], intensity: 0.5, "shadow-mapSize": [1024, 1024], "shadow-camera-near": 1, "shadow-camera-far": 50, "shadow-camera-top": 50, "shadow-camera-right": 50, "shadow-camera-bottom": -50, "shadow-camera-left": -50 }), _jsx("ambientLight", { intensity: 0.5 }), _jsxs(Physics, { debug: true, children: [_jsx(KeyboardControls, { map: keyboardMap, children: _jsx(GaesupController, { isRider: mode.type === "vehicle" ? true : false, cameraMode: Object.assign({}, camera), orthographicCamera: {
119
98
  zoom: 80,
120
99
  }, groupProps: {
121
100
  rotation: [0, Math.PI, 0],
122
- }, onAnimate: function (_a) {
123
- var control = _a.control, states = _a.states, playAnimation = _a.playAnimation;
124
- var keyZ = control.keyZ;
101
+ }, onAnimate: ({ control, states, playAnimation }) => {
102
+ const { keyZ } = control;
125
103
  if (keyZ) {
126
104
  states.isAnimationOuter = true;
127
105
  playAnimation("greet");
@@ -1,4 +1,4 @@
1
- export var characterKeyboardMap = [
1
+ export const characterKeyboardMap = [
2
2
  { name: "forward", keys: ["ArrowUp", "KeyW"] },
3
3
  { name: "backward", keys: ["ArrowDown", "KeyS"] },
4
4
  { name: "leftward", keys: ["ArrowLeft", "KeyA"] },
@@ -7,7 +7,7 @@ export var characterKeyboardMap = [
7
7
  { name: "run", keys: ["Shift"] },
8
8
  { name: "greet", keys: ["KeyZ"] },
9
9
  ];
10
- export var vehicleKeyboardMap = [
10
+ export const vehicleKeyboardMap = [
11
11
  { name: "forward", keys: ["ArrowUp", "KeyW"] },
12
12
  { name: "backward", keys: ["ArrowDown", "KeyS"] },
13
13
  { name: "leftward", keys: ["ArrowLeft", "KeyA"] },
@@ -1,4 +1,4 @@
1
- export var vehicleKeyboardMap = [
1
+ export const vehicleKeyboardMap = [
2
2
  { name: "forward", keys: ["ArrowUp", "KeyW"] },
3
3
  { name: "backward", keys: ["ArrowDown", "KeyS"] },
4
4
  { name: "leftward", keys: ["ArrowLeft", "KeyA"] },
@@ -1,13 +1,13 @@
1
1
  import { fontFace, style } from "@vanilla-extract/css";
2
2
  import { recipe } from "@vanilla-extract/recipes";
3
3
  import { vars } from "../../../src/styles/theme.css";
4
- var BlackHanSans = fontFace({
4
+ const BlackHanSans = fontFace({
5
5
  src: 'local("/public/fonts/BlackHanSans-Regular.ttf")',
6
6
  });
7
- export var blackHanSans = style({
7
+ export const blackHanSans = style({
8
8
  fontFamily: BlackHanSans,
9
9
  });
10
- export var main = style([
10
+ export const main = style([
11
11
  {
12
12
  display: "flex",
13
13
  flexDirection: "column",
@@ -18,7 +18,7 @@ export var main = style([
18
18
  fontFamily: blackHanSans,
19
19
  },
20
20
  ]);
21
- export var mainButtonContainer = style([
21
+ export const mainButtonContainer = style([
22
22
  {
23
23
  position: "fixed",
24
24
  zIndex: 100,
@@ -30,7 +30,7 @@ export var mainButtonContainer = style([
30
30
  gridTemplateRows: "repeat(3, 1fr)",
31
31
  },
32
32
  ]);
33
- export var button = recipe({
33
+ export const button = recipe({
34
34
  base: [
35
35
  {
36
36
  boxSizing: "border-box",