Gaesup World is a comprehensive library designed to facilitate the creation and management of interactive 3D environments on the web. Leveraging powerful tools like @react-three/fiber
, @react-three/drei
, and react-three-rapier
, Gaesup World provides robust control mechanisms for characters, vehicles, airplanes, and more. It offers utilities such as minimaps and joysticks, making it ideal for building immersive virtual worlds and games.
- 3D Character Control: Control characters in a 3D space using React Three Fiber.
- Simple API: Easily manage character movement and animations.
- Extensible Structure: Customize and extend functionalities as needed.
- Lightweight: Optimized for fast loading and performance.
- Utilities: Includes minimaps, joysticks, and more for enhanced user experience.
npm install @react-three/fiber @react-three/drei three @types/three @react-three/rapier ../../../src
yarn add @react-three/fiber @react-three/drei three @types/three @react-three/rapier ../../../src
Here's a simple example to get you started with Gaesup World:
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController } from '../../../src';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard', // or 'joystick', 'gamepad', etc.
}}
>
<Canvas>
<Physics>
<GaesupController />
</Physics>
</Canvas>
</GaesupWorld>
);
}
In this example, the GaesupWorld component sets up the 3D environment, and the GaesupController manages character control. The url
prop specifies the 3D model URL for the character, and the mode
prop defines the type of controller to use.
Gaesup World offers a variety of components to manage characters and interactive objects within the 3D environment. Below are the key components:
PlayerType defines various controllable player types in Gaesup World. Currently supported types include Character, Vehicle, and Airplane.
The Character component handles character movement, animation, and interactions within Gaesup World.
-
Camera Types:
- Normal: Positioned parallel to the Z-axis from the character's location and not affected by rotation.
- Orbit: Moves with the character and rotates according to the character's direction.
-
Controller Tools:
- Keyboard: Standard keyboard input for desktop environments.
- Joystick: Joystick input for mobile devices.
- GameBoy: GameBoy-style button input for mobile devices.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController } from '../../../src';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard', // or 'joystick', 'gamepad', etc.
}}
>
<Canvas>
<Physics>
<GaesupController />
</Physics>
</Canvas>
</GaesupWorld>
);
}
The Vehicle component manages vehicle movement, animation, and interactions within Gaesup World. Characters can board and control vehicles.
-
Camera Types:
- Orbit Control: Moves with the character and rotates according to the character's direction.
-
Controller Tools:
- Keyboard: Standard keyboard input for desktop environments.
- Joystick: Joystick input for mobile devices.
- GameBoy: GameBoy-style button input for mobile devices.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const VEHICLE_URL = 'https://your-s3-bucket/kart.glb';
const WHEEL_URL = 'https://your-s3-bucket/wheel.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="vehicle1"
objectType="vehicle"
isRiderOn={true}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
offset={V3(0, 0.5, 0)}
position={V3(-10, 5, 10)}
/>
{/* Add more Vehicle components as needed */}
</Physics>
</Canvas>
</GaesupWorld>
);
}
The Airplane component manages airplane movement, animation, and interactions within Gaesup World. Characters can board and control airplanes.
-
Camera Types:
- Orbit Control: Moves with the character and rotates according to the character's direction.
-
Controller Tools:
- Keyboard: Standard keyboard input for desktop environments.
- Joystick: Joystick input for mobile devices.
- GameBoy: GameBoy-style button input for mobile devices.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const AIRPLANE_URL = 'https://your-s3-bucket/air.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="airplane1"
objectType="airplane"
isRiderOn={true}
url={AIRPLANE_URL}
offset={V3(0, 0.5, 0)}
position={V3(10, 5, 10)}
/>
{/* Add more Airplane components as needed */}
</Physics>
</Canvas>
</GaesupWorld>
);
}
The Animation component manages animations for characters and other elements within Gaesup World. It allows defining various animation states and triggering animations based on conditions.
- Key Features:
- Animation State Management: Manage multiple animation states and trigger animations based on specific conditions.
- Conditional Animations: Automatically switch animations when certain conditions are met.
- Extensible Animation System: Easily add custom animations as needed.
The Rideable component defines objects that characters can ride, such as vehicles and airplanes. It detects collisions and allows characters to board when contact is made.
- Key Features:
- Support for Various Rideable Objects: Currently supports "vehicle" and "airplane" types.
- Customizable Properties: Easily configure initial state, size, model URLs, visibility, and more.
- Interaction with Riders: Manages interactions required for a rider to board and move with rideable objects.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const VEHICLE_URL = 'https://your-s3-bucket/kart.glb';
const WHEEL_URL = 'https://your-s3-bucket/wheel.glb';
const AIRPLANE_URL = 'https://your-s3-bucket/air.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="vehicle1"
objectType="vehicle"
isRiderOn={true}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
offset={V3(0, 0.5, 0)}
position={V3(-10, 5, 10)}
/>
<Rideable
objectkey="vehicle2"
objectType="vehicle"
isRiderOn={false}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
position={V3(-20, 5, 10)}
/>
<Rideable
objectkey="airplane1"
objectType="airplane"
isRiderOn={true}
url={AIRPLANE_URL}
offset={V3(0, 0.5, 0)}
position={V3(10, 5, 10)}
/>
<Rideable
objectkey="airplane2"
objectType="airplane"
isRiderOn={false}
url={AIRPLANE_URL}
position={V3(20, 5, 10)}
/>
</Physics>
</Canvas>
</GaesupWorld>
);
}
Important Notes:
- The
objectkey
must be unique for each Rideable component. objectType
should be either"vehicle"
or"airplane"
.
Prop Name | Type | Required | Description | Default Value |
---|---|---|---|---|
objectkey |
string | Required | Unique identifier for the rideable object | None |
objectType |
"vehicle" or "airplane" | Optional | Type of the rideable object | undefined |
isRiderOn |
boolean | Optional | Whether a rider is on the rideable object | false |
url |
string | Optional | 3D model URL for the rideable object | null |
wheelUrl |
string | Optional | Wheel model URL for "vehicle" type rideables | null |
position |
THREE.Vector3 | Optional | Initial position of the rideable object | (0, 0, 0) |
rotation |
THREE.Euler | Optional | Initial rotation angle of the rideable object | (0, 0, 0) |
offset |
THREE.Vector3 | Optional | Initial position offset for the rideable object | (0, 0, 0) |
visible |
boolean | Optional | Visibility of the rideable object | true |
vehicleSize |
THREE.Vector3 | Optional | Size of the "vehicle" type rideable object | Rapier default |
wheelSize |
THREE.Vector3 | Optional | Size of the wheel for "vehicle" type rideables | Rapier default |
airplaneSize |
THREE.Vector3 | Optional | Size of the "airplane" type rideable object | Rapier default |
The Passive component defines objects that do not require interaction, such as buildings or other static objects within the environment.
- Key Features:
- Static Object Management: Efficiently manages static environment objects.
- Performance Optimization: Optimizes rendering of static objects to enhance overall performance.
- Customizable Appearance: Easily configure the appearance and position of static objects.
Gaesup World includes various utility components to enhance user interaction and experience within the 3D environment.
-
Description: Provides a virtual joystick interface primarily intended for mobile environments. Prevents position jitter on mobile devices using the
scrollBlock
option in the GaesupWorld component. -
Props:
Prop Name Type Required Description Default Value joystickStyle
object (styles) Optional Style for the joystick undefined
joystickBallStyle
object (styles) Optional Style for the joystick ball undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, Joystick } from '../../../src'; export default function App() { const joystickStyle = { /* Define joystick container styles */ }; const joystickBallStyle = { /* Define joystick ball styles */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'joystick', // or 'keyboard', 'gamepad', etc. scrollBlock: true, // Prevent position jitter }} > <Canvas> <Physics> <Joystick joystickStyle={joystickStyle} joystickBallStyle={joystickBallStyle} /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Joystick Interface: Simulates joystick input for mobile devices.
- Customization: Customize the appearance using
joystickStyle
andjoystickBallStyle
. - Responsive Interaction: Responds to both mouse and touch events for controlling movement.
-
Description: Visually represents a keyboard controller interface, displaying each key and its associated action.
-
Key Features:
- Visualizing Keyboard Keys: Displays all keyboard keys in an array format.
- State Animation: Highlights active keys to provide user feedback.
- Custom Styling: Customize keycaps' appearance using various style properties.
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, KeyBoardToolTip } from '../../../src'; export default function App() { const keyBoardToolTipInnerStyle = { /* Define inner tooltip styles */ }; const selectedKeyCapStyle = { /* Define styles for selected keycaps */ }; const notSelectedkeyCapStyle = { /* Define styles for non-selected keycaps */ }; const keyCapStyle = { /* Define default keycap styles */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', // Ensure controller mode is set to 'keyboard' }} > <Canvas> <Physics> <KeyBoardToolTip keyBoardToolTipInnerStyle={keyBoardToolTipInnerStyle} selectedKeyCapStyle={selectedKeyCapStyle} notSelectedkeyCapStyle={notSelectedkeyCapStyle} keyCapStyle={keyCapStyle} /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Description: Displays a small map indicating the user's location and the surrounding environment within the 3D world.
-
Props:
Prop Name Type Required Description Default Value minimapStyle
object (styles) Optional Style for the MiniMap container undefined
innerStyle
object (styles) Optional Style for the inner MiniMap container undefined
textStyle
object (styles) Optional Style for text within the MiniMap undefined
objectStyle
object (styles) Optional Style for objects within the MiniMap undefined
avatarStyle
object (styles) Optional Style for avatars within the MiniMap undefined
scaleStyle
object (styles) Optional Style for the scale control of the MiniMap undefined
directionStyle
object (styles) Optional Style for direction indicators in the MiniMap undefined
plusMinusStyle
object (styles) Optional Style for plus/minus controls in the MiniMap undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, MiniMap } from '../../../src'; export default function App() { const minimapStyle = { /* Define MiniMap container styles */ }; const innerStyle = { /* Define inner MiniMap styles */ }; // Define other style properties as needed return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <MiniMap minimapStyle={minimapStyle} innerStyle={innerStyle} // Pass other style properties as needed /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Dynamic Scaling: Users can adjust the size of the MiniMap.
- Direction Indicators: Displays directions like East, West, South, and North.
- Custom Styling: Customize the appearance of the MiniMap and its elements.
- Mouse Wheel Support: Adjust the MiniMap's scale using the mouse wheel.
-
Description: Emulates GameBoy-style directional buttons for mobile environments, providing an intuitive control interface.
-
Props:
Prop Name Type Required Description Default Value gamePadStyle
object (styles) Optional Style for the GamePad container undefined
gamePadButtonStyle
object (styles) Optional Style for individual GamePad buttons undefined
label
string Optional Custom label for the buttons undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, GameBoy } from '../../../src'; export default function App() { const gamePadStyle = { /* Define GamePad container styles */ }; const gamePadButtonStyle = { /* Define GamePad button styles */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'gameboy', // Ensure controller mode is set to 'gameboy' }} > <Canvas> <Physics> <GameBoy gamePadStyle={gamePadStyle} gamePadButtonStyle={gamePadButtonStyle} /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Direction Buttons: Implements buttons for directional input (forward, backward, left, right).
- Context-aware Rendering: Renders based on the
mode.controller
value from the GaesupWorldContext. - Custom Styling: Allows customization of the GamePad's appearance using
gamePadStyle
andgamePadButtonStyle
.
-
Description: Provides a customizable controller interface supporting various controller modes, such as joysticks and GameBoys, offering versatility for different input scenarios.
-
Props:
Prop Name Type Required Description Default Value gamePadStyle
object (styles) Optional Style for the GamePad container undefined
gamePadButtonStyle
object (styles) Optional Style for individual GamePad buttons undefined
label
string Optional Custom label for the buttons undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, GamePad } from '../../../src'; export default function App() { const gamePadStyle = { /* Define GamePad container styles */ }; const gamePadButtonStyle = { /* Define GamePad button styles */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'gamepad', // or 'joystick', 'gameboy', etc. }} > <Canvas> <Physics> <GamePad gamePadStyle={gamePadStyle} gamePadButtonStyle={gamePadButtonStyle} /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Dynamic Button Rendering: Generates buttons based on the
control
object from GaesupWorldContext. - Universal Usage: Compatible with various controller modes like joysticks and GameBoys.
- Custom Styling: Customize the appearance using
gamePadStyle
andgamePadButtonStyle
.
- Dynamic Button Rendering: Generates buttons based on the
-
Description: Moves the camera to a specific location and controls the camera's zoom, primarily used for zooming to a target.
-
Props:
Prop Name Type Required Description Default Value position
THREE.Vector3 Required Target position for the camera to move to None children
React.ReactNode Optional React nodes to render within the button undefined
target
THREE.Vector3 Optional Target position for the camera to look at undefined
keepBlocking
boolean Optional Determines whether to keep blocking while camera is moving undefined
zoomButtonStyle
object (styles) Optional Style for the ZoomButton component undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, ZoomButton } from '../../../src'; import * as THREE from 'three'; export default function App() { return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <ZoomButton position={new THREE.Vector3(0, 0, 5)} target={new THREE.Vector3(0, 0, 0)} zoomButtonStyle={{ backgroundColor: 'blue', color: 'white' }} > Zoom In </ZoomButton> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Camera Movement: Moves the camera to the specified position upon button click.
- Zoom Control: Adjusts the camera's zoom level.
- Custom Styling: Customize the button's appearance using
zoomButtonStyle
.
-
Description: Represents a clickable portal that allows users to teleport to a specified location within the 3D world. Ideal for creating interactive teleportation points in your application.
-
Props:
Prop Name Type Required Description Default Value text
string Optional The text to display on the portal. undefined
position
THREE.Vector3 Required The target position to teleport to using a THREE.Vector3
.None teleportStyle
CSSProperties Optional CSS styles for customizing the appearance of the portal. undefined
-
Usage Example:
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, teleport } from '../../../src'; import * as THREE from 'three'; export default function App() { return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <teleport text="Teleport" position={new THREE.Vector3(10, 0, 5)} teleportStyle={{ backgroundColor: "blue", color: "white" }} /> {/* Other components */} </Physics> </Canvas> </GaesupWorld> ); }
-
Key Features:
- Teleport Functionality: Moves the camera and character to the specified position upon clicking the portal.
- Custom Styling: Customize the portal's appearance using
teleportStyle
. - Text Display: Displays text on the portal to guide users.
If you would like to contribute to Gaesup World, please follow these steps:
-
Fork the Project: Click the "Fork" button on GitHub to create your own copy of the repository.
-
Switch to the Development Branch: Navigate to the
dev
branch.git checkout dev
-
Commit Your Changes: Make your changes and commit them with a descriptive message.
git commit -m 'Add some AmazingFeature'
-
Push to the Branch: Push your changes to your forked repository.
git push origin dev
-
Create a Pull Request: Go to your forked repository on GitHub and create a Pull Request to the original repository's
dev
branch.
This project is distributed under the MIT License. For more details, please refer to the LICENSE file.
Gaesup World is continuously updated and improved based on user feedback. For more information or assistance, feel free to reach out via the GitHub Issues page.
Build immersive web 3D environments with Gaesup World!
Gaesup World๋ ์น์์ ์ํธ์์ฉ ๊ฐ๋ฅํ 3D ํ๊ฒฝ์ ์์ฝ๊ฒ ์์ฑํ๊ณ ๊ด๋ฆฌํ ์ ์๋๋ก ์ค๊ณ๋ ์ข
ํฉ์ ์ธ ๋ผ์ด๋ธ๋ฌ๋ฆฌ์
๋๋ค. @react-three/fiber
, @react-three/drei
, react-three-rapier
์ ๊ฐ์ ๊ฐ๋ ฅํ ๋๊ตฌ๋ฅผ ํ์ฉํ์ฌ ์บ๋ฆญํฐ, ๋นํ๊ธฐ, ์ฐจ๋ ๋ฑ ๋ค์ํ ๊ฐ์ฒด์ ์ ์ด ๋ฉ์ปค๋์ฆ์ ์ ๊ณตํฉ๋๋ค. ๋ฏธ๋๋งต, ์กฐ์ด์คํฑ๊ณผ ๊ฐ์ ์ ํธ๋ฆฌํฐ๋ฅผ ํตํด ๋ชฐ์
๊ฐ ์๋ ๊ฐ์ ์ธ๊ณ์ ๊ฒ์์ ๊ตฌ์ถํ๋ ๋ฐ ์ด์์ ์
๋๋ค.
- 3D ์บ๋ฆญํฐ ์ปจํธ๋กค: React Three Fiber๋ฅผ ์ฌ์ฉํ์ฌ 3D ๊ณต๊ฐ์์ ์บ๋ฆญํฐ๋ฅผ ์ ์ดํฉ๋๋ค.
- ๊ฐํธํ API: ์บ๋ฆญํฐ์ ์ด๋๊ณผ ์ ๋๋ฉ์ด์ ์ ์ฝ๊ฒ ๊ด๋ฆฌํ ์ ์๋ ๊ฐ๋จํ API ์ ๊ณต.
- ํ์ฅ ๊ฐ๋ฅํ ๊ตฌ์กฐ: ํ์์ ๋ฐ๋ผ ๊ธฐ๋ฅ์ ์ปค์คํฐ๋ง์ด์งํ๊ณ ํ์ฅํ ์ ์์ต๋๋ค.
- ๊ฒฝ๋ํ: ๋น ๋ฅธ ๋ก๋ฉ๊ณผ ์ฑ๋ฅ ์ต์ ํ๋ฅผ ์ํด ๊ฒฝ๋ํ ์ค๊ณ.
- ์ ํธ๋ฆฌํฐ: ๋ฏธ๋๋งต, ์กฐ์ด์คํฑ ๋ฑ ์ฌ์ฉ์ ๊ฒฝํ์ ํฅ์์ํค๋ ๋ค์ํ ์ ํธ๋ฆฌํฐ ํฌํจ.
npm install @react-three/fiber @react-three/drei three @types/three @react-three/rapier ../../../src
yarn add @react-three/fiber @react-three/drei three @types/three @react-three/rapier ../../../src
๋ค์์ Gaesup World์ ๊ธฐ๋ณธ ์ฌ์ฉ๋ฒ์ ์๊ฐํ๋ ๊ฐ๋จํ ์์ ์ ๋๋ค:
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController } from '../../../src';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard', // ๋๋ 'joystick', 'gamepad' ๋ฑ
}}
>
<Canvas>
<Physics>
<GaesupController />
</Physics>
</Canvas>
</GaesupWorld>
);
}
์ ์์ ์์๋ GaesupWorld ์ปดํฌ๋ํธ๋ฅผ ํตํด 3D ํ๊ฒฝ์ ์ค์ ํ๊ณ , GaesupController๋ฅผ ์ด์ฉํ์ฌ ์บ๋ฆญํฐ๋ฅผ ์ ์ดํฉ๋๋ค. url
prop์ ํตํด ์บ๋ฆญํฐ์ 3D ๋ชจ๋ธ URL์ ์ง์ ํ๊ณ , mode
prop์ ํตํด ์ฌ์ฉํ๊ณ ์ ํ๋ ์ปจํธ๋กค๋ฌ ํ์
์ ์ค์ ํฉ๋๋ค.
Gaesup World๋ ๋ค์ํ ์ปดํฌ๋ํธ๋ฅผ ์ ๊ณตํ์ฌ ์บ๋ฆญํฐ์ ๊ฐ์ฒด์ ์ ์ด, ์ํธ์์ฉ์ ์ง์ํฉ๋๋ค. ์ฃผ์ ์ปดํฌ๋ํธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
PlayerType์ Gaesup World์์ ์ ์ดํ ์ ์๋ ๋ค์ํ ํ๋ ์ด์ด ํ์ ์ ์ ์ํฉ๋๋ค. ํ์ฌ ์ง์๋๋ ํ์ ์ Character, Vehicle, Airplane์ ๋๋ค.
Character ์ปดํฌ๋ํธ๋ Gaesup World ๋ด์์ ์บ๋ฆญํฐ์ ์ด๋, ์ ๋๋ฉ์ด์ , ์ํธ์์ฉ์ ๊ด๋ฆฌํ๋ ํต์ฌ ์ปดํฌ๋ํธ์ ๋๋ค.
-
์นด๋ฉ๋ผ ํ์ :
- Normal: ์บ๋ฆญํฐ์ ์์น๋ฅผ ๊ธฐ์ค์ผ๋ก Z์ถ์ ํํํ๊ฒ ๋ฐฐ์น๋๋ฉฐ, ์บ๋ฆญํฐ์ ํ์ ์ ์ํฅ์ ๋ฐ์ง ์์ต๋๋ค.
- Orbit: ์บ๋ฆญํฐ์ ํจ๊ป ์์ง์ด๋ฉฐ ์บ๋ฆญํฐ์ ๋ฐฉํฅ์ ๋ฐ๋ผ ์นด๋ฉ๋ผ๊ฐ ํ์ ํฉ๋๋ค.
-
์ปจํธ๋กค๋ฌ ๋๊ตฌ:
- Keyboard: ๋ฐ์คํฌํ ํ๊ฒฝ์์ ํ์ค ํค๋ณด๋ ์ ๋ ฅ์ ํตํด ์บ๋ฆญํฐ๋ฅผ ์ ์ดํฉ๋๋ค.
- Joystick: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ์กฐ์ด์คํฑ ์ ๋ ฅ์ ํตํด ์บ๋ฆญํฐ๋ฅผ ์ ์ดํฉ๋๋ค.
- GameBoy: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ GameBoy ์คํ์ผ์ ๋ฒํผ ์ ๋ ฅ์ ํตํด ์บ๋ฆญํฐ๋ฅผ ์ ์ดํฉ๋๋ค.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController } from '../../../src';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard', // ๋๋ 'joystick', 'gamepad' ๋ฑ
}}
>
<Canvas>
<Physics>
<GaesupController />
</Physics>
</Canvas>
</GaesupWorld>
);
}
Vehicle ์ปดํฌ๋ํธ๋ Gaesup World ๋ด์์ ์ฐจ๋์ ์ด๋, ์ ๋๋ฉ์ด์ , ์ํธ์์ฉ์ ๊ด๋ฆฌํฉ๋๋ค. ์บ๋ฆญํฐ๊ฐ ์ฐจ๋์ ํ์นํ ์ ์์ต๋๋ค.
-
์นด๋ฉ๋ผ ํ์ :
- Orbit Control: ์บ๋ฆญํฐ์ ํจ๊ป ์์ง์ด๋ฉฐ ์บ๋ฆญํฐ์ ๋ฐฉํฅ์ ๋ฐ๋ผ ์นด๋ฉ๋ผ๊ฐ ํ์ ํฉ๋๋ค.
-
์ปจํธ๋กค๋ฌ ๋๊ตฌ:
- Keyboard: ๋ฐ์คํฌํ ํ๊ฒฝ์์ ํ์ค ํค๋ณด๋ ์ ๋ ฅ์ ํตํด ์ฐจ๋์ ์ ์ดํฉ๋๋ค.
- Joystick: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ์กฐ์ด์คํฑ ์ ๋ ฅ์ ํตํด ์ฐจ๋์ ์ ์ดํฉ๋๋ค.
- GameBoy: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ GameBoy ์คํ์ผ์ ๋ฒํผ ์ ๋ ฅ์ ํตํด ์ฐจ๋์ ์ ์ดํฉ๋๋ค.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const VEHICLE_URL = 'https://your-s3-bucket/kart.glb';
const WHEEL_URL = 'https://your-s3-bucket/wheel.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="vehicle1"
objectType="vehicle"
isRiderOn={true}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
offset={V3(0, 0.5, 0)}
position={V3(-10, 5, 10)}
/>
{/* ์ถ๊ฐ์ ์ธ Vehicle ์ปดํฌ๋ํธ */}
</Physics>
</Canvas>
</GaesupWorld>
);
}
Airplane ์ปดํฌ๋ํธ๋ Gaesup World ๋ด์์ ๋นํ๊ธฐ์ ์ด๋, ์ ๋๋ฉ์ด์ , ์ํธ์์ฉ์ ๊ด๋ฆฌํฉ๋๋ค. ์บ๋ฆญํฐ๊ฐ ๋นํ๊ธฐ์ ํ์นํ ์ ์์ต๋๋ค.
-
์นด๋ฉ๋ผ ํ์ :
- Orbit Control: ์บ๋ฆญํฐ์ ํจ๊ป ์์ง์ด๋ฉฐ ์บ๋ฆญํฐ์ ๋ฐฉํฅ์ ๋ฐ๋ผ ์นด๋ฉ๋ผ๊ฐ ํ์ ํฉ๋๋ค.
-
์ปจํธ๋กค๋ฌ ๋๊ตฌ:
- Keyboard: ๋ฐ์คํฌํ ํ๊ฒฝ์์ ํ์ค ํค๋ณด๋ ์ ๋ ฅ์ ํตํด ๋นํ๊ธฐ๋ฅผ ์ ์ดํฉ๋๋ค.
- Joystick: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ์กฐ์ด์คํฑ ์ ๋ ฅ์ ํตํด ๋นํ๊ธฐ๋ฅผ ์ ์ดํฉ๋๋ค.
- GameBoy: ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ GameBoy ์คํ์ผ์ ๋ฒํผ ์ ๋ ฅ์ ํตํด ๋นํ๊ธฐ๋ฅผ ์ ์ดํฉ๋๋ค.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const AIRPLANE_URL = 'https://your-s3-bucket/air.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="airplane1"
objectType="airplane"
isRiderOn={true}
url={AIRPLANE_URL}
offset={V3(0, 0.5, 0)}
position={V3(10, 5, 10)}
/>
{/* ์ถ๊ฐ์ ์ธ Airplane ์ปดํฌ๋ํธ */}
</Physics>
</Canvas>
</GaesupWorld>
);
}
Animation ์ปดํฌ๋ํธ๋ ์บ๋ฆญํฐ์ ๊ธฐํ ๊ฐ์ฒด์ ์ ๋๋ฉ์ด์ ์ ๊ด๋ฆฌํ๋ ๋ฉ์๋๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋ค์ํ ์ ๋๋ฉ์ด์ ์ํ๋ฅผ ์ ์ํ๊ณ , ์กฐ๊ฑด์ ๋ฐ๋ผ ์ ๋๋ฉ์ด์ ์ ํธ๋ฆฌ๊ฑฐํ ์ ์์ต๋๋ค.
- ์ฃผ์ ๊ธฐ๋ฅ:
- ์ ๋๋ฉ์ด์ ์ํ ๊ด๋ฆฌ: ์ฌ๋ฌ ์ ๋๋ฉ์ด์ ์ํ๋ฅผ ๊ด๋ฆฌํ๊ณ , ํ์ฌ ์ํ๋ฅผ ํธ๋ฆฌ๊ฑฐํฉ๋๋ค.
- ์กฐ๊ฑด๋ถ ์ ๋๋ฉ์ด์ : ํน์ ์กฐ๊ฑด์ ๋ฐ๋ผ ์ ๋๋ฉ์ด์ ์ ์๋์ผ๋ก ์ ํํฉ๋๋ค.
- ํ์ฅ ๊ฐ๋ฅํ ์ ๋๋ฉ์ด์ ์์คํ : ์ฌ์ฉ์ ์ ์ ์ ๋๋ฉ์ด์ ์ ์ฝ๊ฒ ์ถ๊ฐํ ์ ์์ต๋๋ค.
Rideable ์ปดํฌ๋ํธ๋ ์บ๋ฆญํฐ๊ฐ ํ์นํ ์ ์๋ ๊ฐ์ฒด๋ฅผ ์ ์ํฉ๋๋ค. ์ด ์ปดํฌ๋ํธ๋ ์ถฉ๋์ ๊ฐ์งํ์ฌ ์บ๋ฆญํฐ๊ฐ ๊ฐ์ฒด์ ํ์นํ ์ ์๋๋ก ํฉ๋๋ค.
- ์ฃผ์ ๊ธฐ๋ฅ:
- ํ์น ๊ฐ๋ฅ ๊ฐ์ฒด ์ง์: ํ์ฌ "vehicle"๊ณผ "airplane" ํ์ ์ ๊ฐ์ฒด๋ฅผ ์ง์ํฉ๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง ๊ฐ๋ฅํ ์์ฑ: ๊ฐ์ฒด์ ์์น, ํ์ , ๋ชจ๋ธ URL ๋ฑ์ ์ฝ๊ฒ ์ค์ ํ ์ ์์ต๋๋ค.
- ์ํธ์์ฉ ๊ด๋ฆฌ: ์บ๋ฆญํฐ์ ๊ฐ์ฒด ๊ฐ์ ์ํธ์์ฉ์ ๊ด๋ฆฌํ์ฌ ์์ฐ์ค๋ฌ์ด ํ์น ๊ฒฝํ์ ์ ๊ณตํฉ๋๋ค.
import React from 'react';
import { Canvas } from '@react-three/fiber';
import { Physics } from '@react-three/rapier';
import { GaesupWorld, GaesupController, Rideable } from '../../../src';
import { V3 } from '../../../src/utils';
export default function App() {
const CHARACTER_URL = 'https://your-s3-bucket/gaesupyee.glb';
const VEHICLE_URL = 'https://your-s3-bucket/kart.glb';
const WHEEL_URL = 'https://your-s3-bucket/wheel.glb';
const AIRPLANE_URL = 'https://your-s3-bucket/air.glb';
return (
<GaesupWorld
url={{
characterUrl: CHARACTER_URL,
}}
mode={{
controller: 'keyboard',
}}
>
<Canvas>
<Physics>
<GaesupController />
<Rideable
objectkey="vehicle1"
objectType="vehicle"
isRiderOn={true}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
offset={V3(0, 0.5, 0)}
position={V3(-10, 5, 10)}
/>
<Rideable
objectkey="vehicle2"
objectType="vehicle"
isRiderOn={false}
url={VEHICLE_URL}
wheelUrl={WHEEL_URL}
position={V3(-20, 5, 10)}
/>
<Rideable
objectkey="airplane1"
objectType="airplane"
isRiderOn={true}
url={AIRPLANE_URL}
offset={V3(0, 0.5, 0)}
position={V3(10, 5, 10)}
/>
<Rideable
objectkey="airplane2"
objectType="airplane"
isRiderOn={false}
url={AIRPLANE_URL}
position={V3(20, 5, 10)}
/>
</Physics>
</Canvas>
</GaesupWorld>
);
}
์ค์ ์ฌํญ:
objectkey
๋ ๊ฐ Rideable ์ปดํฌ๋ํธ๋ง๋ค ๊ณ ์ ํด์ผ ํฉ๋๋ค.objectType
์"vehicle"
๋๋"airplane"
์ด์ด์ผ ํฉ๋๋ค.
Prop Name | Type | Required | Description | Default Value |
---|---|---|---|---|
objectkey |
string | Required | ํ์น ๊ฐ๋ฅํ ๊ฐ์ฒด์ ๊ณ ์ ์๋ณ์ | None |
objectType |
"vehicle" or "airplane" | Optional | ํ์น ๊ฐ๋ฅํ ๊ฐ์ฒด์ ํ์ | undefined |
isRiderOn |
boolean | Optional | ๊ฐ์ฒด์ ํ์น ์ค์ธ์ง ์ฌ๋ถ | false |
url |
string | Optional | ํ์น ๊ฐ๋ฅํ ๊ฐ์ฒด์ 3D ๋ชจ๋ธ URL | null |
wheelUrl |
string | Optional | "vehicle" ํ์
๊ฐ์ฒด์ ํ ๋ชจ๋ธ URL |
null |
position |
THREE.Vector3 | Optional | ๊ฐ์ฒด์ ์ด๊ธฐ ์์น | (0, 0, 0) |
rotation |
THREE.Euler | Optional | ๊ฐ์ฒด์ ์ด๊ธฐ ํ์ ๊ฐ๋ | (0, 0, 0) |
offset |
THREE.Vector3 | Optional | ๊ฐ์ฒด์ ์์น ์คํ์ | (0, 0, 0) |
visible |
boolean | Optional | ๊ฐ์ฒด์ ๊ฐ์์ฑ | true |
vehicleSize |
THREE.Vector3 | Optional | "vehicle" ํ์
๊ฐ์ฒด์ ํฌ๊ธฐ |
Rapier ๊ธฐ๋ณธ๊ฐ |
wheelSize |
THREE.Vector3 | Optional | "vehicle" ํ์
ํ ์ ํฌ๊ธฐ |
Rapier ๊ธฐ๋ณธ๊ฐ |
airplaneSize |
THREE.Vector3 | Optional | "airplane" ํ์
๊ฐ์ฒด์ ํฌ๊ธฐ |
Rapier ๊ธฐ๋ณธ๊ฐ |
Passive ์ปดํฌ๋ํธ๋ ์ํธ์์ฉ์ด ํ์ ์๋ ๊ฐ์ฒด๋ฅผ ์ ์ํฉ๋๋ค. ์๋ฅผ ๋ค์ด, ์ฃผ๋ณ ํ๊ฒฝ์ ๊ตฌ์ฑํ๋ ๊ฑด๋ฌผ์ด๋ ๊ธฐํ ์ ์ ๊ฐ์ฒด ๋ฑ์ ๋ํ๋ ๋๋ค.
- ์ฃผ์ ๊ธฐ๋ฅ:
- ์ ์ ๊ฐ์ฒด ๊ด๋ฆฌ: ์ํธ์์ฉ์ด ํ์ ์๋ ํ๊ฒฝ ๊ฐ์ฒด๋ฅผ ํจ์จ์ ์ผ๋ก ๊ด๋ฆฌํฉ๋๋ค.
- ์ฑ๋ฅ ์ต์ ํ: ์ ์ ๊ฐ์ฒด์ ๋ ๋๋ง์ ์ต์ ํํ์ฌ ์ ์ฒด์ ์ธ ์ฑ๋ฅ์ ํฅ์์ํต๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง: ๋ค์ํ ์ ์ ๊ฐ์ฒด์ ์ธ๊ด๊ณผ ์์น๋ฅผ ์ฝ๊ฒ ์ค์ ํ ์ ์์ต๋๋ค.
Gaesup World๋ ๋ค์ํ ๋๊ตฌ ์ปดํฌ๋ํธ๋ฅผ ์ ๊ณตํ์ฌ ์ฌ์ฉ์ ์ธํฐํ์ด์ค๋ฅผ ํฅ์์ํค๊ณ , ์ฌ์ฉ์ ๊ฒฝํ์ ๊ทน๋ํํฉ๋๋ค.
-
์ค๋ช : ๋ชจ๋ฐ์ผ ํ๊ฒฝ์์ ์กฐ์ด์คํฑ ์ ๋ ฅ์ ์๋ฎฌ๋ ์ด์ ํ๋ ์ปดํฌ๋ํธ์ ๋๋ค. ์คํฌ๋กค ๋ธ๋ก ์ต์ ์ ์ฌ์ฉํ์ฌ ๋ชจ๋ฐ์ผ ์ฅ์น์์ ์์น ์งํฐ๋ฅผ ๋ฐฉ์งํ ์ ์์ต๋๋ค.
-
Props:
Prop Name Type Required Description Default Value joystickStyle
object (styles) Optional ์กฐ์ด์คํฑ ์ปจํ ์ด๋ ์คํ์ผ undefined
joystickBallStyle
object (styles) Optional ์กฐ์ด์คํฑ ๋ณผ ์คํ์ผ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, Joystick } from '../../../src'; export default function App() { const joystickStyle = { /* ์กฐ์ด์คํฑ ์ปจํ ์ด๋ ์คํ์ผ ์ ์ */ }; const joystickBallStyle = { /* ์กฐ์ด์คํฑ ๋ณผ ์คํ์ผ ์ ์ */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'joystick', // ๋๋ 'keyboard', 'gamepad' ๋ฑ scrollBlock: true, // ๋ชจ๋ฐ์ผ ์ฅ์น์์ ์์น ์งํฐ ๋ฐฉ์ง }} > <Canvas> <Physics> <Joystick joystickStyle={joystickStyle} joystickBallStyle={joystickBallStyle} /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ์กฐ์ด์คํฑ ์ธํฐํ์ด์ค: ๋ชจ๋ฐ์ผ ์ฅ์น์์ ์์ฐ์ค๋ฌ์ด ์กฐ์ด์คํฑ ์ ๋ ฅ์ ์ ๊ณตํฉ๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง:
joystickStyle
๊ณผjoystickBallStyle
์ ํตํด ์ธ๊ด์ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค. - ๋ฐ์ํ ์ธํฐ๋์ : ํฐ์น ์ด๋ฒคํธ์ ๋ฐ์ํ์ฌ ์บ๋ฆญํฐ ์์ง์์ ์ ์ดํฉ๋๋ค.
-
์ค๋ช : ํค๋ณด๋ ์ปจํธ๋กค๋ฌ ์ธํฐํ์ด์ค๋ฅผ ์๊ฐ์ ์ผ๋ก ํํํ๋ ์ปดํฌ๋ํธ๋ก, ๊ฐ ํค์ ๋์์ ์๊ฐ์ ์ผ๋ก ํ์ํฉ๋๋ค.
-
์ฃผ์ ๊ธฐ๋ฅ:
- ํค๋ณด๋ ํค ์๊ฐํ: ๋ชจ๋ ํค๋ณด๋ ํค๋ฅผ ๋ฐฐ์ด ํ์์ผ๋ก ์๊ฐํํฉ๋๋ค.
- ์ํ ์ ๋๋ฉ์ด์ : ํ์ฌ ํ์ฑํ๋ ํค์ ๊ด๋ จ ๋์์ ๋ค๋ฅด๊ฒ ํ์ํ์ฌ ์ฌ์ฉ์ ํผ๋๋ฐฑ์ ์ ๊ณตํฉ๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง: ํค ์บก์ ์ธ๊ด์ ์ปค์คํฐ๋ง์ด์งํ ์ ์๋ ๋ค์ํ ์คํ์ผ ์์ฑ์ ์ ๊ณตํฉ๋๋ค.
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, KeyBoardToolTip } from '../../../src'; export default function App() { const keyBoardToolTipInnerStyle = { /* ๋ด๋ถ ํดํ ์คํ์ผ ์ ์ */ }; const selectedKeyCapStyle = { /* ์ ํ๋ ํค ์คํ์ผ ์ ์ */ }; const notSelectedkeyCapStyle = { /* ์ ํ๋์ง ์์ ํค ์คํ์ผ ์ ์ */ }; const keyCapStyle = { /* ํค ์บก ๊ธฐ๋ณธ ์คํ์ผ ์ ์ */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', // ์ปจํธ๋กค๋ฌ ๋ชจ๋๋ฅผ 'keyboard'๋ก ์ค์ }} > <Canvas> <Physics> <KeyBoardToolTip keyBoardToolTipInnerStyle={keyBoardToolTipInnerStyle} selectedKeyCapStyle={selectedKeyCapStyle} notSelectedkeyCapStyle={notSelectedkeyCapStyle} keyCapStyle={keyCapStyle} /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ค๋ช : ์ฌ์ฉ์์ ์์น์ ์ฃผ๋ณ ํ๊ฒฝ์ 3D ์ธ๊ณ ๋ด์ ์์ ์ง๋ ํํ๋ก ํ์ํ๋ ์ปดํฌ๋ํธ์ ๋๋ค.
-
Props:
Prop Name Type Required Description Default Value minimapStyle
object (styles) Optional ๋ฏธ๋๋งต์ ์ ์ฒด ์คํ์ผ undefined
innerStyle
object (styles) Optional ๋ฏธ๋๋งต ๋ด๋ถ ์ปจํ ์ด๋ ์คํ์ผ undefined
textStyle
object (styles) Optional ๋ฏธ๋๋งต ๋ด ํ ์คํธ ์คํ์ผ undefined
objectStyle
object (styles) Optional ๋ฏธ๋๋งต ๋ด ๊ฐ์ฒด ์คํ์ผ undefined
avatarStyle
object (styles) Optional ๋ฏธ๋๋งต ๋ด ์๋ฐํ ์คํ์ผ undefined
scaleStyle
object (styles) Optional ๋ฏธ๋๋งต์ ์ค์ผ์ผ ์ปจํธ๋กค ์คํ์ผ undefined
directionStyle
object (styles) Optional ๋ฏธ๋๋งต ๋ด ๋ฐฉํฅ ํ์ ์คํ์ผ undefined
plusMinusStyle
object (styles) Optional ๋ฏธ๋๋งต์ ํ๋ฌ์ค/๋ง์ด๋์ค ์ปจํธ๋กค ์คํ์ผ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, MiniMap } from '../../../src'; export default function App() { const minimapStyle = { /* ๋ฏธ๋๋งต ์คํ์ผ ์ ์ */ }; const innerStyle = { /* ๋ด๋ถ ์คํ์ผ ์ ์ */ }; // ๊ธฐํ ์คํ์ผ ์์ฑ ์ ์ return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <MiniMap minimapStyle={minimapStyle} innerStyle={innerStyle} // ๊ธฐํ ์คํ์ผ ์์ฑ ์ ๋ฌ /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ๋์ ์ค์ผ์ผ๋ง: ์ฌ์ฉ์๊ฐ ๋ฏธ๋๋งต์ ํฌ๊ธฐ๋ฅผ ๋์ ์ผ๋ก ์กฐ์ ํ ์ ์์ต๋๋ค.
- ๋ฐฉํฅ ํ์๊ธฐ: ๋, ์, ๋จ, ๋ถ ๋ฐฉํฅ์ ์๊ฐ์ ์ผ๋ก ํ์ํฉ๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง: ๋ฏธ๋๋งต ๋ฐ ๋ด๋ถ ์์๋ค์ ์ธ๊ด์ ๋ค์ํ ์คํ์ผ ์์ฑ์ ํตํด ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค.
- ๋ง์ฐ์ค ํ ์ง์: ๋ง์ฐ์ค ํ ์ ์ฌ์ฉํ์ฌ ๋ฏธ๋๋งต์ ์ค์ผ์ผ์ ์กฐ์ ํ ์ ์์ต๋๋ค.
-
์ค๋ช : ๋ชจ๋ฐ์ผ ํ๊ฒฝ์ ์ํ GameBoy ์คํ์ผ์ ๋ฐฉํฅ ๋ฒํผ์ ๋ชจ๋ฐฉํ ์ปจํธ๋กค๋ฌ ์ธํฐํ์ด์ค์ ๋๋ค.
-
Props:
Prop Name Type Required Description Default Value gamePadStyle
object (styles) Optional GamePad ์ปจํ ์ด๋ ์คํ์ผ undefined
gamePadButtonStyle
object (styles) Optional ๊ฐ๋ณ GamePad ๋ฒํผ ์คํ์ผ undefined
label
string Optional ๋ฒํผ์ ๋ํ ์ปค์คํ ๋ ์ด๋ธ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, GameBoy } from '../../../src'; export default function App() { const gamePadStyle = { /* GamePad ์ปจํ ์ด๋ ์คํ์ผ ์ ์ */ }; const gamePadButtonStyle = { /* GamePad ๋ฒํผ ์คํ์ผ ์ ์ */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'gameboy', // ์ปจํธ๋กค๋ฌ ๋ชจ๋๋ฅผ 'gameboy'๋ก ์ค์ }} > <Canvas> <Physics> <GameBoy gamePadStyle={gamePadStyle} gamePadButtonStyle={gamePadButtonStyle} /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ๋ฐฉํฅ ๋ฒํผ:
GameBoyDirections
๋ฐฐ์ด์ ๊ธฐ๋ฐ์ผ๋ก ๋ฐฉํฅ ๋ฒํผ์ ๊ตฌํํฉ๋๋ค. - ์ปจํ
์คํธ ์ธ์ ๋ ๋๋ง:
GaesupWorldContext
์mode.controller
๊ฐ์ ๋ฐ๋ผ ์ปดํฌ๋ํธ๋ฅผ ๋ ๋๋งํฉ๋๋ค. - ์ปค์คํฐ๋ง์ด์ง:
gamePadStyle
๊ณผgamePadButtonStyle
์ ํตํด ์ธ๊ด์ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค.
- ๋ฐฉํฅ ๋ฒํผ:
-
์ค๋ช : ๋ค์ํ ์ปจํธ๋กค๋ฌ ๋ชจ๋๋ฅผ ์ง์ํ๋ ์ปค์คํฐ๋ง์ด์ง ๊ฐ๋ฅํ ์ปจํธ๋กค๋ฌ ์ธํฐํ์ด์ค์ ๋๋ค. ์กฐ์ด์คํฑ, GameBoy ๋ฑ ๋ค์ํ ์ ๋ ฅ ์๋๋ฆฌ์ค์ ์ ์ฐํ๊ฒ ๋์ํ ์ ์์ต๋๋ค.
-
Props:
Prop Name Type Required Description Default Value gamePadStyle
object (styles) Optional GamePad ์ปจํ ์ด๋ ์คํ์ผ undefined
gamePadButtonStyle
object (styles) Optional ๊ฐ๋ณ GamePad ๋ฒํผ ์คํ์ผ undefined
label
string Optional ๋ฒํผ์ ๋ํ ์ปค์คํ ๋ ์ด๋ธ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, GamePad } from '../../../src'; export default function App() { const gamePadStyle = { /* GamePad ์ปจํ ์ด๋ ์คํ์ผ ์ ์ */ }; const gamePadButtonStyle = { /* GamePad ๋ฒํผ ์คํ์ผ ์ ์ */ }; return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'gamepad', // ๋๋ 'joystick', 'gameboy' ๋ฑ }} > <Canvas> <Physics> <GamePad gamePadStyle={gamePadStyle} gamePadButtonStyle={gamePadButtonStyle} /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ๋์ ๋ฒํผ ๋ ๋๋ง:
GaesupWorldContext
์control
๊ฐ์ฒด๋ฅผ ๊ธฐ๋ฐ์ผ๋ก ๋ฒํผ์ ๋์ ์ผ๋ก ์์ฑํฉ๋๋ค. - ๋ฒ์ฉ ์ฌ์ฉ: ์กฐ์ด์คํฑ, GameBoy ๋ฑ ๋ค์ํ ์ปจํธ๋กค๋ฌ ๋ชจ๋๋ฅผ ์ง์ํ์ฌ ๋ค์ํ ์ ๋ ฅ ์๋๋ฆฌ์ค์ ๋์ํฉ๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง:
gamePadStyle
๊ณผgamePadButtonStyle
์ ํตํด ์ธ๊ด์ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค.
- ๋์ ๋ฒํผ ๋ ๋๋ง:
-
์ค๋ช : ์นด๋ฉ๋ผ๋ฅผ ํน์ ์์น๋ก ์ด๋์ํค๊ณ ์ค์ ์ ์ดํ๋ ๋ฒํผ ์ปดํฌ๋ํธ์ ๋๋ค. ์ฃผ๋ก ํน์ ํ๊ฒ์ผ๋ก์ ์ค์ธ/์ค์์์ ์ฌ์ฉ๋ฉ๋๋ค.
-
Props:
Prop Name Type Required Description Default Value position
THREE.Vector3 Required ์นด๋ฉ๋ผ๊ฐ ์ด๋ํ ๋ชฉํ ์์น None children
React.ReactNode Optional ๋ฒํผ ๋ด์ ๋ ๋๋งํ React ๋ ธ๋ undefined
target
THREE.Vector3 Optional ์นด๋ฉ๋ผ๊ฐ ๋ฐ๋ผ๋ณผ ํ๊ฒ ์์น undefined
keepBlocking
boolean Optional ์นด๋ฉ๋ผ ์ด๋ ์ค ๋ธ๋กํน์ ์ ์งํ ์ง ์ฌ๋ถ undefined
zoomButtonStyle
object (styles) Optional ZoomButton ์ปดํฌ๋ํธ์ ์คํ์ผ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, ZoomButton } from '../../../src'; import * as THREE from 'three'; export default function App() { return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <ZoomButton position={new THREE.Vector3(0, 0, 5)} target={new THREE.Vector3(0, 0, 0)} zoomButtonStyle={{ backgroundColor: 'blue', color: 'white' }} > Zoom In </ZoomButton> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ์นด๋ฉ๋ผ ์ด๋: ๋ฒํผ ํด๋ฆญ ์ ์นด๋ฉ๋ผ๋ฅผ ์ง์ ๋ ์์น๋ก ์ด๋์ํต๋๋ค.
- ์ค ์ ์ด: ์นด๋ฉ๋ผ์ ์ค ๋ ๋ฒจ์ ์กฐ์ ํ ์ ์์ต๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง:
zoomButtonStyle
์ ํตํด ๋ฒํผ์ ์ธ๊ด์ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค.
-
์ค๋ช : ํด๋ฆญ ๊ฐ๋ฅํ ํฌํ์ ํตํด ์ฌ์ฉ์๋ฅผ ์ง์ ๋ ์์น๋ก ํ ๋ ํฌํธํ ์ ์๋ ์ปดํฌ๋ํธ์ ๋๋ค. ์ธํฐ๋ํฐ๋ธํ ํ ๋ ํฌํ ์ด์ ํฌ์ธํธ๋ฅผ ์์ฑํ๋ ๋ฐ ์ฌ์ฉ๋ฉ๋๋ค.
-
Props:
Prop Name Type Required Description Default Value text
string Optional ํฌํ์ ํ์ํ ํ ์คํธ undefined
position
THREE.Vector3 Required ํ ๋ ํฌํธํ ๋ชฉํ ์์น None teleportStyle
CSSProperties Optional ํฌํ์ ์ธ๊ด์ ์ปค์คํฐ๋ง์ด์งํ๊ธฐ ์ํ CSS ์คํ์ผ undefined
-
์ฌ์ฉ ์์ :
import React from 'react'; import { Canvas } from '@react-three/fiber'; import { Physics } from '@react-three/rapier'; import { GaesupWorld, teleport } from '../../../src'; import * as THREE from 'three'; export default function App() { return ( <GaesupWorld url={{ characterUrl: 'https://your-s3-bucket/gaesupyee.glb', }} mode={{ controller: 'keyboard', }} > <Canvas> <Physics> <teleport text="Teleport" position={new THREE.Vector3(10, 0, 5)} teleportStyle={{ backgroundColor: "blue", color: "white" }} /> {/* ๋ค๋ฅธ ์ปดํฌ๋ํธ */} </Physics> </Canvas> </GaesupWorld> ); }
-
์ฃผ์ ๊ธฐ๋ฅ:
- ํ ๋ ํฌํธ ๊ธฐ๋ฅ: ๋ฒํผ ํด๋ฆญ ์ ์นด๋ฉ๋ผ์ ์บ๋ฆญํฐ๋ฅผ ์ง์ ๋ ์์น๋ก ์ด๋์ํต๋๋ค.
- ์ปค์คํฐ๋ง์ด์ง:
teleportStyle
์ ํตํด ํฌํ์ ์ธ๊ด์ ์์ ๋กญ๊ฒ ์ปค์คํฐ๋ง์ด์งํ ์ ์์ต๋๋ค. - ํ ์คํธ ํ์: ํฌํ์ ํ์ํ ํ ์คํธ๋ฅผ ํตํด ์ฌ์ฉ์์๊ฒ ๋ช ํํ ์๋ด๋ฅผ ์ ๊ณตํฉ๋๋ค.
Gaesup World์ ๊ธฐ์ฌํ๊ณ ์ถ์ผ์ ๊ฐ์? ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ผ์ฃผ์ธ์:
-
ํ๋ก์ ํธ ํฌํฌ(Fork): GitHub์์ ์ด ์ ์ฅ์๋ฅผ ํฌํฌํ์ธ์.
-
๊ฐ๋ฐ ๋ธ๋์น๋ก ์ ํ:
dev
๋ธ๋์น๋ก ์ด๋ํฉ๋๋ค.git checkout dev
-
๋ณ๊ฒฝ ์ฌํญ ์ปค๋ฐ: ๋ณ๊ฒฝํ ๋ด์ฉ์ ์ปค๋ฐํฉ๋๋ค.
git commit -m 'Add some AmazingFeature'
-
๋ธ๋์น์ ํธ์: ๋ณ๊ฒฝํ ๋ธ๋์น๋ฅผ ์๊ฒฉ ์ ์ฅ์์ ํธ์ํฉ๋๋ค.
git push origin dev
-
ํ ๋ฆฌํ์คํธ ์์ฑ: GitHub์์ ํ ๋ฆฌํ์คํธ๋ฅผ ์์ฑํ์ฌ ๋ณ๊ฒฝ ์ฌํญ์ ์ ์ถํฉ๋๋ค.
์ด ํ๋ก์ ํธ๋ MIT ๋ผ์ด์ ์ค ํ์ ๋ฐฐํฌ๋ฉ๋๋ค. ์์ธํ ๋ด์ฉ์ LICENSE๋ฅผ ์ฐธ๊ณ ํ์ธ์.
Gaesup World๋ ์ง์์ ์ผ๋ก ์ ๋ฐ์ดํธ๋๊ณ ์์ผ๋ฉฐ, ์ฌ์ฉ์ ํผ๋๋ฐฑ์ ๋ฐํ์ผ๋ก ๊ธฐ๋ฅ์ด ๊ฐ์ ๋๊ณ ์์ต๋๋ค. ๋ ์์ธํ ์ ๋ณด๋ ๋์์ด ํ์ํ์๋ค๋ฉด GitHub ์ด์ ํธ๋์ปค๋ฅผ ํตํด ๋ฌธ์ํด ์ฃผ์ธ์.
Gaesup World์ ํจ๊ป ๋ชฐ์ ๊ฐ ์๋ ์น 3D ํ๊ฒฝ์ ๊ตฌ์ถํด ๋ณด์ธ์!