gaesup-world 0.1.0 → 0.1.2
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 +226 -136
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,13 +109,19 @@ This project is distributed under the MIT License.
|
|
|
109
109
|
|
|
110
110
|
---
|
|
111
111
|
|
|
112
|
-
|
|
112
|
+
### Index
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
- Player Type
|
|
115
115
|
|
|
116
|
-
-
|
|
117
|
-
-
|
|
118
|
-
-
|
|
116
|
+
- Character
|
|
117
|
+
- Vehicle
|
|
118
|
+
- Airplane
|
|
119
|
+
|
|
120
|
+
- Animation
|
|
121
|
+
|
|
122
|
+
## Player Type
|
|
123
|
+
|
|
124
|
+
---
|
|
119
125
|
|
|
120
126
|
## Character
|
|
121
127
|
|
|
@@ -123,11 +129,10 @@ This is the character control in Gaesup World.
|
|
|
123
129
|
|
|
124
130
|
- Possible Camera Types
|
|
125
131
|
|
|
126
|
-
| Name |
|
|
127
|
-
| ------ |
|
|
128
|
-
| Normal |
|
|
129
|
-
| Orbit |
|
|
130
|
-
| Map | Orthographic Camera | Map Control | A top-down control view. |
|
|
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. |
|
|
131
136
|
|
|
132
137
|
- Controller Tools
|
|
133
138
|
|
|
@@ -141,13 +146,11 @@ This is the character control in Gaesup World.
|
|
|
141
146
|
|
|
142
147
|
This is the vehicle control in Gaesup World. Characters can board the vehicle.
|
|
143
148
|
|
|
144
|
-
- Possible Camera Types
|
|
149
|
+
- Possible Camera Types (only orbit type available)
|
|
145
150
|
|
|
146
|
-
| Name
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
| Orbit | Perspective Camera | Orbit Control | Moves with the character and rotates according to the character's direction. |
|
|
150
|
-
| Map | Orthographic Camera | Map Control | A top-down control view. |
|
|
151
|
+
| Name | Control | Info |
|
|
152
|
+
| ----- | ------------- | ---------------------------------------------------------------------------- |
|
|
153
|
+
| Orbit | Orbit Control | Moves with the character and rotates according to the character's direction. |
|
|
151
154
|
|
|
152
155
|
- Controller Tools
|
|
153
156
|
|
|
@@ -161,13 +164,11 @@ This is the vehicle control in Gaesup World. Characters can board the vehicle.
|
|
|
161
164
|
|
|
162
165
|
This is the airplane control in Gaesup World. Characters can board the airplane.
|
|
163
166
|
|
|
164
|
-
- Possible Camera Types
|
|
167
|
+
- Possible Camera Types (only orbit type available)
|
|
165
168
|
|
|
166
|
-
| Name
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
| Orbit | Perspective Camera | Orbit Control | Moves with the character and rotates according to the character's direction. |
|
|
170
|
-
| Map | Orthographic Camera | Map Control | A top-down control view. |
|
|
169
|
+
| Name | Control | Info |
|
|
170
|
+
| ----- | ------------- | ---------------------------------------------------------------------------- |
|
|
171
|
+
| Orbit | Orbit Control | Moves with the character and rotates according to the character's direction. |
|
|
171
172
|
|
|
172
173
|
- Controller Tools
|
|
173
174
|
|
|
@@ -179,88 +180,183 @@ This is the airplane control in Gaesup World. Characters can board the airplane.
|
|
|
179
180
|
|
|
180
181
|
---
|
|
181
182
|
|
|
182
|
-
#
|
|
183
|
+
# Animation
|
|
183
184
|
|
|
184
|
-
-
|
|
185
|
+
- Animation refers to the method of controlling animations for characters and other elements in the Gaesup World.
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
# Rideable
|
|
187
188
|
|
|
188
|
-
|
|
189
|
+
- 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.
|
|
189
190
|
|
|
190
|
-
|
|
191
|
+

