gaesup-world 0.2.25 → 0.2.26
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/dist/gaesup/animation/actions.d.ts +44 -0
- package/dist/gaesup/animation/actions.js +103 -0
- package/dist/gaesup/camera/control/normal.d.ts +4 -0
- package/dist/gaesup/camera/control/normal.js +18 -0
- package/dist/gaesup/camera/control/orbit.d.ts +4 -0
- package/dist/gaesup/camera/control/orbit.js +22 -0
- package/dist/gaesup/camera/detector/index.d.ts +2 -0
- package/dist/gaesup/camera/detector/index.js +25 -0
- package/dist/gaesup/camera/index.d.ts +8 -0
- package/dist/gaesup/camera/index.js +139 -0
- package/dist/gaesup/camera/type.d.ts +13 -0
- package/dist/gaesup/camera/type.js +1 -0
- package/dist/gaesup/component/active/airplane/index.d.ts +11 -0
- package/dist/gaesup/component/active/airplane/index.js +6 -0
- package/dist/gaesup/component/active/character/index.d.ts +7 -0
- package/dist/gaesup/component/active/character/index.js +34 -0
- package/dist/gaesup/component/active/vehicle/index.d.ts +12 -0
- package/dist/gaesup/component/active/vehicle/index.js +31 -0
- package/dist/gaesup/component/index.d.ts +7 -0
- package/dist/gaesup/component/index.js +19 -0
- package/dist/gaesup/component/inner/airplane/index.d.ts +2 -0
- package/dist/gaesup/component/inner/airplane/index.js +16 -0
- package/dist/gaesup/component/inner/character/index.d.ts +25 -0
- package/dist/gaesup/component/inner/character/index.js +28 -0
- package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +10 -0
- package/dist/gaesup/component/inner/common/InnerGroupRef.js +29 -0
- package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +4 -0
- package/dist/gaesup/component/inner/common/OuterGroupRef.js +6 -0
- package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +12 -0
- package/dist/gaesup/component/inner/common/RigidbodyRef.js +7 -0
- package/dist/gaesup/component/inner/common/setGroundRay.d.ts +9 -0
- package/dist/gaesup/component/inner/common/setGroundRay.js +14 -0
- package/dist/gaesup/component/inner/common/type.d.ts +20 -0
- package/dist/gaesup/component/inner/common/type.js +1 -0
- package/dist/gaesup/component/inner/rider/index.d.ts +11 -0
- package/dist/gaesup/component/inner/rider/index.js +31 -0
- package/dist/gaesup/component/inner/vehicle/collider.d.ts +10 -0
- package/dist/gaesup/component/inner/vehicle/collider.js +19 -0
- package/dist/gaesup/component/inner/vehicle/index.d.ts +2 -0
- package/dist/gaesup/component/inner/vehicle/index.js +17 -0
- package/dist/gaesup/component/inner/vehicle/wheels.d.ts +7 -0
- package/dist/gaesup/component/inner/vehicle/wheels.js +64 -0
- package/dist/gaesup/component/passive/airplane/index.d.ts +13 -0
- package/dist/gaesup/component/passive/airplane/index.js +40 -0
- package/dist/gaesup/component/passive/character/index.d.ts +10 -0
- package/dist/gaesup/component/passive/character/index.js +46 -0
- package/dist/gaesup/component/passive/type.d.ts +20 -0
- package/dist/gaesup/component/passive/type.js +1 -0
- package/dist/gaesup/component/passive/vehicle/index.d.ts +13 -0
- package/dist/gaesup/component/passive/vehicle/index.js +17 -0
- package/dist/gaesup/component/type.d.ts +17 -0
- package/dist/gaesup/component/type.js +1 -0
- package/dist/gaesup/controller/context/index.d.ts +49 -0
- package/dist/gaesup/controller/context/index.js +59 -0
- package/dist/gaesup/controller/context/reducer.d.ts +12 -0
- package/dist/gaesup/controller/context/reducer.js +21 -0
- package/dist/gaesup/controller/context/type.d.ts +38 -0
- package/dist/gaesup/controller/context/type.js +1 -0
- package/dist/gaesup/controller/debug/airplane.d.ts +71 -0
- package/dist/gaesup/controller/debug/airplane.js +71 -0
- package/dist/gaesup/controller/debug/character.d.ts +27 -0
- package/dist/gaesup/controller/debug/character.js +27 -0
- package/dist/gaesup/controller/debug/index.d.ts +6 -0
- package/dist/gaesup/controller/debug/index.js +49 -0
- package/dist/gaesup/controller/debug/vehicle.d.ts +27 -0
- package/dist/gaesup/controller/debug/vehicle.js +27 -0
- package/dist/gaesup/controller/index.d.ts +3 -0
- package/dist/gaesup/controller/index.js +74 -0
- package/dist/gaesup/controller/initialize/callback/index.d.ts +2 -0
- package/dist/gaesup/controller/initialize/callback/index.js +62 -0
- package/dist/gaesup/controller/initialize/callback/type.d.ts +27 -0
- package/dist/gaesup/controller/initialize/callback/type.js +1 -0
- package/dist/gaesup/controller/initialize/index.d.ts +10 -0
- package/dist/gaesup/controller/initialize/index.js +75 -0
- package/dist/gaesup/controller/type.d.ts +85 -0
- package/dist/gaesup/controller/type.js +1 -0
- package/dist/gaesup/gaesupProps/index.d.ts +7 -0
- package/dist/gaesup/gaesupProps/index.js +46 -0
- package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +10 -0
- package/dist/gaesup/hooks/useGaesupAnimation/index.js +95 -0
- package/dist/gaesup/hooks/useGaesupController/index.d.ts +10 -0
- package/dist/gaesup/hooks/useGaesupController/index.js +14 -0
- package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +25 -0
- package/dist/gaesup/hooks/useGaesupGltf/index.js +73 -0
- package/dist/gaesup/hooks/useJoyStick/index.d.ts +39 -0
- package/dist/gaesup/hooks/useJoyStick/index.js +61 -0
- package/dist/gaesup/hooks/usePushKey/index.d.ts +3 -0
- package/dist/gaesup/hooks/usePushKey/index.js +29 -0
- package/dist/gaesup/hooks/useRideable/index.d.ts +28 -0
- package/dist/gaesup/hooks/useRideable/index.js +199 -0
- package/dist/gaesup/hooks/useTeleport/index.d.ts +3 -0
- package/dist/gaesup/hooks/useTeleport/index.js +12 -0
- package/dist/gaesup/physics/airplane/damping.d.ts +2 -0
- package/dist/gaesup/physics/airplane/damping.js +5 -0
- package/dist/gaesup/physics/airplane/direction.d.ts +2 -0
- package/dist/gaesup/physics/airplane/direction.js +65 -0
- package/dist/gaesup/physics/airplane/gravity.d.ts +14 -0
- package/dist/gaesup/physics/airplane/gravity.js +18 -0
- package/dist/gaesup/physics/airplane/impulse.d.ts +16 -0
- package/dist/gaesup/physics/airplane/impulse.js +31 -0
- package/dist/gaesup/physics/airplane/index.d.ts +2 -0
- package/dist/gaesup/physics/airplane/index.js +14 -0
- package/dist/gaesup/physics/airplane/innerCalc.d.ts +2 -0
- package/dist/gaesup/physics/airplane/innerCalc.js +27 -0
- package/dist/gaesup/physics/airplane/landing.d.ts +2 -0
- package/dist/gaesup/physics/airplane/landing.js +29 -0
- package/dist/gaesup/physics/character/direction.d.ts +23 -0
- package/dist/gaesup/physics/character/direction.js +55 -0
- package/dist/gaesup/physics/character/impulse.d.ts +2 -0
- package/dist/gaesup/physics/character/impulse.js +43 -0
- package/dist/gaesup/physics/character/index.d.ts +2 -0
- package/dist/gaesup/physics/character/index.js +8 -0
- package/dist/gaesup/physics/character/innerCalc.d.ts +2 -0
- package/dist/gaesup/physics/character/innerCalc.js +31 -0
- package/dist/gaesup/physics/check/ground.d.ts +2 -0
- package/dist/gaesup/physics/check/ground.js +15 -0
- package/dist/gaesup/physics/check/index.d.ts +2 -0
- package/dist/gaesup/physics/check/index.js +12 -0
- package/dist/gaesup/physics/check/moving.d.ts +2 -0
- package/dist/gaesup/physics/check/moving.js +16 -0
- package/dist/gaesup/physics/check/push.d.ts +2 -0
- package/dist/gaesup/physics/check/push.js +6 -0
- package/dist/gaesup/physics/check/riding.d.ts +2 -0
- package/dist/gaesup/physics/check/riding.js +7 -0
- package/dist/gaesup/physics/check/rotate.d.ts +2 -0
- package/dist/gaesup/physics/check/rotate.js +8 -0
- package/dist/gaesup/physics/index.d.ts +2 -0
- package/dist/gaesup/physics/index.js +58 -0
- package/dist/gaesup/physics/type.d.ts +36 -0
- package/dist/gaesup/physics/type.js +1 -0
- package/dist/gaesup/physics/vehicle/damping.d.ts +2 -0
- package/dist/gaesup/physics/vehicle/damping.js +6 -0
- package/dist/gaesup/physics/vehicle/direction.d.ts +4 -0
- package/dist/gaesup/physics/vehicle/direction.js +30 -0
- package/dist/gaesup/physics/vehicle/impulse.d.ts +16 -0
- package/dist/gaesup/physics/vehicle/impulse.js +40 -0
- package/dist/gaesup/physics/vehicle/index.d.ts +2 -0
- package/dist/gaesup/physics/vehicle/index.js +12 -0
- package/dist/gaesup/physics/vehicle/innerCalc.d.ts +2 -0
- package/dist/gaesup/physics/vehicle/innerCalc.js +24 -0
- package/dist/gaesup/physics/vehicle/landing.d.ts +2 -0
- package/dist/gaesup/physics/vehicle/landing.js +29 -0
- package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +9 -0
- package/dist/gaesup/tools/gameBoy/GameBoyButton.js +16 -0
- package/dist/gaesup/tools/gameBoy/index.d.ts +8 -0
- package/dist/gaesup/tools/gameBoy/index.js +22 -0
- package/dist/gaesup/tools/gameBoy/type.d.ts +4 -0
- package/dist/gaesup/tools/gameBoy/type.js +1 -0
- package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +8 -0
- package/dist/gaesup/tools/gamePad/GamePadButton.js +21 -0
- package/dist/gaesup/tools/gamePad/index.d.ts +6 -0
- package/dist/gaesup/tools/gamePad/index.js +32 -0
- package/dist/gaesup/tools/gamePad/type.d.ts +6 -0
- package/dist/gaesup/tools/gamePad/type.js +1 -0
- package/dist/gaesup/tools/joyStick/index.d.ts +6 -0
- package/dist/gaesup/tools/joyStick/index.js +169 -0
- package/dist/gaesup/tools/joyStick/type.d.ts +19 -0
- package/dist/gaesup/tools/joyStick/type.js +1 -0
- package/dist/gaesup/tools/jumpPortal/index.d.ts +16 -0
- package/dist/gaesup/tools/jumpPortal/index.js +18 -0
- package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +402 -0
- package/dist/gaesup/tools/keyBoardToolTip/constant.js +122 -0
- package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +10 -0
- package/dist/gaesup/tools/keyBoardToolTip/default.js +12 -0
- package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +3 -0
- package/dist/gaesup/tools/keyBoardToolTip/index.js +70 -0
- package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +37 -0
- package/dist/gaesup/tools/keyBoardToolTip/type.js +1 -0
- package/dist/gaesup/tools/miniMap/default.d.ts +9 -0
- package/dist/gaesup/tools/miniMap/default.js +9 -0
- package/dist/gaesup/tools/miniMap/index.d.ts +3 -0
- package/dist/gaesup/tools/miniMap/index.js +72 -0
- package/dist/gaesup/tools/miniMap/type.d.ts +25 -0
- package/dist/gaesup/tools/miniMap/type.js +1 -0
- package/dist/gaesup/tools/rideable/index.d.ts +3 -0
- package/dist/gaesup/tools/rideable/index.js +79 -0
- package/dist/gaesup/tools/type.d.ts +2 -0
- package/dist/gaesup/tools/type.js +1 -0
- package/dist/gaesup/tools/zoomButton/index.d.ts +18 -0
- package/dist/gaesup/tools/zoomButton/index.js +146 -0
- package/dist/gaesup/utils/context.d.ts +2 -0
- package/dist/gaesup/utils/context.js +3 -0
- package/dist/gaesup/utils/debug.d.ts +29 -0
- package/dist/gaesup/utils/debug.js +36 -0
- package/dist/gaesup/utils/index.d.ts +3 -0
- package/dist/gaesup/utils/index.js +3 -0
- package/dist/gaesup/utils/ray.d.ts +7 -0
- package/dist/gaesup/utils/ray.js +6 -0
- package/dist/gaesup/utils/ref.d.ts +2 -0
- package/dist/gaesup/utils/ref.js +16 -0
- package/dist/gaesup/utils/type.d.ts +5 -0
- package/dist/gaesup/utils/type.js +1 -0
- package/dist/gaesup/utils/vector.d.ts +10 -0
- package/dist/gaesup/utils/vector.js +33 -0
- package/dist/gaesup/world/context/index.d.ts +6 -0
- package/dist/gaesup/world/context/index.js +117 -0
- package/dist/gaesup/world/context/reducer.d.ts +29 -0
- package/dist/gaesup/world/context/reducer.js +21 -0
- package/dist/gaesup/world/context/type.d.ts +169 -0
- package/dist/gaesup/world/context/type.js +1 -0
- package/dist/gaesup/world/debug/cameraOption.d.ts +47 -0
- package/dist/gaesup/world/debug/cameraOption.js +47 -0
- package/dist/gaesup/world/debug/index.d.ts +6 -0
- package/dist/gaesup/world/debug/index.js +32 -0
- package/dist/gaesup/world/debug/mode.d.ts +10 -0
- package/dist/gaesup/world/debug/mode.js +10 -0
- package/dist/gaesup/world/index.d.ts +3 -0
- package/dist/gaesup/world/index.js +9 -0
- package/dist/gaesup/world/initalize/index.d.ts +35 -0
- package/dist/gaesup/world/initalize/index.js +62 -0
- package/dist/gaesup/world/type.d.ts +19 -0
- package/dist/gaesup/world/type.js +1 -0
- package/dist/index.d.ts +23 -0
- package/index.ts +29 -0
- package/package.json +2 -5
- package/yarn-error.log +12152 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GroupProps } from "@react-three/fiber";
|
|
2
|
+
import { dispatchType } from "../../utils/type";
|
|
3
|
+
import { callbackType } from "../initialize/callback/type";
|
|
4
|
+
import { gaesupControllerContextPropType, refsType } from "../type";
|
|
5
|
+
export type airplaneDebugType = {
|
|
6
|
+
angleDelta?: THREE.Vector3;
|
|
7
|
+
maxAngle?: THREE.Vector3;
|
|
8
|
+
buoyancy?: number;
|
|
9
|
+
maxSpeed?: number;
|
|
10
|
+
accelRatio?: number;
|
|
11
|
+
brakeRatio?: number;
|
|
12
|
+
linearDamping?: number;
|
|
13
|
+
};
|
|
14
|
+
export type vehicleDebugType = {
|
|
15
|
+
maxSpeed?: number;
|
|
16
|
+
accelRatio?: number;
|
|
17
|
+
brakeRatio?: number;
|
|
18
|
+
wheelOffset?: number;
|
|
19
|
+
linearDamping?: number;
|
|
20
|
+
};
|
|
21
|
+
export type characterDebugType = {
|
|
22
|
+
jumpSpeed?: number;
|
|
23
|
+
turnSpeed?: number;
|
|
24
|
+
walkSpeed?: number;
|
|
25
|
+
runSpeed?: number;
|
|
26
|
+
linearDamping?: number;
|
|
27
|
+
};
|
|
28
|
+
export interface airplaneType extends GroupProps, airplaneDebugType {
|
|
29
|
+
}
|
|
30
|
+
export interface vehicleType extends GroupProps, vehicleDebugType {
|
|
31
|
+
}
|
|
32
|
+
export interface characterType extends GroupProps, characterDebugType {
|
|
33
|
+
}
|
|
34
|
+
export type gaesupControllerType = gaesupControllerContextPropType & {
|
|
35
|
+
callbacks?: callbackType;
|
|
36
|
+
refs?: refsType;
|
|
37
|
+
};
|
|
38
|
+
export type gaesupDisptachType = dispatchType<gaesupControllerType>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const airplaneDebugMap: {
|
|
2
|
+
angleDelta: {
|
|
3
|
+
value: {
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
z: number;
|
|
7
|
+
};
|
|
8
|
+
x: {
|
|
9
|
+
min: number;
|
|
10
|
+
max: number;
|
|
11
|
+
step: number;
|
|
12
|
+
};
|
|
13
|
+
y: {
|
|
14
|
+
min: number;
|
|
15
|
+
max: number;
|
|
16
|
+
step: number;
|
|
17
|
+
};
|
|
18
|
+
z: {
|
|
19
|
+
min: number;
|
|
20
|
+
max: number;
|
|
21
|
+
step: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
maxAngle: {
|
|
25
|
+
value: {
|
|
26
|
+
x: number;
|
|
27
|
+
y: number;
|
|
28
|
+
z: number;
|
|
29
|
+
};
|
|
30
|
+
x: {
|
|
31
|
+
min: number;
|
|
32
|
+
max: number;
|
|
33
|
+
step: number;
|
|
34
|
+
};
|
|
35
|
+
y: {
|
|
36
|
+
min: number;
|
|
37
|
+
max: number;
|
|
38
|
+
step: number;
|
|
39
|
+
};
|
|
40
|
+
z: {
|
|
41
|
+
min: number;
|
|
42
|
+
max: number;
|
|
43
|
+
step: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
maxSpeed: {
|
|
47
|
+
min: number;
|
|
48
|
+
max: number;
|
|
49
|
+
step: number;
|
|
50
|
+
};
|
|
51
|
+
accelRatio: {
|
|
52
|
+
min: number;
|
|
53
|
+
max: number;
|
|
54
|
+
step: number;
|
|
55
|
+
};
|
|
56
|
+
brakeRatio: {
|
|
57
|
+
min: number;
|
|
58
|
+
max: number;
|
|
59
|
+
step: number;
|
|
60
|
+
};
|
|
61
|
+
buoyancy: {
|
|
62
|
+
min: number;
|
|
63
|
+
max: number;
|
|
64
|
+
step: number;
|
|
65
|
+
};
|
|
66
|
+
linearDamping: {
|
|
67
|
+
min: number;
|
|
68
|
+
max: number;
|
|
69
|
+
step: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export var airplaneDebugMap = {
|
|
2
|
+
angleDelta: {
|
|
3
|
+
value: {
|
|
4
|
+
x: 0.01,
|
|
5
|
+
y: 0.005,
|
|
6
|
+
z: 0.005,
|
|
7
|
+
},
|
|
8
|
+
x: {
|
|
9
|
+
min: -Math.PI,
|
|
10
|
+
max: Math.PI,
|
|
11
|
+
step: 0.01,
|
|
12
|
+
},
|
|
13
|
+
y: {
|
|
14
|
+
min: -Math.PI,
|
|
15
|
+
max: Math.PI,
|
|
16
|
+
step: 0.01,
|
|
17
|
+
},
|
|
18
|
+
z: {
|
|
19
|
+
min: -Math.PI,
|
|
20
|
+
max: Math.PI,
|
|
21
|
+
step: 0.01,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
maxAngle: {
|
|
25
|
+
value: {
|
|
26
|
+
x: 0.1,
|
|
27
|
+
y: 0.1,
|
|
28
|
+
z: 0.1,
|
|
29
|
+
},
|
|
30
|
+
x: {
|
|
31
|
+
min: -Math.PI,
|
|
32
|
+
max: Math.PI,
|
|
33
|
+
step: 0.01,
|
|
34
|
+
},
|
|
35
|
+
y: {
|
|
36
|
+
min: -Math.PI,
|
|
37
|
+
max: Math.PI,
|
|
38
|
+
step: 0.01,
|
|
39
|
+
},
|
|
40
|
+
z: {
|
|
41
|
+
min: -Math.PI,
|
|
42
|
+
max: Math.PI,
|
|
43
|
+
step: 0.01,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
maxSpeed: {
|
|
47
|
+
min: 50,
|
|
48
|
+
max: 100,
|
|
49
|
+
step: 0.01,
|
|
50
|
+
},
|
|
51
|
+
accelRatio: {
|
|
52
|
+
min: 1,
|
|
53
|
+
max: 10,
|
|
54
|
+
step: 0.01,
|
|
55
|
+
},
|
|
56
|
+
brakeRatio: {
|
|
57
|
+
min: 1,
|
|
58
|
+
max: 20,
|
|
59
|
+
step: 0.01,
|
|
60
|
+
},
|
|
61
|
+
buoyancy: {
|
|
62
|
+
min: 0.1,
|
|
63
|
+
max: 1,
|
|
64
|
+
step: 0.01,
|
|
65
|
+
},
|
|
66
|
+
linearDamping: {
|
|
67
|
+
min: 0,
|
|
68
|
+
max: 1,
|
|
69
|
+
step: 0.01,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const characterDebugMap: {
|
|
2
|
+
walkSpeed: {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
step: number;
|
|
6
|
+
};
|
|
7
|
+
runSpeed: {
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step: number;
|
|
11
|
+
};
|
|
12
|
+
turnSpeed: {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
step: number;
|
|
16
|
+
};
|
|
17
|
+
jumpSpeed: {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
step: number;
|
|
21
|
+
};
|
|
22
|
+
linearDamping: {
|
|
23
|
+
min: number;
|
|
24
|
+
max: number;
|
|
25
|
+
step: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var characterDebugMap = {
|
|
2
|
+
walkSpeed: {
|
|
3
|
+
min: 1,
|
|
4
|
+
max: 20,
|
|
5
|
+
step: 0.01,
|
|
6
|
+
},
|
|
7
|
+
runSpeed: {
|
|
8
|
+
min: 1,
|
|
9
|
+
max: 20,
|
|
10
|
+
step: 0.01,
|
|
11
|
+
},
|
|
12
|
+
turnSpeed: {
|
|
13
|
+
min: 1,
|
|
14
|
+
max: 20,
|
|
15
|
+
step: 0.01,
|
|
16
|
+
},
|
|
17
|
+
jumpSpeed: {
|
|
18
|
+
min: 0.1,
|
|
19
|
+
max: 20,
|
|
20
|
+
step: 0.01,
|
|
21
|
+
},
|
|
22
|
+
linearDamping: {
|
|
23
|
+
min: -10,
|
|
24
|
+
max: 10,
|
|
25
|
+
step: 0.01,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { dispatchType } from "../../utils/type";
|
|
2
|
+
import { gaesupControllerType } from "../context/type";
|
|
3
|
+
export default function initDebug({ controllerContext, controllerDispatch, }: {
|
|
4
|
+
controllerContext: gaesupControllerType;
|
|
5
|
+
controllerDispatch: dispatchType<gaesupControllerType>;
|
|
6
|
+
}): void;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { useContext, useEffect } from "react";
|
|
13
|
+
import { update } from "../../utils/context";
|
|
14
|
+
import debug from "../../utils/debug";
|
|
15
|
+
import { GaesupWorldContext } from "../../world/context";
|
|
16
|
+
import { airplaneDebugMap } from "./airplane";
|
|
17
|
+
import { characterDebugMap } from "./character";
|
|
18
|
+
import { vehicleDebugMap } from "./vehicle";
|
|
19
|
+
export default function initDebug(_a) {
|
|
20
|
+
var controllerContext = _a.controllerContext, controllerDispatch = _a.controllerDispatch;
|
|
21
|
+
var worldDebug = useContext(GaesupWorldContext).debug;
|
|
22
|
+
if (!worldDebug)
|
|
23
|
+
return;
|
|
24
|
+
var characterOptionValue = debug({
|
|
25
|
+
debug: worldDebug,
|
|
26
|
+
debugProps: controllerContext.character,
|
|
27
|
+
tag: "character",
|
|
28
|
+
debugMap: characterDebugMap,
|
|
29
|
+
});
|
|
30
|
+
var vehicleOptionValue = debug({
|
|
31
|
+
debug: worldDebug,
|
|
32
|
+
debugProps: controllerContext.vehicle,
|
|
33
|
+
tag: "vehicle",
|
|
34
|
+
debugMap: vehicleDebugMap,
|
|
35
|
+
});
|
|
36
|
+
var airplaneOptionValue = debug({
|
|
37
|
+
debug: worldDebug,
|
|
38
|
+
debugProps: controllerContext.airplane,
|
|
39
|
+
tag: "airplane",
|
|
40
|
+
debugMap: airplaneDebugMap,
|
|
41
|
+
});
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
update({
|
|
44
|
+
character: __assign({}, characterOptionValue),
|
|
45
|
+
vehicle: __assign({}, vehicleOptionValue),
|
|
46
|
+
airplane: __assign({}, airplaneOptionValue),
|
|
47
|
+
}, controllerDispatch);
|
|
48
|
+
}, [characterOptionValue, vehicleOptionValue, airplaneOptionValue]);
|
|
49
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare const vehicleDebugMap: {
|
|
2
|
+
maxSpeed: {
|
|
3
|
+
min: number;
|
|
4
|
+
max: number;
|
|
5
|
+
step: number;
|
|
6
|
+
};
|
|
7
|
+
accelRatio: {
|
|
8
|
+
min: number;
|
|
9
|
+
max: number;
|
|
10
|
+
step: number;
|
|
11
|
+
};
|
|
12
|
+
brakeRatio: {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
step: number;
|
|
16
|
+
};
|
|
17
|
+
wheelOffset: {
|
|
18
|
+
min: number;
|
|
19
|
+
max: number;
|
|
20
|
+
step: number;
|
|
21
|
+
};
|
|
22
|
+
linearDamping: {
|
|
23
|
+
min: number;
|
|
24
|
+
max: number;
|
|
25
|
+
step: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export var vehicleDebugMap = {
|
|
2
|
+
maxSpeed: {
|
|
3
|
+
min: 50,
|
|
4
|
+
max: 100,
|
|
5
|
+
step: 0.01,
|
|
6
|
+
},
|
|
7
|
+
accelRatio: {
|
|
8
|
+
min: 1,
|
|
9
|
+
max: 10,
|
|
10
|
+
step: 0.01,
|
|
11
|
+
},
|
|
12
|
+
brakeRatio: {
|
|
13
|
+
min: 1,
|
|
14
|
+
max: 20,
|
|
15
|
+
step: 0.01,
|
|
16
|
+
},
|
|
17
|
+
wheelOffset: {
|
|
18
|
+
min: 0.1,
|
|
19
|
+
max: 10,
|
|
20
|
+
step: 0.01,
|
|
21
|
+
},
|
|
22
|
+
linearDamping: {
|
|
23
|
+
min: 0,
|
|
24
|
+
max: 1,
|
|
25
|
+
step: 0.01,
|
|
26
|
+
},
|
|
27
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useContext, useMemo, useReducer, useRef } from "react";
|
|
14
|
+
import Camera from "../camera";
|
|
15
|
+
import { KeyboardControls } from "@react-three/drei";
|
|
16
|
+
import { GaesupComponent } from "../component";
|
|
17
|
+
import { GaesupWorldContext } from "../world/context";
|
|
18
|
+
import { GaesupControllerContext, GaesupControllerDispatchContext, gaesupControllerDefault, } from "./context";
|
|
19
|
+
import { gaesupControllerReducer } from "./context/reducer";
|
|
20
|
+
import initDebug from "./debug";
|
|
21
|
+
import initControllerProps from "./initialize";
|
|
22
|
+
export function GaesupController(props) {
|
|
23
|
+
var keyBoardMap = useContext(GaesupWorldContext).keyBoardMap;
|
|
24
|
+
return (_jsx(KeyboardControls, { map: keyBoardMap, children: _jsx(GaesupControllerInner, __assign({}, props, { children: props.children })) }));
|
|
25
|
+
}
|
|
26
|
+
export function GaesupControllerInner(props) {
|
|
27
|
+
var colliderRef = useRef(null);
|
|
28
|
+
var rigidBodyRef = useRef(null);
|
|
29
|
+
var outerGroupRef = useRef(null);
|
|
30
|
+
var innerGroupRef = useRef(null);
|
|
31
|
+
var characterInnerRef = useRef(null);
|
|
32
|
+
var passiveRigidBodyRef = useRef(null);
|
|
33
|
+
var _a = useReducer(gaesupControllerReducer, {
|
|
34
|
+
airplane: Object.assign(gaesupControllerDefault.airplane, props.airplane || {}),
|
|
35
|
+
vehicle: Object.assign(gaesupControllerDefault.vehicle, props.vehicle || {}),
|
|
36
|
+
character: Object.assign(gaesupControllerDefault.character, props.character || {}),
|
|
37
|
+
callbacks: Object.assign(gaesupControllerDefault.callbacks, {
|
|
38
|
+
onReady: props.onReady,
|
|
39
|
+
onFrame: props.onFrame,
|
|
40
|
+
onDestory: props.onDestory,
|
|
41
|
+
onAnimate: props.onAnimate,
|
|
42
|
+
}),
|
|
43
|
+
urls: Object.assign(gaesupControllerDefault.urls, props.urls || {}),
|
|
44
|
+
refs: {
|
|
45
|
+
colliderRef: colliderRef,
|
|
46
|
+
rigidBodyRef: rigidBodyRef,
|
|
47
|
+
outerGroupRef: outerGroupRef,
|
|
48
|
+
innerGroupRef: innerGroupRef,
|
|
49
|
+
characterInnerRef: characterInnerRef,
|
|
50
|
+
},
|
|
51
|
+
}), controller = _a[0], controllerDispatch = _a[1];
|
|
52
|
+
var gaesupControl = useMemo(function () { return ({
|
|
53
|
+
value: controller,
|
|
54
|
+
dispatch: controllerDispatch,
|
|
55
|
+
}); }, [controller, controllerDispatch]);
|
|
56
|
+
var refs = useMemo(function () {
|
|
57
|
+
return {
|
|
58
|
+
colliderRef: colliderRef,
|
|
59
|
+
rigidBodyRef: rigidBodyRef,
|
|
60
|
+
outerGroupRef: outerGroupRef,
|
|
61
|
+
innerGroupRef: innerGroupRef,
|
|
62
|
+
characterInnerRef: characterInnerRef,
|
|
63
|
+
passiveRigidBodyRef: passiveRigidBodyRef,
|
|
64
|
+
};
|
|
65
|
+
}, []);
|
|
66
|
+
var prop = __assign(__assign(__assign(__assign({}, initControllerProps({
|
|
67
|
+
refs: refs,
|
|
68
|
+
})), { children: props.children, groupProps: props.groupProps }), gaesupControl.value.callbacks), refs);
|
|
69
|
+
initDebug({
|
|
70
|
+
controllerContext: gaesupControl.value,
|
|
71
|
+
controllerDispatch: gaesupControl.dispatch,
|
|
72
|
+
});
|
|
73
|
+
return (_jsxs(GaesupControllerContext.Provider, { value: gaesupControl.value, children: [_jsx(Camera, { refs: refs, prop: prop, control: prop.keyControl }), _jsx(GaesupControllerDispatchContext.Provider, { value: gaesupControl.dispatch, children: _jsx(GaesupComponent, { props: prop, refs: refs, urls: props.urls }) })] }));
|
|
74
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export default function initCallback(props, type) {
|
|
2
|
+
// const {
|
|
3
|
+
// characterGltf,
|
|
4
|
+
// animations: characterAnimations,
|
|
5
|
+
// activeState,
|
|
6
|
+
// states,
|
|
7
|
+
// control,
|
|
8
|
+
// } = useContext(GaesupWorldContext);
|
|
9
|
+
// const dispatch = useContext(GaesupWorldDispatchContext);
|
|
10
|
+
// const { animations } = characterGltf;
|
|
11
|
+
// const { actions } = useAnimations(animations, props.outerGroupRef);
|
|
12
|
+
// const { subscribe } = useGaesupAnimation({ type });
|
|
13
|
+
//
|
|
14
|
+
// const playAnimation = (tag: keyof animationTagType, key: string) => {
|
|
15
|
+
// if (!(key in control)) return;
|
|
16
|
+
// if (control[key]) {
|
|
17
|
+
// characterAnimations.current = tag;
|
|
18
|
+
// dispatch({
|
|
19
|
+
// type: "update",
|
|
20
|
+
// payload: {
|
|
21
|
+
// animations: {
|
|
22
|
+
// ...characterAnimations,
|
|
23
|
+
// },
|
|
24
|
+
// },
|
|
25
|
+
// });
|
|
26
|
+
// }
|
|
27
|
+
// };
|
|
28
|
+
//
|
|
29
|
+
// const controllerProp: callbackPropType = {
|
|
30
|
+
// ...props,
|
|
31
|
+
// activeState,
|
|
32
|
+
// control,
|
|
33
|
+
// states,
|
|
34
|
+
// subscribe,
|
|
35
|
+
// };
|
|
36
|
+
//
|
|
37
|
+
// useEffect(() => {
|
|
38
|
+
// if (props.onReady) {
|
|
39
|
+
// props.onReady(controllerProp);
|
|
40
|
+
// }
|
|
41
|
+
// return () => {
|
|
42
|
+
// if (props.onDestory) {
|
|
43
|
+
// props.onDestory(controllerProp);
|
|
44
|
+
// }
|
|
45
|
+
// };
|
|
46
|
+
// }, []);
|
|
47
|
+
//
|
|
48
|
+
// useFrame((prop) => {
|
|
49
|
+
// if (props.onFrame) {
|
|
50
|
+
// props.onFrame({ ...controllerProp, ...prop });
|
|
51
|
+
// }
|
|
52
|
+
// if (props.onAnimate) {
|
|
53
|
+
// props.onAnimate({
|
|
54
|
+
// ...controllerProp,
|
|
55
|
+
// ...prop,
|
|
56
|
+
// actions,
|
|
57
|
+
// animation: characterAnimations,
|
|
58
|
+
// playAnimation,
|
|
59
|
+
// });
|
|
60
|
+
// }
|
|
61
|
+
// });
|
|
62
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { RootState } from "@react-three/fiber";
|
|
2
|
+
import { cameraRayType } from "../../../camera/type";
|
|
3
|
+
import { activeStateType, animationAtomType, animationPropType, keyControlType, statesType } from "../../../world/context/type";
|
|
4
|
+
import { actionsType, groundRayType, slopeRayType } from "../../type";
|
|
5
|
+
export type callbackPropType = {
|
|
6
|
+
activeState: activeStateType;
|
|
7
|
+
states: statesType;
|
|
8
|
+
slopeRay: slopeRayType;
|
|
9
|
+
groundRay: groundRayType;
|
|
10
|
+
cameraRay: cameraRayType;
|
|
11
|
+
control: keyControlType;
|
|
12
|
+
subscribe: (props: animationAtomType) => void;
|
|
13
|
+
};
|
|
14
|
+
export type onFramePropType = callbackPropType & RootState;
|
|
15
|
+
export type onAnimatePropType = onFramePropType & {
|
|
16
|
+
actions: {
|
|
17
|
+
[x: string]: THREE.AnimationAction | null;
|
|
18
|
+
};
|
|
19
|
+
animation: animationPropType;
|
|
20
|
+
playAnimation: (tag: keyof actionsType, key: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export type callbackType = {
|
|
23
|
+
onReady?: (prop: callbackPropType) => void;
|
|
24
|
+
onFrame?: (prop: onFramePropType) => void;
|
|
25
|
+
onDestory?: (prop: callbackPropType) => void;
|
|
26
|
+
onAnimate?: (prop: onAnimatePropType) => void;
|
|
27
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { groundRayType, refsType } from "../../controller/type";
|
|
2
|
+
import { cameraRayType } from "../../camera/type";
|
|
3
|
+
import { keyControlType } from "../../world/context/type";
|
|
4
|
+
export default function initControllerProps({ refs }: {
|
|
5
|
+
refs: refsType;
|
|
6
|
+
}): {
|
|
7
|
+
groundRay: groundRayType;
|
|
8
|
+
cameraRay: cameraRayType;
|
|
9
|
+
keyControl: keyControlType;
|
|
10
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { useKeyboardControls } from "@react-three/drei";
|
|
13
|
+
import { vec3 } from "@react-three/rapier";
|
|
14
|
+
import { useCallback, useContext, useEffect, useMemo } from "react";
|
|
15
|
+
import * as THREE from "three";
|
|
16
|
+
import { update } from "../../utils/context";
|
|
17
|
+
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../../world/context";
|
|
18
|
+
export default function initControllerProps(_a) {
|
|
19
|
+
var refs = _a.refs;
|
|
20
|
+
var context = useContext(GaesupWorldContext);
|
|
21
|
+
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
22
|
+
var _b = useKeyboardControls(), _ = _b[0], getKeys = _b[1];
|
|
23
|
+
var keyControl = getKeys();
|
|
24
|
+
useEffect(function () {
|
|
25
|
+
if (context && keyControl && context.control) {
|
|
26
|
+
dispatch({
|
|
27
|
+
type: "update",
|
|
28
|
+
payload: {
|
|
29
|
+
control: __assign({}, (context.mode.controller === "keyboard"
|
|
30
|
+
? keyControl
|
|
31
|
+
: context.control)),
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
}, [context === null || context === void 0 ? void 0 : context.mode.controller, keyControl, context === null || context === void 0 ? void 0 : context.control]);
|
|
36
|
+
var groundRay = useMemo(function () {
|
|
37
|
+
return {
|
|
38
|
+
origin: vec3(),
|
|
39
|
+
dir: vec3({ x: 0, y: -1, z: 0 }),
|
|
40
|
+
offset: vec3({ x: 0, y: -1, z: 0 }),
|
|
41
|
+
hit: null,
|
|
42
|
+
parent: null,
|
|
43
|
+
rayCast: null,
|
|
44
|
+
length: 0.5,
|
|
45
|
+
};
|
|
46
|
+
}, []);
|
|
47
|
+
var cameraRay = useMemo(function () {
|
|
48
|
+
return {
|
|
49
|
+
origin: vec3(),
|
|
50
|
+
hit: new THREE.Raycaster(),
|
|
51
|
+
rayCast: new THREE.Raycaster(vec3(), vec3(), 0, -7),
|
|
52
|
+
dir: vec3(),
|
|
53
|
+
position: vec3(),
|
|
54
|
+
length: -context.cameraOption.maxDistance,
|
|
55
|
+
detected: [],
|
|
56
|
+
intersects: [],
|
|
57
|
+
intersectObjectMap: {},
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
var initRefs = useCallback(function (refs) {
|
|
61
|
+
update({
|
|
62
|
+
refs: __assign({}, refs),
|
|
63
|
+
}, dispatch);
|
|
64
|
+
}, [refs]);
|
|
65
|
+
useEffect(function () {
|
|
66
|
+
if (refs) {
|
|
67
|
+
initRefs(refs);
|
|
68
|
+
}
|
|
69
|
+
}, []);
|
|
70
|
+
return {
|
|
71
|
+
groundRay: groundRay,
|
|
72
|
+
cameraRay: cameraRay,
|
|
73
|
+
keyControl: keyControl,
|
|
74
|
+
};
|
|
75
|
+
}
|