gaesup-world 0.9.58 → 0.9.59
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 +20 -20
- package/index.py +81 -0
- package/index.ts +1 -3
- package/{dist/gaesup/tools/minimap/style.css.ts → output.md} +103 -0
- package/package.json +1 -1
- package/yarnrc.yml +1 -1
- package/dist/gaesup/animation/actions.ts +0 -161
- package/dist/gaesup/camera/control/normal.ts +0 -27
- package/dist/gaesup/camera/control/orbit.ts +0 -37
- package/dist/gaesup/camera/index.tsx +0 -29
- package/dist/gaesup/camera/type.ts +0 -14
- package/dist/gaesup/component/active/airplane/index.tsx +0 -17
- package/dist/gaesup/component/active/airplane/type.ts +0 -4
- package/dist/gaesup/component/active/character/index.tsx +0 -35
- package/dist/gaesup/component/active/character/type.ts +0 -13
- package/dist/gaesup/component/active/vehicle/index.tsx +0 -17
- package/dist/gaesup/component/active/vehicle/type.ts +0 -4
- package/dist/gaesup/component/index.tsx +0 -65
- package/dist/gaesup/component/inner/airplane/index.tsx +0 -21
- package/dist/gaesup/component/inner/airplane/type.ts +0 -8
- package/dist/gaesup/component/inner/character/index.tsx +0 -22
- package/dist/gaesup/component/inner/character/type.ts +0 -14
- package/dist/gaesup/component/inner/common/InnerGroupRef.tsx +0 -56
- package/dist/gaesup/component/inner/common/OuterGroupRef.tsx +0 -19
- package/dist/gaesup/component/inner/common/RigidbodyRef.tsx +0 -170
- package/dist/gaesup/component/inner/common/calc.ts +0 -16
- package/dist/gaesup/component/inner/common/partsGroupRef.tsx +0 -66
- package/dist/gaesup/component/inner/common/setGroundRay.ts +0 -25
- package/dist/gaesup/component/inner/common/type.ts +0 -66
- package/dist/gaesup/component/inner/rider/index.tsx +0 -79
- package/dist/gaesup/component/inner/vehicle/collider.tsx +0 -40
- package/dist/gaesup/component/inner/vehicle/index.tsx +0 -44
- package/dist/gaesup/component/inner/vehicle/type.ts +0 -8
- package/dist/gaesup/component/inner/vehicle/wheels.tsx +0 -124
- package/dist/gaesup/component/passive/airplane/index.tsx +0 -65
- package/dist/gaesup/component/passive/airplane/type.ts +0 -3
- package/dist/gaesup/component/passive/character/index.tsx +0 -49
- package/dist/gaesup/component/passive/character/type.ts +0 -6
- package/dist/gaesup/component/passive/type.ts +0 -51
- package/dist/gaesup/component/passive/vehicle/index.tsx +0 -45
- package/dist/gaesup/component/passive/vehicle/type.ts +0 -3
- package/dist/gaesup/component/type.ts +0 -16
- package/dist/gaesup/controller/context/index.ts +0 -55
- package/dist/gaesup/controller/context/reducer.ts +0 -18
- package/dist/gaesup/controller/context/type.ts +0 -42
- package/dist/gaesup/controller/index.tsx +0 -116
- package/dist/gaesup/controller/initialize/callback/index.ts +0 -88
- package/dist/gaesup/controller/initialize/callback/type.ts +0 -35
- package/dist/gaesup/controller/initialize/index.ts +0 -90
- package/dist/gaesup/controller/type.ts +0 -127
- package/dist/gaesup/gaesupProps/index.tsx +0 -65
- package/dist/gaesup/hooks/useClicker/index.ts +0 -38
- package/dist/gaesup/hooks/useFocus/index.tsx +0 -129
- package/dist/gaesup/hooks/useGaesupAnimation/index.tsx +0 -128
- package/dist/gaesup/hooks/useGaesupController/index.ts +0 -25
- package/dist/gaesup/hooks/useGaesupGltf/index.tsx +0 -78
- package/dist/gaesup/hooks/useMovePoint/index.ts +0 -34
- package/dist/gaesup/hooks/usePushKey/index.ts +0 -26
- package/dist/gaesup/hooks/useRideable/index.tsx +0 -121
- package/dist/gaesup/hooks/useRideable/type.ts +0 -20
- package/dist/gaesup/hooks/useTeleport/index.tsx +0 -19
- package/dist/gaesup/hooks/useZoom/index.tsx +0 -24
- package/dist/gaesup/physics/airplane/damping.ts +0 -10
- package/dist/gaesup/physics/airplane/direction.ts +0 -63
- package/dist/gaesup/physics/airplane/gravity.ts +0 -14
- package/dist/gaesup/physics/airplane/impulse.ts +0 -26
- package/dist/gaesup/physics/airplane/index.tsx +0 -16
- package/dist/gaesup/physics/airplane/innerCalc.ts +0 -27
- package/dist/gaesup/physics/airplane/landing.ts +0 -28
- package/dist/gaesup/physics/character/direction.ts +0 -64
- package/dist/gaesup/physics/character/impulse.ts +0 -35
- package/dist/gaesup/physics/character/index.tsx +0 -14
- package/dist/gaesup/physics/character/innerCalc.ts +0 -27
- package/dist/gaesup/physics/character/queue.ts +0 -52
- package/dist/gaesup/physics/character/stop.ts +0 -13
- package/dist/gaesup/physics/check/ground.ts +0 -28
- package/dist/gaesup/physics/check/index.ts +0 -14
- package/dist/gaesup/physics/check/moving.ts +0 -15
- package/dist/gaesup/physics/check/push.ts +0 -10
- package/dist/gaesup/physics/check/riding.ts +0 -12
- package/dist/gaesup/physics/check/rotate.ts +0 -13
- package/dist/gaesup/physics/index.ts +0 -80
- package/dist/gaesup/physics/type.ts +0 -57
- package/dist/gaesup/physics/vehicle/damping.ts +0 -12
- package/dist/gaesup/physics/vehicle/direction.ts +0 -27
- package/dist/gaesup/physics/vehicle/impulse.ts +0 -28
- package/dist/gaesup/physics/vehicle/index.tsx +0 -14
- package/dist/gaesup/physics/vehicle/innerCalc.ts +0 -17
- package/dist/gaesup/physics/vehicle/landing.ts +0 -28
- package/dist/gaesup/tools/clicker/index.tsx +0 -60
- package/dist/gaesup/tools/gamepad/GamePadButton.tsx +0 -47
- package/dist/gaesup/tools/gamepad/index.tsx +0 -51
- package/dist/gaesup/tools/gamepad/style.css.ts +0 -63
- package/dist/gaesup/tools/gamepad/type.ts +0 -17
- package/dist/gaesup/tools/jumpPortal/index.tsx +0 -24
- package/dist/gaesup/tools/jumpPortal/style.css.ts +0 -18
- package/dist/gaesup/tools/jumpPortal/type.ts +0 -8
- package/dist/gaesup/tools/minimap/index.tsx +0 -233
- package/dist/gaesup/tools/minimap/type.ts +0 -44
- package/dist/gaesup/tools/rideable/index.tsx +0 -72
- package/dist/gaesup/tools/rideable/type.ts +0 -27
- package/dist/gaesup/tools/type.ts +0 -3
- package/dist/gaesup/utils/context.ts +0 -5
- package/dist/gaesup/utils/getTag.ts +0 -7
- package/dist/gaesup/utils/index.ts +0 -3
- package/dist/gaesup/utils/innerHtml.tsx +0 -22
- package/dist/gaesup/utils/ray.ts +0 -23
- package/dist/gaesup/utils/ref.ts +0 -17
- package/dist/gaesup/utils/type.ts +0 -6
- package/dist/gaesup/utils/vector.ts +0 -65
- package/dist/gaesup/world/context/index.ts +0 -115
- package/dist/gaesup/world/context/reducer.ts +0 -18
- package/dist/gaesup/world/context/type.ts +0 -210
- package/dist/gaesup/world/index.tsx +0 -17
- package/dist/gaesup/world/initalize/index.ts +0 -42
- package/dist/gaesup/world/type.ts +0 -27
- package/dist/index.ts +0 -24
package/README.md
CHANGED
|
@@ -731,17 +731,17 @@ The **Passive** component defines objects that do not require interaction, such
|
|
|
731
731
|
|
|
732
732
|
---
|
|
733
733
|
|
|
734
|
-
####
|
|
734
|
+
#### teleport
|
|
735
735
|
|
|
736
736
|
- **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.
|
|
737
737
|
|
|
738
738
|
- **Props**:
|
|
739
739
|
|
|
740
|
-
| Prop Name
|
|
741
|
-
|
|
|
742
|
-
| `text`
|
|
743
|
-
| `position`
|
|
744
|
-
| `
|
|
740
|
+
| Prop Name | Type | Required | Description | Default Value |
|
|
741
|
+
| --------------- | ------------- | -------- | ----------------------------------------------------------- | ------------- |
|
|
742
|
+
| `text` | string | Optional | The text to display on the portal. | `undefined` |
|
|
743
|
+
| `position` | THREE.Vector3 | Required | The target position to teleport to using a `THREE.Vector3`. | None |
|
|
744
|
+
| `teleportStyle` | CSSProperties | Optional | CSS styles for customizing the appearance of the portal. | `undefined` |
|
|
745
745
|
|
|
746
746
|
- **Usage Example**:
|
|
747
747
|
|
|
@@ -749,7 +749,7 @@ The **Passive** component defines objects that do not require interaction, such
|
|
|
749
749
|
import React from 'react';
|
|
750
750
|
import { Canvas } from '@react-three/fiber';
|
|
751
751
|
import { Physics } from '@react-three/rapier';
|
|
752
|
-
import { GaesupWorld,
|
|
752
|
+
import { GaesupWorld, teleport } from '../../../src';
|
|
753
753
|
import * as THREE from 'three';
|
|
754
754
|
|
|
755
755
|
export default function App() {
|
|
@@ -764,10 +764,10 @@ The **Passive** component defines objects that do not require interaction, such
|
|
|
764
764
|
>
|
|
765
765
|
<Canvas>
|
|
766
766
|
<Physics>
|
|
767
|
-
<
|
|
767
|
+
<teleport
|
|
768
768
|
text="Teleport"
|
|
769
769
|
position={new THREE.Vector3(10, 0, 5)}
|
|
770
|
-
|
|
770
|
+
teleportStyle={{ backgroundColor: "blue", color: "white" }}
|
|
771
771
|
/>
|
|
772
772
|
{/* Other components */}
|
|
773
773
|
</Physics>
|
|
@@ -779,7 +779,7 @@ The **Passive** component defines objects that do not require interaction, such
|
|
|
779
779
|
|
|
780
780
|
- **Key Features**:
|
|
781
781
|
- **Teleport Functionality**: Moves the camera and character to the specified position upon clicking the portal.
|
|
782
|
-
- **Custom Styling**: Customize the portal's appearance using `
|
|
782
|
+
- **Custom Styling**: Customize the portal's appearance using `teleportStyle`.
|
|
783
783
|
- **Text Display**: Displays text on the portal to guide users.
|
|
784
784
|
|
|
785
785
|
---
|
|
@@ -1543,17 +1543,17 @@ export default function App() {
|
|
|
1543
1543
|
|
|
1544
1544
|
---
|
|
1545
1545
|
|
|
1546
|
-
####
|
|
1546
|
+
#### teleport
|
|
1547
1547
|
|
|
1548
1548
|
- **설명**: 클릭 가능한 포탈을 통해 사용자를 지정된 위치로 텔레포트할 수 있는 컴포넌트입니다. 인터랙티브한 텔레포테이션 포인트를 생성하는 데 사용됩니다.
|
|
1549
1549
|
|
|
1550
1550
|
- **Props**:
|
|
1551
1551
|
|
|
1552
|
-
| Prop Name
|
|
1553
|
-
|
|
|
1554
|
-
| `text`
|
|
1555
|
-
| `position`
|
|
1556
|
-
| `
|
|
1552
|
+
| Prop Name | Type | Required | Description | Default Value |
|
|
1553
|
+
| --------------- | ------------- | -------- | ---------------------------------------------- | ------------- |
|
|
1554
|
+
| `text` | string | Optional | 포탈에 표시할 텍스트 | `undefined` |
|
|
1555
|
+
| `position` | THREE.Vector3 | Required | 텔레포트할 목표 위치 | None |
|
|
1556
|
+
| `teleportStyle` | CSSProperties | Optional | 포탈의 외관을 커스터마이징하기 위한 CSS 스타일 | `undefined` |
|
|
1557
1557
|
|
|
1558
1558
|
- **사용 예제**:
|
|
1559
1559
|
|
|
@@ -1561,7 +1561,7 @@ export default function App() {
|
|
|
1561
1561
|
import React from 'react';
|
|
1562
1562
|
import { Canvas } from '@react-three/fiber';
|
|
1563
1563
|
import { Physics } from '@react-three/rapier';
|
|
1564
|
-
import { GaesupWorld,
|
|
1564
|
+
import { GaesupWorld, teleport } from '../../../src';
|
|
1565
1565
|
import * as THREE from 'three';
|
|
1566
1566
|
|
|
1567
1567
|
export default function App() {
|
|
@@ -1576,10 +1576,10 @@ export default function App() {
|
|
|
1576
1576
|
>
|
|
1577
1577
|
<Canvas>
|
|
1578
1578
|
<Physics>
|
|
1579
|
-
<
|
|
1579
|
+
<teleport
|
|
1580
1580
|
text="Teleport"
|
|
1581
1581
|
position={new THREE.Vector3(10, 0, 5)}
|
|
1582
|
-
|
|
1582
|
+
teleportStyle={{ backgroundColor: "blue", color: "white" }}
|
|
1583
1583
|
/>
|
|
1584
1584
|
{/* 다른 컴포넌트 */}
|
|
1585
1585
|
</Physics>
|
|
@@ -1591,7 +1591,7 @@ export default function App() {
|
|
|
1591
1591
|
|
|
1592
1592
|
- **주요 기능**:
|
|
1593
1593
|
- **텔레포트 기능**: 버튼 클릭 시 카메라와 캐릭터를 지정된 위치로 이동시킵니다.
|
|
1594
|
-
- **커스터마이징**: `
|
|
1594
|
+
- **커스터마이징**: `teleportStyle`을 통해 포탈의 외관을 자유롭게 커스터마이징할 수 있습니다.
|
|
1595
1595
|
- **텍스트 표시**: 포탈에 표시할 텍스트를 통해 사용자에게 명확한 안내를 제공합니다.
|
|
1596
1596
|
|
|
1597
1597
|
---
|
package/index.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
def get_language(extension):
|
|
4
|
+
"""
|
|
5
|
+
파일 확장자에 따라 코드 블록의 언어를 반환합니다.
|
|
6
|
+
"""
|
|
7
|
+
mapping = {
|
|
8
|
+
'.ts': 'typescript',
|
|
9
|
+
'.tsx': 'tsx',
|
|
10
|
+
'.css.ts': 'typescript', # CSS-in-JS 로직을 고려하여 'typescript'로 지정
|
|
11
|
+
}
|
|
12
|
+
return mapping.get(extension, '')
|
|
13
|
+
|
|
14
|
+
def extract_code_separated(folder_path, output_md, supported_extensions):
|
|
15
|
+
"""
|
|
16
|
+
지정된 폴더 내의 특정 확장자를 가진 파일들을 확장자별로 그룹화하여 Markdown 파일로 저장합니다.
|
|
17
|
+
"""
|
|
18
|
+
# 확장자별 파일 목록 초기화
|
|
19
|
+
files_by_extension = {ext: [] for ext in supported_extensions}
|
|
20
|
+
|
|
21
|
+
# 폴더를 재귀적으로 탐색하여 파일 분류
|
|
22
|
+
for root, dirs, files in os.walk(folder_path):
|
|
23
|
+
for file in files:
|
|
24
|
+
for ext in supported_extensions:
|
|
25
|
+
if file.endswith(ext):
|
|
26
|
+
relative_path = os.path.relpath(os.path.join(root, file), folder_path)
|
|
27
|
+
files_by_extension[ext].append(relative_path)
|
|
28
|
+
break
|
|
29
|
+
|
|
30
|
+
# Markdown 파일 열기
|
|
31
|
+
with open(output_md, 'w', encoding='utf-8') as md_file:
|
|
32
|
+
md_file.write('# 코드 추출 결과\n\n')
|
|
33
|
+
|
|
34
|
+
for ext in supported_extensions:
|
|
35
|
+
if files_by_extension[ext]:
|
|
36
|
+
# 섹션 제목 작성
|
|
37
|
+
if ext == '.ts':
|
|
38
|
+
section_title = '## TypeScript Files (.ts)'
|
|
39
|
+
elif ext == '.tsx':
|
|
40
|
+
section_title = '## TypeScript React Files (.tsx)'
|
|
41
|
+
elif ext == '.css.ts':
|
|
42
|
+
section_title = '## CSS TypeScript Files (.css.ts)'
|
|
43
|
+
else:
|
|
44
|
+
section_title = f'## {ext} Files'
|
|
45
|
+
|
|
46
|
+
md_file.write(f'{section_title}\n\n')
|
|
47
|
+
|
|
48
|
+
for relative_path in files_by_extension[ext]:
|
|
49
|
+
file_path = os.path.join(folder_path, relative_path)
|
|
50
|
+
language = get_language(ext)
|
|
51
|
+
|
|
52
|
+
# 파일 내용 읽기
|
|
53
|
+
try:
|
|
54
|
+
with open(file_path, 'r', encoding='utf-8') as f:
|
|
55
|
+
code = f.read()
|
|
56
|
+
except Exception as e:
|
|
57
|
+
print(f"파일을 읽는 중 오류 발생: {file_path}\n오류 내용: {e}")
|
|
58
|
+
continue
|
|
59
|
+
|
|
60
|
+
# 파일명을 소제목으로 추가
|
|
61
|
+
md_file.write(f'### {relative_path}\n\n')
|
|
62
|
+
|
|
63
|
+
# 코드 블록 추가
|
|
64
|
+
md_file.write(f'```{language}\n{code}\n```\n\n')
|
|
65
|
+
|
|
66
|
+
print(f"코드 추출이 완료되었습니다. 출력 파일: {output_md}")
|
|
67
|
+
|
|
68
|
+
if __name__ == "__main__":
|
|
69
|
+
# 파일 확장자를 리스트로 지정
|
|
70
|
+
supported_extensions = [".css.ts"] # 필요에 따라 확장자 추가
|
|
71
|
+
|
|
72
|
+
# 폴더 경로와 출력 Markdown 파일 경로 설정
|
|
73
|
+
folder_path = './src' # 코드 추출할 폴더 경로
|
|
74
|
+
output_md = './output.md' # 출력할 Markdown 파일 경로
|
|
75
|
+
|
|
76
|
+
# 폴더 존재 여부 확인
|
|
77
|
+
if not os.path.isdir(folder_path):
|
|
78
|
+
print(f"에러: 지정된 폴더가 존재하지 않습니다: {folder_path}")
|
|
79
|
+
exit(1)
|
|
80
|
+
|
|
81
|
+
extract_code_separated(folder_path, output_md, supported_extensions)
|
package/index.ts
CHANGED
|
@@ -5,9 +5,6 @@ export {
|
|
|
5
5
|
GaesupController,
|
|
6
6
|
GaesupWorld,
|
|
7
7
|
GamePad,
|
|
8
|
-
JoyStick,
|
|
9
|
-
JumpPortal,
|
|
10
|
-
KeyBoardToolTip,
|
|
11
8
|
MiniMap,
|
|
12
9
|
PassiveAirplane,
|
|
13
10
|
PassiveCharacter,
|
|
@@ -17,6 +14,7 @@ export {
|
|
|
17
14
|
V3,
|
|
18
15
|
V30,
|
|
19
16
|
V31,
|
|
17
|
+
teleport,
|
|
20
18
|
useClicker,
|
|
21
19
|
useGaesupAnimation,
|
|
22
20
|
useGaesupController,
|
|
@@ -1,3 +1,103 @@
|
|
|
1
|
+
# 코드 추출 결과
|
|
2
|
+
|
|
3
|
+
## CSS TypeScript Files (.css.ts)
|
|
4
|
+
|
|
5
|
+
### gaesup/tools/gamepad/style.css.ts
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// style.css.ts
|
|
9
|
+
import { globalStyle, style } from "@vanilla-extract/css";
|
|
10
|
+
|
|
11
|
+
export const gamePad = style({
|
|
12
|
+
display: "grid",
|
|
13
|
+
alignItems: "center",
|
|
14
|
+
justifyContent: "center",
|
|
15
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
16
|
+
gridTemplateRows: "repeat(3, 1fr)",
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const padButton = style({
|
|
20
|
+
display: "flex",
|
|
21
|
+
justifyContent: "center",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
position: "relative",
|
|
24
|
+
width: "5rem",
|
|
25
|
+
height: "5rem",
|
|
26
|
+
borderRadius: "50%",
|
|
27
|
+
fontSize: "1rem",
|
|
28
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
29
|
+
color: "white",
|
|
30
|
+
boxShadow: "0 0 0.5rem rgba(0, 0, 0, 0.5)",
|
|
31
|
+
cursor: "pointer",
|
|
32
|
+
transition: "all 0.3s ease-in",
|
|
33
|
+
margin: "0.5rem",
|
|
34
|
+
selectors: {
|
|
35
|
+
"&:hover": {
|
|
36
|
+
boxShadow: "0 0 1rem rgba(0, 0, 0, 0.5)",
|
|
37
|
+
},
|
|
38
|
+
"&::after": {
|
|
39
|
+
content: '""',
|
|
40
|
+
position: "absolute",
|
|
41
|
+
width: "4rem",
|
|
42
|
+
height: "4rem",
|
|
43
|
+
borderRadius: "50%",
|
|
44
|
+
background: "rgba(0, 0, 0, 0.2)",
|
|
45
|
+
zIndex: 100000,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
export const isClicked = style({
|
|
51
|
+
background:
|
|
52
|
+
"radial-gradient(circle at center, rgba(245, 177, 97, 1) 0.4%, rgba(236, 54, 110, 1) 100.2%)",
|
|
53
|
+
boxShadow: "0 0 1rem rgba(245, 177, 97, 1)",
|
|
54
|
+
color: "black",
|
|
55
|
+
transition: "all 0.3s ease-in",
|
|
56
|
+
selectors: {
|
|
57
|
+
"&:hover": {
|
|
58
|
+
boxShadow: "0 0 2rem rgba(245, 177, 97, 1)",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
// 사용자 선택 방지 글로벌 스타일
|
|
64
|
+
globalStyle(`${gamePad} *`, {
|
|
65
|
+
WebkitTouchCallout: "none",
|
|
66
|
+
WebkitUserSelect: "none",
|
|
67
|
+
MozUserSelect: "none",
|
|
68
|
+
msUserSelect: "none",
|
|
69
|
+
userSelect: "none",
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### gaesup/tools/teleport/style.css.ts
|
|
75
|
+
|
|
76
|
+
```typescript
|
|
77
|
+
import { style } from "@vanilla-extract/css";
|
|
78
|
+
|
|
79
|
+
export const teleport = style({
|
|
80
|
+
display: "flex",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
alignItems: "center",
|
|
83
|
+
textAlign: "center",
|
|
84
|
+
margin: "1rem",
|
|
85
|
+
fontSize: "0.8rem",
|
|
86
|
+
borderRadius: "50%",
|
|
87
|
+
width: "5rem",
|
|
88
|
+
height: "5rem",
|
|
89
|
+
color: "white",
|
|
90
|
+
background: "rgba(0, 0, 0, 0.6)",
|
|
91
|
+
boxShadow: "0 0 5px 0 rgba(0, 0, 0, 0.6)",
|
|
92
|
+
transition: "all 0.2s ease-in",
|
|
93
|
+
cursor: "pointer",
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### gaesup/tools/minimap/style.css.ts
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
1
101
|
// style.css.ts
|
|
2
102
|
import { globalFontFace, keyframes, style } from "@vanilla-extract/css";
|
|
3
103
|
|
|
@@ -222,3 +322,6 @@ export const north = style([
|
|
|
222
322
|
left: "50%",
|
|
223
323
|
},
|
|
224
324
|
]);
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
|
package/package.json
CHANGED
package/yarnrc.yml
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodeLinker:
|
|
1
|
+
nodeLinker: pnp
|
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import { useFrame } from "@react-three/fiber";
|
|
2
|
-
import { Ref, useContext, useEffect } from "react";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
import {
|
|
5
|
-
AnimationAction,
|
|
6
|
-
AnimationClip,
|
|
7
|
-
AnimationMixer,
|
|
8
|
-
Object3D,
|
|
9
|
-
Object3DEventMap,
|
|
10
|
-
} from "three";
|
|
11
|
-
import { animationTagType, groundRayType } from "../controller/type";
|
|
12
|
-
import { useGaesupAnimation } from "../hooks/useGaesupAnimation";
|
|
13
|
-
import {
|
|
14
|
-
GaesupWorldContext,
|
|
15
|
-
GaesupWorldDispatchContext,
|
|
16
|
-
} from "../world/context";
|
|
17
|
-
|
|
18
|
-
export type Api<T extends AnimationClip> = {
|
|
19
|
-
ref: React.MutableRefObject<Object3D | undefined | null>;
|
|
20
|
-
clips: AnimationClip[];
|
|
21
|
-
mixer: AnimationMixer;
|
|
22
|
-
names: T["name"][];
|
|
23
|
-
actions: {
|
|
24
|
-
[key in T["name"]]: AnimationAction | null;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type playActionsType = {
|
|
29
|
-
type: "character" | "vehicle" | "airplane";
|
|
30
|
-
currentAnimation?: string;
|
|
31
|
-
actions: actionsType;
|
|
32
|
-
animationRef: Ref<Object3D<Object3DEventMap>>;
|
|
33
|
-
isActive: boolean;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type subscribeActionsType = {
|
|
37
|
-
type: "character" | "vehicle" | "airplane";
|
|
38
|
-
groundRay: groundRayType;
|
|
39
|
-
animations: AnimationClip[];
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type actionsType = {
|
|
43
|
-
[x: string]: THREE.AnimationAction | null;
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
export type playResultType = {
|
|
47
|
-
actions: actionsType;
|
|
48
|
-
ref: Ref<Object3D<Object3DEventMap>>;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export function subscribeActions({ type }: subscribeActionsType) {
|
|
52
|
-
const { states } = useContext(GaesupWorldContext);
|
|
53
|
-
const { subscribeAll } = useGaesupAnimation({ type });
|
|
54
|
-
// 초기 기본 애니메이션 등록
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
subscribeAll([
|
|
57
|
-
{
|
|
58
|
-
tag: "walk",
|
|
59
|
-
condition: () => !states.isRunning && states.isMoving,
|
|
60
|
-
action: () => {},
|
|
61
|
-
animationName: "walk",
|
|
62
|
-
key: "walk",
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
tag: "run",
|
|
66
|
-
condition: () => states.isRunning,
|
|
67
|
-
action: () => {},
|
|
68
|
-
animationName: "run",
|
|
69
|
-
key: "run",
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
tag: "jump",
|
|
73
|
-
condition: () => states.isJumping,
|
|
74
|
-
action: () => {},
|
|
75
|
-
animationName: "jump",
|
|
76
|
-
key: "jump",
|
|
77
|
-
},
|
|
78
|
-
|
|
79
|
-
{
|
|
80
|
-
tag: "ride",
|
|
81
|
-
condition: () => states.isPush["keyR"],
|
|
82
|
-
action: () => {},
|
|
83
|
-
animationName: "ride",
|
|
84
|
-
key: "ride",
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
tag: "land",
|
|
88
|
-
condition: () => states.isLanding,
|
|
89
|
-
action: () => {},
|
|
90
|
-
animationName: "land",
|
|
91
|
-
key: "land",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
tag: "fall",
|
|
95
|
-
condition: () => states.isFalling,
|
|
96
|
-
action: () => {},
|
|
97
|
-
animationName: "fall",
|
|
98
|
-
key: "fall",
|
|
99
|
-
},
|
|
100
|
-
]);
|
|
101
|
-
}, []);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export default function playActions({
|
|
105
|
-
type,
|
|
106
|
-
actions,
|
|
107
|
-
animationRef,
|
|
108
|
-
currentAnimation,
|
|
109
|
-
isActive,
|
|
110
|
-
}: playActionsType) {
|
|
111
|
-
const { mode, animationState, block } = useContext(GaesupWorldContext);
|
|
112
|
-
const dispatch = useContext(GaesupWorldDispatchContext);
|
|
113
|
-
const { notify, store } = useGaesupAnimation({ type });
|
|
114
|
-
|
|
115
|
-
if (isActive) {
|
|
116
|
-
currentAnimation = animationState?.[type]?.current;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const play = (tag: keyof animationTagType) => {
|
|
120
|
-
animationState[type].current = tag;
|
|
121
|
-
const currentAnimation = store[tag];
|
|
122
|
-
if (currentAnimation?.action) {
|
|
123
|
-
currentAnimation.action();
|
|
124
|
-
}
|
|
125
|
-
dispatch({
|
|
126
|
-
type: "update",
|
|
127
|
-
payload: {
|
|
128
|
-
animationState: {
|
|
129
|
-
...animationState,
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
});
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
useEffect(() => {
|
|
136
|
-
let animation = "idle";
|
|
137
|
-
if (block.animation) {
|
|
138
|
-
animation = "idle";
|
|
139
|
-
} else if (currentAnimation) {
|
|
140
|
-
animation = currentAnimation;
|
|
141
|
-
} else if (animationState[type].current) {
|
|
142
|
-
animation = animationState[type].current;
|
|
143
|
-
}
|
|
144
|
-
const action = actions[animation]?.reset().fadeIn(0.2).play();
|
|
145
|
-
return () => {
|
|
146
|
-
action?.fadeOut(0.2);
|
|
147
|
-
};
|
|
148
|
-
}, [currentAnimation, mode.type, block.animation, type]);
|
|
149
|
-
|
|
150
|
-
useFrame(() => {
|
|
151
|
-
if (isActive) {
|
|
152
|
-
const tag = notify() as keyof animationTagType;
|
|
153
|
-
play(tag);
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
return {
|
|
158
|
-
animationRef,
|
|
159
|
-
currentAnimation: animationState?.[type]?.current,
|
|
160
|
-
};
|
|
161
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { cameraPropType } from "../../physics/type";
|
|
2
|
-
import { V3 } from "../../utils/vector";
|
|
3
|
-
import { activeStateType, cameraOptionType } from "../../world/context/type";
|
|
4
|
-
|
|
5
|
-
export const makeNormalCameraPosition = (
|
|
6
|
-
activeState: activeStateType,
|
|
7
|
-
cameraOption: cameraOptionType
|
|
8
|
-
) => {
|
|
9
|
-
const { XDistance, YDistance, ZDistance } = cameraOption;
|
|
10
|
-
const cameraPosition = activeState.position
|
|
11
|
-
.clone()
|
|
12
|
-
.add(V3(XDistance, YDistance, ZDistance));
|
|
13
|
-
return cameraPosition;
|
|
14
|
-
};
|
|
15
|
-
export default function normal(prop: cameraPropType) {
|
|
16
|
-
const {
|
|
17
|
-
state,
|
|
18
|
-
worldContext: { cameraOption },
|
|
19
|
-
controllerOptions: { lerp },
|
|
20
|
-
} = prop;
|
|
21
|
-
if (!state || !state.camera) return;
|
|
22
|
-
state.camera.position.lerp(
|
|
23
|
-
cameraOption.position.clone(),
|
|
24
|
-
lerp.cameraPosition
|
|
25
|
-
);
|
|
26
|
-
state.camera.lookAt(cameraOption.target);
|
|
27
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { quat } from "@react-three/rapier";
|
|
2
|
-
import { cameraPropType } from "../../physics/type";
|
|
3
|
-
import { V3 } from "../../utils/vector";
|
|
4
|
-
import { activeStateType, cameraOptionType } from "../../world/context/type";
|
|
5
|
-
|
|
6
|
-
export const makeOrbitCameraPosition = (
|
|
7
|
-
activeState: activeStateType,
|
|
8
|
-
cameraOption: cameraOptionType
|
|
9
|
-
) => {
|
|
10
|
-
const { XDistance, YDistance, ZDistance } = cameraOption;
|
|
11
|
-
const cameraPosition = activeState.position.clone().add(
|
|
12
|
-
V3(Math.sin(activeState.euler.y), 1, Math.cos(activeState.euler.y))
|
|
13
|
-
.normalize()
|
|
14
|
-
.clone()
|
|
15
|
-
.multiply(V3(-XDistance, YDistance, -ZDistance))
|
|
16
|
-
);
|
|
17
|
-
return cameraPosition;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
export default function orbit(prop: cameraPropType) {
|
|
21
|
-
const {
|
|
22
|
-
state,
|
|
23
|
-
worldContext: { activeState, cameraOption },
|
|
24
|
-
controllerOptions: { lerp },
|
|
25
|
-
} = prop;
|
|
26
|
-
|
|
27
|
-
if (!state || !state.camera) return;
|
|
28
|
-
const cameraPosition = makeOrbitCameraPosition(activeState, cameraOption);
|
|
29
|
-
state.camera.position.lerp(cameraPosition.clone(), lerp.cameraTurn);
|
|
30
|
-
state.camera.quaternion.copy(
|
|
31
|
-
activeState.quat
|
|
32
|
-
.clone()
|
|
33
|
-
.multiply(quat().setFromAxisAngle(V3(0, 1, 0), Math.PI))
|
|
34
|
-
);
|
|
35
|
-
state.camera.rotation.copy(activeState.euler);
|
|
36
|
-
state.camera.lookAt(activeState.position.clone());
|
|
37
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useFrame } from "@react-three/fiber";
|
|
2
|
-
import { cameraPropType } from "../physics/type";
|
|
3
|
-
import normal, { makeNormalCameraPosition } from "./control/normal";
|
|
4
|
-
import orbit from "./control/orbit";
|
|
5
|
-
|
|
6
|
-
export default function Camera(prop: cameraPropType) {
|
|
7
|
-
useFrame((state) => {
|
|
8
|
-
prop.state = state;
|
|
9
|
-
if (!prop.worldContext.block.camera) {
|
|
10
|
-
if (prop.worldContext.mode.control === "orbit") {
|
|
11
|
-
orbit(prop);
|
|
12
|
-
} else if (prop.worldContext.mode.control === "normal") {
|
|
13
|
-
normal(prop);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// 포커스가 아닐 때 카메라 activeStae 따라가기
|
|
19
|
-
useFrame(() => {
|
|
20
|
-
if (!prop.worldContext.cameraOption.focus) {
|
|
21
|
-
prop.worldContext.cameraOption.target =
|
|
22
|
-
prop.worldContext.activeState.position;
|
|
23
|
-
prop.worldContext.cameraOption.position = makeNormalCameraPosition(
|
|
24
|
-
prop.worldContext.activeState,
|
|
25
|
-
prop.worldContext.cameraOption
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import {} from "three-stdlib";
|
|
3
|
-
|
|
4
|
-
export type cameraRayType = {
|
|
5
|
-
origin: THREE.Vector3;
|
|
6
|
-
hit: THREE.Raycaster;
|
|
7
|
-
rayCast: THREE.Raycaster | null;
|
|
8
|
-
length: number;
|
|
9
|
-
dir: THREE.Vector3;
|
|
10
|
-
position: THREE.Vector3;
|
|
11
|
-
intersects: THREE.Intersection<THREE.Mesh>[];
|
|
12
|
-
detected: THREE.Intersection<THREE.Mesh>[];
|
|
13
|
-
intersectObjectMap: { [uuid: string]: THREE.Mesh };
|
|
14
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AirplaneInnerRef } from "../../inner/airplane";
|
|
2
|
-
import { activeAirplaneInnerType } from "./type";
|
|
3
|
-
|
|
4
|
-
export function AirplaneRef(props: activeAirplaneInnerType) {
|
|
5
|
-
return (
|
|
6
|
-
<AirplaneInnerRef
|
|
7
|
-
name={"airplane"}
|
|
8
|
-
isActive={true}
|
|
9
|
-
currentAnimation={"idle"}
|
|
10
|
-
componentType={"airplane"}
|
|
11
|
-
ridingUrl={props.ridingUrl}
|
|
12
|
-
{...props}
|
|
13
|
-
>
|
|
14
|
-
{props.children}
|
|
15
|
-
</AirplaneInnerRef>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { controllerInnerType, refsType } from "../../../controller/type";
|
|
2
|
-
import { urlsType } from "../../../world/context/type";
|
|
3
|
-
import { CharacterInnerRef } from "../../inner/character";
|
|
4
|
-
|
|
5
|
-
export function CharacterRef({
|
|
6
|
-
children,
|
|
7
|
-
props,
|
|
8
|
-
refs,
|
|
9
|
-
urls,
|
|
10
|
-
}: {
|
|
11
|
-
children: React.ReactNode;
|
|
12
|
-
props: controllerInnerType;
|
|
13
|
-
refs: refsType;
|
|
14
|
-
urls: urlsType;
|
|
15
|
-
}) {
|
|
16
|
-
return (
|
|
17
|
-
<CharacterInnerRef
|
|
18
|
-
url={urls.characterUrl}
|
|
19
|
-
isActive={true}
|
|
20
|
-
componentType="character"
|
|
21
|
-
rigidbodyType={"dynamic"}
|
|
22
|
-
controllerOptions={props.controllerOptions}
|
|
23
|
-
groundRay={props.groundRay}
|
|
24
|
-
onAnimate={props.onAnimate}
|
|
25
|
-
onFrame={props.onFrame}
|
|
26
|
-
onReady={props.onReady}
|
|
27
|
-
onDestory={props.onDestory}
|
|
28
|
-
rigidBodyProps={props.rigidBodyProps}
|
|
29
|
-
parts={props.parts}
|
|
30
|
-
{...refs}
|
|
31
|
-
>
|
|
32
|
-
{children}
|
|
33
|
-
</CharacterInnerRef>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { RigidBodyTypeString } from "@react-three/rapier";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
import { controllerOptionsType } from "../../../controller/type";
|
|
4
|
-
|
|
5
|
-
export type activeCharacterPropsType = {
|
|
6
|
-
characterUrl: string;
|
|
7
|
-
position?: THREE.Vector3;
|
|
8
|
-
rotation?: THREE.Euler;
|
|
9
|
-
controllerOptions?: controllerOptionsType;
|
|
10
|
-
currentAnimation?: string;
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
rigidbodyType?: RigidBodyTypeString;
|
|
13
|
-
};
|