|
|
191
192
|
|
|
192
|
-
|
|
193
|
+
### (1) Example
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
export default function App() {
|
|
197
|
+
// Define URLs
|
|
198
|
+
const CHARACTER_URL = S3 + "/gaesup.glb";
|
|
199
|
+
const AIRPLANE_URL = S3 + "/air.glb";
|
|
200
|
+
const VEHICLE_URL = S3 + "/kart.glb";
|
|
201
|
+
const WHEEL_URL = S3 + "/wheel.glb";
|
|
202
|
+
|
|
203
|
+
return (
|
|
204
|
+
<GaesupWorld
|
|
205
|
+
// ...props defined here
|
|
206
|
+
>
|
|
207
|
+
<Canvas
|
|
208
|
+
// ...props defined here
|
|
209
|
+
>
|
|
210
|
+
<Physics>
|
|
211
|
+
<GaesupController />
|
|
212
|
+
|
|
213
|
+
{/* Import Rideable component inside and pass the arguments as shown below */}
|
|
214
|
+
<Rideable
|
|
215
|
+
objectkey="1"
|
|
216
|
+
objectType="vehicle"
|
|
217
|
+
isRiderOn={true}
|
|
218
|
+
url={VEHICLE_URL}
|
|
219
|
+
wheelUrl={WHEEL_URL}
|
|
220
|
+
offset={V3(0, 0.5, 0)}
|
|
221
|
+
position={V3(-10, 5, 10)}
|
|
222
|
+
/>
|
|
223
|
+
<Rideable
|
|
224
|
+
objectkey="2"
|
|
225
|
+
objectType="vehicle"
|
|
226
|
+
isRiderOn={false}
|
|
227
|
+
url={VEHICLE_URL}
|
|
228
|
+
wheelUrl={WHEEL_URL}
|
|
229
|
+
position={V3(-20, 5, 10)}
|
|
230
|
+
/>
|
|
231
|
+
<Rideable
|
|
232
|
+
objectkey="3"
|
|
233
|
+
objectType="airplane"
|
|
234
|
+
isRiderOn={true}
|
|
235
|
+
url={AIRPLANE_URL}
|
|
236
|
+
offset={V3(0, 0.5, 0)}
|
|
237
|
+
position={V3(10, 5, 10)}
|
|
238
|
+
/>
|
|
239
|
+
<Rideable
|
|
240
|
+
objectkey="4"
|
|
241
|
+
objectType="airplane"
|
|
242
|
+
isRiderOn={false}
|
|
243
|
+
url={AIRPLANE_URL}
|
|
244
|
+
position={V3(20, 5, 10)}
|
|
245
|
+
/>
|
|
246
|
+
</Physics>
|
|
247
|
+
</Canvas>
|
|
248
|
+
</GaesupWorld>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### 2) Precautions
|
|
254
|
+
|
|
255
|
+
- The `objectkey` must be unique.
|
|
256
|
+
|
|
257
|
+
### 3) Props
|
|
258
|
+
|
|
259
|
+
| Prop Name | Type | Required | Description | Default Value |
|
|
260
|
+
| -------------- | ----------------------- | -------- | ----------------------------------------------- | -------------- |
|
|
261
|
+
| `objectkey` | string | Required | Unique identifier for the rideable object | None |
|
|
262
|
+
| `objectType` | "vehicle" or "airplane" | Optional | Type of the rideable object | `undefined` |
|
|
263
|
+
| `isRiderOn` | boolean | Optional | Whether a rider is on the rideable object | `false` |
|
|
264
|
+
| `url` | string | Optional | 3D model URL for the rideable object | `null` |
|
|
265
|
+
| `wheelUrl` | string | Optional | Wheel model URL for "vehicle" type rideables | `null` |
|
|
266
|
+
| `position` | THREE.Vector3 | Optional | Initial position of the rideable object | `(0, 0, 0)` |
|
|
267
|
+
| `rotation` | THREE.Euler | Optional | Initial rotation angle of the rideable object | `(0, 0, 0)` |
|
|
268
|
+
| `offset` | THREE.Vector3 | Optional | Initial position offset for the rideable object | `(0, 0, 0)` |
|
|
269
|
+
| `visible` | boolean | Optional | Visibility of the rideable object | `true` |
|
|
270
|
+
| `vehicleSize` | THREE.Vector3 | Optional | Size of the "vehicle" type rideable object | Rapier default |
|
|
271
|
+
| `wheelSize` | THREE.Vector3 | Optional | Size of the wheel for "vehicle" type rideables | Rapier default |
|
|
272
|
+
| `airplaneSize` | THREE.Vector3 | Optional | Size of the "airplane" type rideable object | Rapier default |
|
|
273
|
+
|
|
274
|
+
### 4) Features
|
|
193
275
|
|
|
194
|
-
1.
|
|
276
|
+
1. **Support for Various Rideable Objects:** The Rideable component can render a variety of rideable objects, including "vehicle" and "airplane" types. It can render the 3D models of each object and allow interactions with them.
|
|
277
|
+
2. **Customizable Properties:** You can easily configure the initial state, size, model URLs, visibility, and more of rideable objects using component properties.
|
|
278
|
+
3. **Interaction with Riders:** The Rideable component supports interactions required for a rider to board and move with rideable objects.
|
|
195
279
|
|
|
196
|
-
|
|
280
|
+
### Advantages:
|
|
197
281
|
|
|
198
|
-
|
|
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.
|
|
199
286
|
|
|
200
|
-
|
|
287
|
+
# Tools
|
|
288
|
+
|
|
289
|
+
- 개숲월드에서 캐릭터 컨트롤을 도와주는 다양한 도구들입니다.
|
|
290
|
+
|
|
291
|
+
#### 1) [joystick](#1. joyStick)
|
|
201
292
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
293
|
+
#### 2) [keyboardtooltip](#keyBoardTooltip)
|
|
294
|
+
|
|
295
|
+
#### [minimap](#minimap)
|
|
205
296
|
|
|
206
|
-
|
|
297
|
+
#### [gameboy](#gameboy)
|
|
207
298
|
|
|
208
|
-
|
|
209
|
-
joyStickStyle: Style of the joystick container (React.CSSProperties object).
|
|
299
|
+
## 1. JoyStick
|
|
210
300
|
|
|
211
|
-
|
|
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.
|
|
212
302
|
|
|
213
|
-
|
|
303
|
+
### Key Features:
|
|
214
304
|
|
|
215
|
-
|
|
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.
|
|
216
308
|
|
|
217
|
-
|
|
309
|
+
### Props:
|
|
218
310
|
|
|
219
|
-
-
|
|
311
|
+
- `joyStickBallStyle`: Style of the joystick ball.
|
|
220
312
|
|
|
221
313
|
### (5) Example
|
|
222
314
|
|
|
223
315
|
```jsx
|
|
224
316
|
const MyComponent = () => {
|
|
225
|
-
// 커스텀 스타일 정의
|
|
226
317
|
const joyStickStyle = {
|
|
227
|
-
/*
|
|
318
|
+
/* joyStickStyle */
|
|
228
319
|
};
|
|
229
320
|
const joyStickBallStyle = {
|
|
230
|
-
/*
|
|
321
|
+
/* joyStickBallStyle */
|
|
231
322
|
};
|
|
232
323
|
|
|
233
324
|
return (
|
|
234
|
-
<
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
325
|
+
<GaesupWorld>
|
|
326
|
+
{/* ... */}
|
|
327
|
+
<JoyStick
|
|
328
|
+
joyStickStyle={joyStickStyle}
|
|
329
|
+
joyStickBallStyle={joyStickBallStyle}
|
|
330
|
+
/>
|
|
331
|
+
{/* ... */}
|
|
332
|
+
</GaesupWorld>
|
|
238
333
|
);
|
|
239
334
|
};
|
|
240
335
|
```
|
|
241
336
|
|
|
242
|
-
##
|
|
337
|
+
##
|
|
243
338
|
|
|
244
|
-
|
|
339
|
+
## 2. KeyBoardToolTip (키보드 툴팁)
|
|
245
340
|
|
|
246
|
-
|
|
341
|
+
The KeyBoardToolTip component is designed to visually represent a keyboard controller interface, providing a visual representation of each key and its associated action.
|
|
247
342
|
|
|
248
|
-
###
|
|
343
|
+
### Key Features:
|
|
249
344
|
|
|
250
|
-
-
|
|
251
|
-
-
|
|
252
|
-
-
|
|
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.
|
|
253
348
|
|
|
254
|
-
###
|
|
349
|
+
### How to Use:
|
|
255
350
|
|
|
256
|
-
1. `KeyBoardToolTip`
|
|
257
|
-
2.
|
|
258
|
-
3.
|
|
259
|
-
4. (
|
|
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.
|
|
260
355
|
|
|
261
|
-
###
|
|
356
|
+
### Example:
|
|
262
357
|
|
|
263
|
-
```
|
|
358
|
+
```
|
|
359
|
+
jsxCopy code
|
|
264
360
|
import { KeyBoardToolTip } from "./KeyBoardToolTip";
|
|
265
361
|
import { GaesupWorldContext } from "../../world/context";
|
|
266
362
|
|
|
@@ -293,28 +389,26 @@ const MyComponent = () => {
|
|
|
293
389
|
};
|
|
294
390
|
```
|
|
295
391
|
|
|
296
|
-
## 3
|
|
392
|
+
## 3. MiniMap
|
|
297
393
|
|
|
298
|
-
|
|
394
|
+
The MiniMap component is used to display a small map of the user's location and the surrounding environment within a 3D world.
|
|
299
395
|
|
|
300
|
-
|
|
396
|
+
### Key Features:
|
|
301
397
|
|
|
302
|
-
|
|
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.
|
|
303
402
|
|
|
304
|
-
|
|
305
|
-
- **방향 표시**: 동(East), 서(West), 남(South), 북(North) 방향을 시각적으로 표시합니다.
|
|
306
|
-
- **커스텀 스타일링**: 미니맵 및 그 내부 요소들의 스타일을 사용자 정의할 수 있습니다.
|
|
307
|
-
- **마우스 휠 지원**: 마우스 휠을 사용하여 미니맵의 스케일을 조절할 수 있습니다.
|
|
403
|
+
### How to Use:
|
|
308
404
|
|
|
309
|
-
|
|
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.
|
|
310
408
|
|
|
311
|
-
|
|
312
|
-
2. 필요한 스타일을 `minimapStyle`, `innerStyle`, `textStyle`, `objectStyle`, `avatarStyle`, `scaleStyle`, `directionStyle`, `plusMinusStyle` 속성을 통해 전달합니다.
|
|
313
|
-
3. 컴포넌트는 현재 사용자의 위치와 방향에 따라 미니맵을 업데이트합니다.
|
|
409
|
+
### Example:
|
|
314
410
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
```jsx
|
|
411
|
+
```tsx
|
|
318
412
|
import { MiniMap } from "./MiniMap";
|
|
319
413
|
|
|
320
414
|
const MyComponent = () => {
|
|
@@ -324,7 +418,7 @@ const MyComponent = () => {
|
|
|
324
418
|
const innerStyle = {
|
|
325
419
|
/* ... */
|
|
326
420
|
};
|
|
327
|
-
//
|
|
421
|
+
// Define other style properties as needed
|
|
328
422
|
|
|
329
423
|
return (
|
|
330
424
|
<GaesupWorld>
|
|
@@ -332,7 +426,7 @@ const MyComponent = () => {
|
|
|
332
426
|
<MiniMap
|
|
333
427
|
minimapStyle={minimapStyle}
|
|
334
428
|
innerStyle={innerStyle}
|
|
335
|
-
//
|
|
429
|
+
// Pass other style properties as needed
|
|
336
430
|
/>
|
|
337
431
|
{/* ... */}
|
|
338
432
|
</GaesupWorld>
|
|
@@ -340,34 +434,32 @@ const MyComponent = () => {
|
|
|
340
434
|
};
|
|
341
435
|
```
|
|
342
436
|
|
|
343
|
-
## GameBoy
|
|
344
|
-
|
|
345
|
-
## 개요
|
|
437
|
+
## 4. GameBoy
|
|
346
438
|
|
|
347
|
-
- GameBoy
|
|
439
|
+
- The GameBoy component is a controller interface that emulates GameBoy-like directional buttons. It is primarily intended for mobile usage.
|
|
348
440
|
|
|
349
|
-
|
|
441
|
+
### Key Features:
|
|
350
442
|
|
|
351
|
-
-
|
|
352
|
-
-
|
|
353
|
-
-
|
|
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.
|
|
354
446
|
|
|
355
|
-
|
|
447
|
+
### How to Use:
|
|
356
448
|
|
|
357
|
-
`GameBoy`
|
|
449
|
+
To use the `GameBoy` component:
|
|
358
450
|
|
|
359
|
-
1.
|
|
360
|
-
2.
|
|
361
|
-
3.
|
|
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.
|
|
362
454
|
|
|
363
|
-
|
|
455
|
+
### Example:
|
|
364
456
|
|
|
365
|
-
```
|
|
457
|
+
```tsx
|
|
366
458
|
import { GameBoy } from "./GameBoy";
|
|
367
459
|
import { GaesupWorldContext } from "../../world/context";
|
|
368
460
|
|
|
369
461
|
const MyComponent = () => {
|
|
370
|
-
//
|
|
462
|
+
// Define custom styles
|
|
371
463
|
const gameboyStyle = {
|
|
372
464
|
/* ... */
|
|
373
465
|
};
|
|
@@ -384,42 +476,41 @@ const MyComponent = () => {
|
|
|
384
476
|
};
|
|
385
477
|
```
|
|
386
478
|
|
|
387
|
-
## GamePad
|
|
479
|
+
## 5. GamePad
|
|
388
480
|
|
|
389
|
-
|
|
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.
|
|
390
482
|
|
|
391
|
-
|
|
483
|
+
### Key Features:
|
|
392
484
|
|
|
393
|
-
|
|
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.
|
|
394
488
|
|
|
395
|
-
|
|
396
|
-
- **범용적 사용**: 조이스틱 및 GameBoy와 같은 다양한 컨트롤러 모드와 호환됩니다.
|
|
397
|
-
- **커스텀 스타일링**: `gamePadStyle` 및 `gamePadButtonStyle` 속성을 통해 커스텀 스타일링 가능.
|
|
489
|
+
### Props:
|
|
398
490
|
|
|
399
|
-
|
|
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.
|
|
400
494
|
|
|
401
|
-
|
|
402
|
-
- `gamePadButtonStyle`: 개별 버튼의 스타일 (`React.CSSProperties` 객체).
|
|
403
|
-
- `label`: 버튼에 대한 커스텀 라벨.
|
|
495
|
+
### How to Use:
|
|
404
496
|
|
|
405
|
-
|
|
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.
|
|
406
500
|
|
|
407
|
-
|
|
408
|
-
2. `gamePadStyle` 및 `gamePadButtonStyle`을 사용하여 외관을 커스터마이즈합니다.
|
|
409
|
-
3. 컴포넌트는 컨트롤러 모드에 맞춰 적절한 버튼을 렌더링합니다.
|
|
410
|
-
|
|
411
|
-
## 예제 코드
|
|
501
|
+
### Example:
|
|
412
502
|
|
|
413
503
|
```tsx
|
|
504
|
+
jsxCopy code
|
|
414
505
|
import { GamePad } from "./GamePad";
|
|
415
506
|
import { GaesupWorldContext } from "../../world/context";
|
|
416
507
|
|
|
417
508
|
const MyComponent = () => {
|
|
418
509
|
const gamePadStyle = {
|
|
419
|
-
/*
|
|
510
|
+
/* Define custom styles here */
|
|
420
511
|
};
|
|
421
512
|
const gamePadButtonStyle = {
|
|
422
|
-
/*
|
|
513
|
+
/* Define button styles here */
|
|
423
514
|
};
|
|
424
515
|
|
|
425
516
|
return (
|
|
@@ -431,39 +522,38 @@ const MyComponent = () => {
|
|
|
431
522
|
};
|
|
432
523
|
```
|
|
433
524
|
|
|
434
|
-
## ZoomButton
|
|
435
|
-
|
|
436
|
-
## 개요
|
|
525
|
+
## 6. ZoomButton
|
|
437
526
|
|
|
438
|
-
|
|
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.
|
|
439
528
|
|
|
440
|
-
|
|
529
|
+
### Key Features:
|
|
441
530
|
|
|
442
|
-
- `position`:
|
|
443
|
-
- `children`: (
|
|
444
|
-
- `target`: (
|
|
445
|
-
- `keepBlocking`: (
|
|
446
|
-
- `zoomButtonStyle`: (
|
|
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).
|
|
447
536
|
|
|
448
|
-
|
|
537
|
+
### How to Use:
|
|
449
538
|
|
|
450
|
-
1. `ZoomButton`
|
|
451
|
-
2. `position` prop
|
|
452
|
-
3.
|
|
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.
|
|
453
542
|
|
|
454
|
-
|
|
543
|
+
### Example:
|
|
455
544
|
|
|
456
545
|
```tsx
|
|
546
|
+
jsxCopy code
|
|
457
547
|
import { ZoomButton } from "./ZoomButton";
|
|
458
548
|
import * as THREE from "three";
|
|
459
549
|
|
|
460
550
|
const App = () => {
|
|
461
551
|
return (
|
|
462
|
-
<
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
{/* ... */}
|
|
466
|
-
</GaesupWorld>
|
|
552
|
+
<ZoomButton position={new THREE.Vector3(0, 0, 5)}>
|
|
553
|
+
Zoom to Position
|
|
554
|
+
</ZoomButton>
|
|
467
555
|
);
|
|
468
556
|
};
|
|
469
557
|
```
|
|
558
|
+
|
|
559
|
+
##
|