gaesup-world 0.1.2 → 0.1.4

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.
package/README.md CHANGED
@@ -3,69 +3,41 @@
3
3
  [![Version](https://img.shields.io/npm/v/gaesup-world?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/gaesup-world)
4
4
  [![Downloads](https://img.shields.io/npm/dt/gaesup-world.svg?style=flat&colorA=000000&colorB=000000)](https://www.npmjs.com/package/gaesup-world)
5
5
 
6
- Web 3D Character Controller and World Platform Library
6
+ ### Web 3D Character Controller and World Platform Library
7
7
 
8
- [![main](https://github.com/jigglypop/gaesup-world/blob/master/image/main_image.png)](https://codesandbox.io/p/github/jigglypop/gaesup-world-examples/master?workspaceId=e8ae627a-af61-415e-aa21-1fe5af422c86)
9
-
10
- > click and watch code sandbox example!
11
-
12
- ---
8
+ ### ![ezgif-7-177168be04](https://github.com/jigglypop/gaesup-world/assets/52653682/3ac16291-c851-4b0c-9c19-7026a18a00bb)
13
9
 
14
10
  ## introduction
15
11
 
16
- 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.
12
+ - Gaesup World is a library that uses `@react/three-fiber`,` @react/three-drei`, and `react-three-rapier` to provide control tools for characters, airplanes, cars, and more in a web 3D environment.
13
+
14
+ - 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.
17
15
 
18
16
  ## How to start
19
17
 
20
18
  ```tsx
21
- "use client";
22
-
23
- import { Environment, KeyboardControls } from "@react-three/drei";
24
- import { Canvas } from "@react-three/fiber";
25
- import { Physics, RigidBody } from "@react-three/rapier";
26
-
27
- import { GaesupController, GaesupWorld } from "gaesup-world";
28
-
29
- export const keyboardMap = [
30
- { name: "forward", keys: ["ArrowUp", "KeyW"] },
31
- { name: "backward", keys: ["ArrowDown", "KeyS"] },
32
- { name: "leftward", keys: ["ArrowLeft", "KeyA"] },
33
- { name: "rightward", keys: ["ArrowRight", "KeyD"] },
34
- { name: "space", keys: ["Space"] },
35
- { name: "shift", keys: ["Shift"] },
36
- { name: "keyZ", keys: ["KeyZ"] },
37
- ];
19
+ import ...
38
20
 
39
21
  export default function App() {
40
- const CHARACTER_URL = "./gaesupyee.glb";
41
-
22
+ const CHARACTER_URL = S3 + "/gaesupyee.glb";
42
23
  return (
43
24
  <GaesupWorld
44
25
  url={{
45
26
  characterUrl: CHARACTER_URL,
46
27
  }}
28
+ mode={{
29
+ ...
30
+ }}
47
31
  >
48
- <Canvas shadows style={{ width: "100dvw", height: "100dvh" }}>
49
- <Environment background preset="sunset" blur={0.8} />
32
+ <Canvas>
50
33
  <Physics>
51
- <KeyboardControls map={keyboardMap}>
52
- <GaesupController
53
- groupProps={{
54
- rotation: [0, Math.PI, 0],
55
- }}
56
- />
57
- </KeyboardControls>
58
- <RigidBody type="fixed">
59
- <mesh receiveShadow position={[0, 0, 0]}>
60
- <boxGeometry args={[300, 5, 300]} />
61
- <meshStandardMaterial />
62
- </mesh>
63
- </RigidBody>
34
+ <GaesupController />
64
35
  </Physics>
65
36
  </Canvas>
66
37
  </GaesupWorld>
67
38
  );
68
39
  }
40
+
69
41
  ```
70
42
 
71
43
  ### Features
@@ -75,7 +47,7 @@ export default function App() {
75
47
  - Extensible structure for various customizations.
76
48
  - Lightweight library for fast loading and performance optimization.
77
49
 
78
- ### Installation
50
+ ## Installation
79
51
 
80
52
  ```bash
81
53
  npm install @react-three/fiber @react-three/drei three @types/three @react-three/rapier gaesup-world
@@ -87,39 +59,51 @@ Or
87
59
  yarn add @react-three/fiber @react-three/drei three @types/three @react-three/rapier gaesup-world
88
60
  ```
89
61
 
90
- ### Documentation
91
-
92
- it is detailed usage methods and API documentation
93
-
94
- - [how to contribute](#how-to-contribute)
95
-
96
- ### How to Contribute
62
+ ## 4) How to Contribute
97
63
 
98
64
  If you would like to contribute to this project, please follow these steps:
99
65
 
100
66
  1. Fork the project.
101
- 2. Create a new Feature branch (`git checkout -b feature/AmazingFeature`).
67
+ 2. go to dev branch ( git checkout dev ).
102
68
  3. Commit your changes (`git commit -m 'Add some AmazingFeature'`).
103
- 4. Push to the branch (`git push origin feature/AmazingFeature`).
69
+ 4. Push to the branch (git push origin dev).
104
70
  5. Create a Pull Request.
105
71
 
106
- ### License
72
+ ## 5) License
107
73
 
108
74
  This project is distributed under the MIT License.
109
75
 
110
- ---
76
+ - ## 1. [PlayerType](##PlayerType)
111
77
 
112
- ### Index
78
+ - [Character](#Character)
113
79
 
114
- - Player Type
80
+ - [Vehicle](#Vehicle)
115
81
 
116
- - Character
117
- - Vehicle
118
- - Airplane
82
+ - [Airplane](#Airplane)
119
83
 
120
- - Animation
84
+ * ## 2. [Animation](Animation)
121
85
 
122
- ## Player Type
86
+ * ## 3. [Rideable](Rideable)
87
+
88
+ * ## 4. [Passive](Passive)
89
+
90
+ * ## 5. [Tools](#Tools)
91
+
92
+ - [JoyStick](#1JoyStick)
93
+
94
+ * [keyBoardTooltip](#keyBoardTooltip)
95
+
96
+ * [minimap](#MiniMap)
97
+
98
+ * [gameboy](##GameBoy)
99
+
100
+ - [GamePad](#GamePad)
101
+
102
+ - [ZoomButton](#ZoomButton)
103
+
104
+ - [JumpPortal](#JumpPortal)
105
+
106
+ # PlayerType
123
107
 
124
108
  ---
125
109
 
@@ -129,24 +113,24 @@ This is the character control in Gaesup World.
129
113
 
130
114
  - Possible Camera Types
131
115
 
132
- | Name | Control | Info |
133
- | ------ | ------------- | --------------------------------------------------------------------------------------------- |
134
- | Normal | Orbit Control | Positioned parallel to the Z-axis from the character's location and not affected by rotation. |
135
- | Orbit | Orbit Control | Moves with the character and rotates according to the character's direction. |
116
+ | Name | Info |
117
+ | ------ | --------------------------------------------------------------------------------------------- |
118
+ | Normal | Positioned parallel to the Z-axis from the character's location and not affected by rotation. |
119
+ | Orbit | Moves with the character and rotates according to the character's direction. |
136
120
 
137
121
  - Controller Tools
138
122
 
139
- | Name | Info |
140
- | -------- | ----------------------------------------------------------------------- |
141
- | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
142
- | Joystick | A joystick implementation tool. It works on mobile devices. |
143
- | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
123
+ | Name | Condition | Info |
124
+ | -------- | --------------------------- | ----------------------------------------------------------------------- |
125
+ | Keyboard | desktop | A standard keyboard tool. You can see where on the keyboard is clicked. |
126
+ | Joystick | mobile (not normal control) | A joystick implementation tool. It works on mobile devices. |
127
+ | Gameboy | mobile | A Gameboy implementation tool. It works on mobile devices. |
144
128
 
145
129
  ## Vehicle
146
130
 
147
- This is the vehicle control in Gaesup World. Characters can board the vehicle.
131
+ - This is the vehicle control in Gaesup World. Characters can board the vehicle.
148
132
 
149
- - Possible Camera Types (only orbit type available)
133
+ * Possible Camera Types (only orbit type available)
150
134
 
151
135
  | Name | Control | Info |
152
136
  | ----- | ------------- | ---------------------------------------------------------------------------- |
@@ -154,15 +138,15 @@ This is the vehicle control in Gaesup World. Characters can board the vehicle.
154
138
 
155
139
  - Controller Tools
156
140
 
157
- | Name | Info |
158
- | -------- | ----------------------------------------------------------------------- |
159
- | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
160
- | Joystick | A joystick implementation tool. It works on mobile devices. |
161
- | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
141
+ | Name | Condition | Info |
142
+ | -------- | --------- | ----------------------------------------------------------------------- |
143
+ | Keyboard | desktop | A standard keyboard tool. You can see where on the keyboard is clicked. |
144
+ | Joystick | mobile | A joystick implementation tool. It works on mobile devices. |
145
+ | Gameboy | mobile | A Gameboy implementation tool. It works on mobile devices. |
162
146
 
163
147
  ## Airplane
164
148
 
165
- This is the airplane control in Gaesup World. Characters can board the airplane.
149
+ the airplane control in Gaesup World. Characters can board the airplane.
166
150
 
167
151
  - Possible Camera Types (only orbit type available)
168
152
 
@@ -172,13 +156,11 @@ This is the airplane control in Gaesup World. Characters can board the airplane.
172
156
 
173
157
  - Controller Tools
174
158
 
175
- | Name | Info |
176
- | -------- | ----------------------------------------------------------------------- |
177
- | Keyboard | A standard keyboard tool. You can see where on the keyboard is clicked. |
178
- | Joystick | A joystick implementation tool. It works on mobile devices. |
179
- | Gameboy | A Gameboy implementation tool. It works on mobile devices. |
180
-
181
- ---
159
+ | Name | Condition | Info |
160
+ | -------- | --------- | ----------------------------------------------------------------------- |
161
+ | Keyboard | desktop | A standard keyboard tool. You can see where on the keyboard is clicked. |
162
+ | Joystick | mobile | A joystick implementation tool. It works on mobile devices. |
163
+ | Gameboy | mobile | A Gameboy implementation tool. It works on mobile devices. |
182
164
 
183
165
  # Animation
184
166
 
@@ -188,7 +170,9 @@ This is the airplane control in Gaesup World. Characters can board the airplane.
188
170
 
189
171
  - Rideable objects are objects that can be ridden. They detect collisions and allow the character to board when contact is made. Currently, two types of objects, 'vehicle' and 'airplane', can be ridden.
190
172
 
191
- ![Rideable](https://jiggloghttps.s3.ap-northeast-2.amazonaws.com/images/rideable.gif)
173
+ example)
174
+
175
+ <img src="https://jiggloghttps.s3.ap-northeast-2.amazonaws.com/images/rideable.gif" alt="Rideable" style="zoom:150%;" />
192
176
 
193
177
  ### (1) Example
194
178
 
@@ -277,56 +261,90 @@ export default function App() {
277
261
  2. **Customizable Properties:** You can easily configure the initial state, size, model URLs, visibility, and more of rideable objects using component properties.
278
262
  3. **Interaction with Riders:** The Rideable component supports interactions required for a rider to board and move with rideable objects.
279
263
 
280
- ### Advantages:
264
+ ### 5) Advantages
281
265
 
282
- 1. **Modularity and Reusability:** The Rideable component is modular and can be easily integrated with other components, increasing code reusability and facilitating maintenance.
283
- 2. **Rapid Development:** By using the `useRideable` hook, which manages the physics engine and rideable object management, developers can quickly implement and render rideable objects, reducing development time.
284
- 3. **Real-time Interaction:** Leveraging the Rapier physics engine allows for real-time handling of rideable object movements and collision checks, providing a high level of interaction in games or simulations.
285
- 4. **Flexible Customization:** You can customize the appearance and behavior of each rideable object using properties, making it suitable for various game or simulation environments.
266
+ - **Modularity and Reusability:** The Rideable component is modular and can be easily integrated with other components, increasing code reusability and facilitating maintenance.
286
267
 
287
- # Tools
268
+ - **Rapid Development:** By using the `useRideable` hook, which manages the physics engine and rideable object management, developers can quickly implement and render rideable objects, reducing development time.
288
269
 
289
- - 개숲월드에서 캐릭터 컨트롤을 도와주는 다양한 도구들입니다.
270
+ - **Real-time Interaction:** Leveraging the Rapier physics engine allows for real-time handling of rideable object movements and collision checks, providing a high level of interaction in games or simulations.
290
271
 
291
- #### 1) [joystick](#1. joyStick)
272
+ - **Flexible Customization:** You can customize the appearance and behavior of each rideable object using properties, making it suitable for various game or simulation environments.
292
273
 
293
- #### 2) [keyboardtooltip](#keyBoardTooltip)
274
+ # Passive
294
275
 
295
- #### [minimap](#minimap)
276
+ ---
296
277
 
297
- #### [gameboy](#gameboy)
278
+ under construct
298
279
 
299
- ## 1. JoyStick
280
+ # GaeSupProps
300
281
 
301
- The JoyStick component provides a virtual joystick interface, primarily intended for mobile environments. This component allows you to simulate joystick-like input on mobile devices. Additionally, you can prevent position jitter, which can occur on mobile devices, by using the `scrollBlock` option in the `GaesupWorld` component.
282
+ ---
302
283
 
303
- ### Key Features:
284
+ The `GaeSupProps` component is a React component used in a 3D environment. It is designed to represent various types of props or objects within the scene. This component can be used to create props with different types, text labels, and positions for visualization in a 3D space.
304
285
 
305
- - **Joystick Interface:** Provides a joystick-like user input interface, suitable for mobile devices.
306
- - **Customization:** You can customize the style of the JoyStick component by adjusting the styles of the joystick and the joystick ball using the `joyStickBallStyle` and `joyStickStyle` properties.
307
- - **Responsive and Interactive:** It supports various input devices and responds to both mouse and mobile touch events for controlling movement.
286
+ ### (1) props
308
287
 
309
- ### Props:
288
+ The `GaeSupProps` component accepts the following props:
310
289
 
311
- - `joyStickBallStyle`: Style of the joystick ball.
290
+ - `type` (optional): A string specifying the type of the prop. It can be either `"normal"` or `"ground"`. Defaults to `"normal"` if not provided.
291
+ - `text` (optional): A string representing the text label associated with the prop. This label can provide additional information about the prop. If not provided, no label will be displayed.
292
+ - `position` (optional): An array of three numbers `[x, y, z]` specifying the initial position of the prop in the 3D space. If not provided, the prop will be positioned at the origin `[0, 0, 0]`.
293
+ - `children` (required): This prop should contain the 3D content that makes up the visual representation of the prop. It can include any 3D objects or components you want to render within the prop.
312
294
 
313
- ### (5) Example
295
+ ### (2) example
314
296
 
315
- ```jsx
316
- const MyComponent = () => {
317
- const joyStickStyle = {
318
- /* joyStickStyle */
319
- };
320
- const joyStickBallStyle = {
321
- /* joyStickBallStyle */
322
- };
297
+ - To use the `GaeSupProps` component, you need to import it and include it in your React component tree. Here's an example of how to use it:
298
+
299
+ ```tsx
300
+ import { GaeSupProps } from "./GaeSupProps";
301
+
302
+ function MyScene() {
303
+ return (
304
+ <GaeSupProps type="normal" text="My Prop" position={[3, 1, -2]}>
305
+ {/* 3D content goes here */}
306
+ </GaeSupProps>
307
+ );
308
+ }
309
+ ```
310
+
311
+ - In this example, we've created a `GaeSupProps` component with a `"normal"` type, a text label of `"My Prop"`, and a specific position in 3D space.
312
+
313
+ ### (3) Behavior
314
+
315
+ - The `GaeSupProps` component also calculates the size and center of the 3D content it contains. It then updates a `minimap` object with this information, which can be useful for tracking the props within the scene.
316
+
317
+ - Additionally, the component uses the `useEffect` hook to dispatch updates to the context, ensuring that changes to the `minimap` object are reflected in the sce
318
+
319
+ # Tools
320
+
321
+ - Various tools that assist with character control in GaesupWorld
322
+
323
+ ## GameBoy
324
+
325
+ - The GameBoy component is a controller interface that emulates GameBoy-like directional buttons. It is primarily intended for mobile usage.
323
326
 
327
+ ### (1) props
328
+
329
+ | Prop Name | Type | Required | Description | Default Value |
330
+ | -------------------- | --------------- | -------- | ------------------------------------ | ------------- |
331
+ | `gamePadStyle` | object (styles) | Optional | Style for the GamePad container | `undefined` |
332
+ | `gamePadButtonStyle` | object (styles) | Optional | Style for individual GamePad buttons | `undefined` |
333
+ | `label` | string | Optional | Custom label for the buttons | `undefined` |
334
+
335
+ ### (2) example
336
+
337
+ ```tsx
338
+ import { GameBoy } from "./GameBoy";
339
+ import { GaesupWorldContext } from "../../world/context";
340
+
341
+ const App = () => {
324
342
  return (
325
343
  <GaesupWorld>
326
344
  {/* ... */}
327
- <JoyStick
328
- joyStickStyle={joyStickStyle}
329
- joyStickBallStyle={joyStickBallStyle}
345
+ <GameBoy
346
+ gameboyStyle={gameboyStyle}
347
+ gameboyButtonStyle={gameboyButtonStyle}
330
348
  />
331
349
  {/* ... */}
332
350
  </GaesupWorld>
@@ -334,54 +352,45 @@ const MyComponent = () => {
334
352
  };
335
353
  ```
336
354
 
337
- ##
355
+ ### (3) Key Features:
338
356
 
339
- ## 2. KeyBoardToolTip (키보드 툴팁)
357
+ - **Direction Buttons:** Implements buttons for directional input (forward, backward, left, right) based on the `GameBoyDirections` array.
358
+ - **Context-aware Rendering:** Renders the component based on the `mode.controller` value from the `GaesupWorldContext`.
359
+ - **Custom Styling:** Provides `gameboyStyle` and `gameboyButtonStyle` properties for styling customization.
340
360
 
341
- The KeyBoardToolTip component is designed to visually represent a keyboard controller interface, providing a visual representation of each key and its associated action.
361
+ ### (4) How to Use
342
362
 
343
- ### Key Features:
363
+ To use the `GameBoy` component:
344
364
 
345
- - **Visualizing Keyboard Keys:** Visualizes all keyboard keys in an array format.
346
- - **State Animation:** Reflects the currently active keys and their associated actions by displaying them differently to provide user feedback.
347
- - **Custom Styling:** Provides various styling properties for customizing key caps' appearance.
365
+ 1. Place the `GameBoy` component within your component tree.
366
+ 2. Customize the appearance by defining styles in the `gameboyStyle` and `gameboyButtonStyle` properties.
367
+ 3. The component renders buttons based on the `GameBoyDirections` array.
348
368
 
349
- ### How to Use:
369
+ ## GamePad
350
370
 
351
- 1. Include the `KeyBoardToolTip` component within the `GaesupWorld` component.
352
- 2. Define the `control` mode as "keyboard" in the `mode` property.
353
- 3. The component visualizes each keyboard key based on the `KeyBoardAll` constant and applies different styles for currently active keys.
354
- 4. (Optional) Customize the styles using the `keyBoardToolTipInnerStyle`, `selectedKeyCapStyle`, `notSelectedkeyCapStyle`, and `keyCapStyle` properties.
371
+ - The GamePad component provides a customizable controller interface that supports various controller modes, such as joysticks and GameBoys, making it versatile for different input scenarios.
355
372
 
356
- ### Example:
373
+ ### (1) props
357
374
 
358
- ```
359
- jsxCopy code
360
- import { KeyBoardToolTip } from "./KeyBoardToolTip";
361
- import { GaesupWorldContext } from "../../world/context";
375
+ | Prop Name | Type | Required | Description | Default Value |
376
+ | -------------------- | --------------- | -------- | ------------------------------------ | ------------- |
377
+ | `gamePadStyle` | object (styles) | Optional | Style for the GamePad container | `undefined` |
378
+ | `gamePadButtonStyle` | object (styles) | Optional | Style for individual GamePad buttons | `undefined` |
379
+ | `label` | string | Optional | Custom label for the buttons | `undefined` |
362
380
 
363
- const MyComponent = () => {
364
- const keyBoardToolTipInnerStyle = {
365
- /* ... */
366
- };
367
- const selectedKeyCapStyle = {
368
- /* ... */
369
- };
370
- const notSelectedkeyCapStyle = {
371
- /* ... */
372
- };
373
- const keyCapStyle = {
374
- /* ... */
375
- };
381
+ ### (2) example
376
382
 
383
+ ```tsx
384
+ import { GamePad } from "./GamePad";
385
+ import { GaesupWorldContext } from "../../world/context";
386
+
387
+ const App = () => {
377
388
  return (
378
389
  <GaesupWorld>
379
390
  {/* ... */}
380
- <KeyBoardToolTip
381
- keyBoardToolTipInnerStyle={keyBoardToolTipInnerStyle}
382
- selectedKeyCapStyle={selectedKeyCapStyle}
383
- notSelectedkeyCapStyle={notSelectedkeyCapStyle}
384
- keyCapStyle={keyCapStyle}
391
+ <GamePad
392
+ gamePadStyle={gamePadStyle}
393
+ gamePadButtonStyle={gamePadButtonStyle}
385
394
  />
386
395
  {/* ... */}
387
396
  </GaesupWorld>
@@ -389,44 +398,48 @@ const MyComponent = () => {
389
398
  };
390
399
  ```
391
400
 
392
- ## 3. MiniMap
401
+ ### (3) Key Features
393
402
 
394
- The MiniMap component is used to display a small map of the user's location and the surrounding environment within a 3D world.
403
+ - **Dynamic Button Rendering:** Dynamically generates buttons based on the `control` object in the `GaesupWorldContext`.
404
+ - **Universal Usage:** Compatible with various controller modes like joysticks and GameBoys.
405
+ - **Custom Styling:** Allows customization of the GamePad's appearance using the `gamePadStyle` and `gamePadButtonStyle` properties.
395
406
 
396
- ### Key Features:
407
+ ### (4) How to Use
397
408
 
398
- - **Dynamic Scaling:** Allows users to dynamically adjust the size of the map.
399
- - **Direction Indicators:** Visualizes directions such as East, West, South, and North.
400
- - **Custom Styling:** Allows customization of the MiniMap and its internal elements.
401
- - **Mouse Wheel Support:** Supports adjusting the map's scale using the mouse wheel.
409
+ 1. Include the `GamePad` component within your component tree.
410
+ 2. Customize the appearance using the `gamePadStyle` and `gamePadButtonStyle` properties.
411
+ 3. The component dynamically renders buttons based on the `control` mode.
402
412
 
403
- ### How to Use:
413
+ ## JoyStick
404
414
 
405
- 1. Include the `MiniMap` component within your component tree.
406
- 2. Customize the appearance using the `minimapStyle`, `innerStyle`, `textStyle`, `objectStyle`, `avatarStyle`, `scaleStyle`, `directionStyle`, and `plusMinusStyle` properties as needed.
407
- 3. The component updates the MiniMap based on the user's current position and direction.
415
+ ---
408
416
 
409
- ### Example:
417
+ - The JoyStick component provides a virtual joystick interface, primarily intended for mobile environments. This component allows you to simulate joystick-like input on mobile devices. Additionally, you can prevent position jitter, which can occur on mobile devices, by using the `scrollBlock` option in the `GaesupWorld` component.
410
418
 
411
- ```tsx
412
- import { MiniMap } from "./MiniMap";
419
+ ### (1) props
420
+
421
+ | Prop Name | Type | Required | Description | Default Value |
422
+ | ------------------- | --------------- | -------- | --------------------------- | ------------- |
423
+ | `joyStickStyle` | object (styles) | Optional | Style for the joystick | `undefined` |
424
+ | `joyStickBallStyle` | object (styles) | Optional | Style for the joystick ball | `undefined` |
425
+
426
+ ### (2) example
413
427
 
428
+ ```jsx
414
429
  const MyComponent = () => {
415
- const minimapStyle = {
416
- /* ... */
430
+ const joyStickStyle = {
431
+ /* joyStickStyle */
417
432
  };
418
- const innerStyle = {
419
- /* ... */
433
+ const joyStickBallStyle = {
434
+ /* joyStickBallStyle */
420
435
  };
421
- // Define other style properties as needed
422
436
 
423
437
  return (
424
438
  <GaesupWorld>
425
439
  {/* ... */}
426
- <MiniMap
427
- minimapStyle={minimapStyle}
428
- innerStyle={innerStyle}
429
- // Pass other style properties as needed
440
+ <JoyStick
441
+ joyStickStyle={joyStickStyle}
442
+ joyStickBallStyle={joyStickBallStyle}
430
443
  />
431
444
  {/* ... */}
432
445
  </GaesupWorld>
@@ -434,126 +447,174 @@ const MyComponent = () => {
434
447
  };
435
448
  ```
436
449
 
437
- ## 4. GameBoy
450
+ ### (3) Key Features:
438
451
 
439
- - The GameBoy component is a controller interface that emulates GameBoy-like directional buttons. It is primarily intended for mobile usage.
452
+ - **Joystick Interface:** Provides a joystick-like user input interface, suitable for mobile devices.
453
+ - **Customization:** You can customize the style of the JoyStick component by adjusting the styles of the joystick and the joystick ball using the `joyStickBallStyle` and `joyStickStyle` properties.
454
+ - **Responsive and Interactive:** It supports various input devices and responds to both mouse and mobile touch events for controlling movement.
440
455
 
441
- ### Key Features:
456
+ ## 4) JumpPortal
442
457
 
443
- - **Direction Buttons:** Implements buttons for directional input (forward, backward, left, right) based on the `GameBoyDirections` array.
444
- - **Context-aware Rendering:** Renders the component based on the `mode.controller` value from the `GaesupWorldContext`.
445
- - **Custom Styling:** Provides `gameboyStyle` and `gameboyButtonStyle` properties for styling customization.
458
+ - The `JumpPortal` component represents a clickable portal that allows users to teleport to a specified location within a 3D world. This component can be used to create interactive teleportation points in your application.
446
459
 
447
- ### How to Use:
460
+ ### (1) props
448
461
 
449
- To use the `GameBoy` component:
462
+ | Prop Name | Type | Required | Description | Default Value |
463
+ | ----------------- | ------------- | -------- | ----------------------------------------------------------- | ------------- |
464
+ | `text` | string | Optional | The text to display on the portal. | `undefined` |
465
+ | `position` | THREE.Vector3 | Required | The target position to teleport to using a `THREE.Vector3`. | None |
466
+ | `jumpPortalStyle` | CSSProperties | Optional | CSS styles for customizing the appearance of the portal. | `undefined` |
450
467
 
451
- 1. Place the `GameBoy` component within your component tree.
452
- 2. Customize the appearance by defining styles in the `gameboyStyle` and `gameboyButtonStyle` properties.
453
- 3. The component renders buttons based on the `GameBoyDirections` array.
468
+ ### (2) example
454
469
 
455
- ### Example:
470
+ - To use the `JumpPortal` component, you can import it and include it in your React application as follows:
456
471
 
457
472
  ```tsx
458
- import { GameBoy } from "./GameBoy";
459
- import { GaesupWorldContext } from "../../world/context";
460
-
461
- const MyComponent = () => {
462
- // Define custom styles
463
- const gameboyStyle = {
464
- /* ... */
465
- };
466
- const gameboyButtonStyle = {
467
- /* ... */
468
- };
473
+ import { JumpPortal } from "./JumpPortal";
474
+ import * as THREE from "three";
469
475
 
476
+ const App = () => {
470
477
  return (
471
- <GameBoy
472
- gameboyStyle={gameboyStyle}
473
- gameboyButtonStyle={gameboyButtonStyle}
474
- />
478
+ <GaesupWorld>
479
+ {/* ... */}
480
+ <JumpPortal
481
+ text="Teleport"
482
+ position={new THREE.Vector3(10, 0, 5)}
483
+ jumpPortalStyle={{ backgroundColor: "blue", color: "white" }}
484
+ />
485
+ {/* ... */}
486
+ </GaesupWorld>
475
487
  );
476
488
  };
477
489
  ```
478
490
 
479
- ## 5. GamePad
491
+ ## KeyBoardToolTip
480
492
 
481
- - The GamePad component provides a customizable controller interface that supports various controller modes, such as joysticks and GameBoys, making it versatile for different input scenarios.
482
-
483
- ### Key Features:
493
+ ---
484
494
 
485
- - **Dynamic Button Rendering:** Dynamically generates buttons based on the `control` object in the `GaesupWorldContext`.
486
- - **Universal Usage:** Compatible with various controller modes like joysticks and GameBoys.
487
- - **Custom Styling:** Allows customization of the GamePad's appearance using the `gamePadStyle` and `gamePadButtonStyle` properties.
495
+ - The KeyBoardToolTip component is designed to visually represent a keyboard controller interface, providing a visual representation of each key and its associated action.
488
496
 
489
- ### Props:
497
+ ### Key Features
490
498
 
491
- - `gamePadStyle`: Style of the GamePad container (`React.CSSProperties` object).
492
- - `gamePadButtonStyle`: Style of individual buttons (`React.CSSProperties` object).
493
- - `label`: Custom label for the buttons.
499
+ - **Visualizing Keyboard Keys:** Visualizes all keyboard keys in an array format.
500
+ - **State Animation:** Reflects the currently active keys and their associated actions by displaying them differently to provide user feedback.
501
+ - **Custom Styling:** Provides various styling properties for customizing key caps' appearance.
494
502
 
495
- ### How to Use:
503
+ ### How to Use
496
504
 
497
- 1. Include the `GamePad` component within your component tree.
498
- 2. Customize the appearance using the `gamePadStyle` and `gamePadButtonStyle` properties.
499
- 3. The component dynamically renders buttons based on the `control` mode.
505
+ 1. Include the `KeyBoardToolTip` component within the `GaesupWorld` component.
506
+ 2. Define the `control` mode as "keyboard" in the `mode` property.
507
+ 3. The component visualizes each keyboard key based on the `KeyBoardAll` constant and applies different styles for currently active keys.
508
+ 4. (Optional) Customize the styles using the `keyBoardToolTipInnerStyle`, `selectedKeyCapStyle`, `notSelectedkeyCapStyle`, and `keyCapStyle` properties.
500
509
 
501
510
  ### Example:
502
511
 
503
512
  ```tsx
504
- jsxCopy code
505
- import { GamePad } from "./GamePad";
513
+ import { KeyBoardToolTip } from "./KeyBoardToolTip";
506
514
  import { GaesupWorldContext } from "../../world/context";
507
515
 
508
- const MyComponent = () => {
509
- const gamePadStyle = {
510
- /* Define custom styles here */
511
- };
512
- const gamePadButtonStyle = {
513
- /* Define button styles here */
514
- };
516
+ const App = () => {
517
+ return (
518
+ <GaesupWorld>
519
+ {/* ... */}
520
+ <KeyBoardToolTip
521
+ keyBoardToolTipInnerStyle={keyBoardToolTipInnerStyle}
522
+ selectedKeyCapStyle={selectedKeyCapStyle}
523
+ notSelectedkeyCapStyle={notSelectedkeyCapStyle}
524
+ keyCapStyle={keyCapStyle}
525
+ />
526
+ {/* ... */}
527
+ </GaesupWorld>
528
+ );
529
+ };
530
+ ```
531
+
532
+ ## MiniMap
533
+
534
+ ---
535
+
536
+ - The MiniMap component is used to display a small map of the user's location and the surrounding environment within a 3D world.
537
+
538
+ ### (1) props
539
+
540
+ | Prop Name | Type | Required | Description | Default Value |
541
+ | ---------------- | --------------- | -------- | --------------------------------------------- | ------------- |
542
+ | `innerStyle` | object (styles) | Optional | Style for the inner MiniMap container | `undefined` |
543
+ | `textStyle` | object (styles) | Optional | Style for text within the MiniMap | `undefined` |
544
+ | `objectStyle` | object (styles) | Optional | Style for objects within the MiniMap | `undefined` |
545
+ | `avatarStyle` | object (styles) | Optional | Style for avatars within the MiniMap | `undefined` |
546
+ | `scaleStyle` | object (styles) | Optional | Style for the scale control of the MiniMap | `undefined` |
547
+ | `directionStyle` | object (styles) | Optional | Style for direction indicators in the MiniMap | `undefined` |
548
+ | `plusMinusStyle` | object (styles) | Optional | Style for plus/minus controls in the MiniMap | `undefined` |
515
549
 
550
+ ### 2) example
551
+
552
+ ```tsx
553
+ import { MiniMap } from "./MiniMap";
554
+
555
+ const App = () => {
516
556
  return (
517
- <GamePad
518
- gamePadStyle={gamePadStyle}
519
- gamePadButtonStyle={gamePadButtonStyle}
520
- />
557
+ <GaesupWorld>
558
+ {/* ... */}
559
+ <MiniMap
560
+ minimapStyle={minimapStyle}
561
+ innerStyle={innerStyle}
562
+ // Pass other style properties as needed
563
+ />
564
+ {/* ... */}
565
+ </GaesupWorld>
521
566
  );
522
567
  };
523
568
  ```
524
569
 
525
- ## 6. ZoomButton
570
+ ### 3) Key Features
526
571
 
527
- The ZoomButton component is used to move the camera to a specific location and control the camera's zoom, primarily used for zooming to a target.
572
+ - **Dynamic Scaling:** Allows users to dynamically adjust the size of the map.
573
+ - **Direction Indicators:** Visualizes directions such as East, West, South, and North.
574
+ - **Custom Styling:** Allows customization of the MiniMap and its internal elements.
575
+ - **Mouse Wheel Support:** Supports adjusting the map's scale using the mouse wheel.
528
576
 
529
- ### Key Features:
577
+ ### 4) How to Use
530
578
 
531
- - `position`: The target position where the camera will move to (`THREE.Vector3` object).
532
- - `children`: (Optional) React nodes to render within the button.
533
- - `target`: (Optional) The target position the camera will look at (`THREE.Vector3` object).
534
- - `keepBlocking`: (Optional) Determines whether to keep the blocking state while the camera is moving.
535
- - `zoomButtonStyle`: (Optional) Style for the button (`React.CSSProperties` object).
579
+ 1. Include the `MiniMap` component within your component tree.
580
+ 2. Customize the appearance using the `minimapStyle`, `innerStyle`, `textStyle`, `objectStyle`, `avatarStyle`, `scaleStyle`, `directionStyle`, and `plusMinusStyle` properties as needed.
581
+ 3. The component updates the MiniMap based on the user's current position and direction.
536
582
 
537
- ### How to Use:
583
+ ## ZoomButton
538
584
 
539
- 1. Place the `ZoomButton` component in your component tree at the desired location.
540
- 2. Define the `position` prop to specify the location the camera should move to.
541
- 3. When the button is clicked, the camera will move to the specified position.
585
+ ---
542
586
 
543
- ### Example:
587
+ - The ZoomButton component is used to move the camera to a specific location and control the camera's zoom, primarily used for zooming to a target.
588
+
589
+ ### (1) props
590
+
591
+ | Prop Name | Type | Required | Description | Default Value |
592
+ | ----------------- | --------------- | -------- | ---------------------------------------------------------- | ------------- |
593
+ | `position` | THREE.Vector3 | Required | Target position for the camera to move to | None |
594
+ | `children` | React.ReactNode | Optional | React nodes to render within the button | `undefined` |
595
+ | `target` | THREE.Vector3 | Optional | Target position for the camera to look at | `undefined` |
596
+ | `keepBlocking` | boolean | Optional | Determines whether to keep blocking while camera is moving | `undefined` |
597
+ | `zoomButtonStyle` | object (styles) | Optional | Style for the ZoomButton component | `undefined` |
598
+
599
+ ### (2) example
544
600
 
545
601
  ```tsx
546
- jsxCopy code
547
602
  import { ZoomButton } from "./ZoomButton";
548
603
  import * as THREE from "three";
549
604
 
550
605
  const App = () => {
551
606
  return (
552
- <ZoomButton position={new THREE.Vector3(0, 0, 5)}>
553
- Zoom to Position
554
- </ZoomButton>
607
+ <GaesupWorld>
608
+ {/* ... */}
609
+ <ZoomButton position={new THREE.Vector3(0, 0, 5)}>{childern}</ZoomButton>
610
+ {/* ... */}
611
+ </GaesupWorld>
555
612
  );
556
613
  };
557
614
  ```
558
615
 
559
- ##
616
+ ### (3) How to Use
617
+
618
+ 1. Place the `ZoomButton` component in your component tree at the desired location.
619
+ 2. Define the `position` prop to specify the location the camera should move to.
620
+ 3. When the button is clicked, the camera will move to the specified position.