gaesup-world 0.2.22 → 0.2.23
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/package.json +5 -2
- package/dist/gaesup/animation/actions.d.ts +0 -44
- package/dist/gaesup/animation/actions.js +0 -103
- package/dist/gaesup/camera/control/normal.d.ts +0 -4
- package/dist/gaesup/camera/control/normal.js +0 -18
- package/dist/gaesup/camera/control/orbit.d.ts +0 -4
- package/dist/gaesup/camera/control/orbit.js +0 -22
- package/dist/gaesup/camera/detector/index.d.ts +0 -2
- package/dist/gaesup/camera/detector/index.js +0 -25
- package/dist/gaesup/camera/index.d.ts +0 -8
- package/dist/gaesup/camera/index.js +0 -139
- package/dist/gaesup/camera/type.d.ts +0 -13
- package/dist/gaesup/camera/type.js +0 -1
- package/dist/gaesup/component/active/airplane/index.d.ts +0 -11
- package/dist/gaesup/component/active/airplane/index.js +0 -6
- package/dist/gaesup/component/active/character/index.d.ts +0 -7
- package/dist/gaesup/component/active/character/index.js +0 -34
- package/dist/gaesup/component/active/vehicle/index.d.ts +0 -12
- package/dist/gaesup/component/active/vehicle/index.js +0 -31
- package/dist/gaesup/component/index.d.ts +0 -7
- package/dist/gaesup/component/index.js +0 -19
- package/dist/gaesup/component/inner/airplane/index.d.ts +0 -2
- package/dist/gaesup/component/inner/airplane/index.js +0 -16
- package/dist/gaesup/component/inner/character/index.d.ts +0 -25
- package/dist/gaesup/component/inner/character/index.js +0 -28
- package/dist/gaesup/component/inner/common/InnerGroupRef.d.ts +0 -10
- package/dist/gaesup/component/inner/common/InnerGroupRef.js +0 -29
- package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +0 -4
- package/dist/gaesup/component/inner/common/OuterGroupRef.js +0 -6
- package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +0 -12
- package/dist/gaesup/component/inner/common/RigidbodyRef.js +0 -7
- package/dist/gaesup/component/inner/common/setGroundRay.d.ts +0 -9
- package/dist/gaesup/component/inner/common/setGroundRay.js +0 -14
- package/dist/gaesup/component/inner/common/type.d.ts +0 -20
- package/dist/gaesup/component/inner/common/type.js +0 -1
- package/dist/gaesup/component/inner/rider/index.d.ts +0 -11
- package/dist/gaesup/component/inner/rider/index.js +0 -31
- package/dist/gaesup/component/inner/vehicle/collider.d.ts +0 -10
- package/dist/gaesup/component/inner/vehicle/collider.js +0 -19
- package/dist/gaesup/component/inner/vehicle/index.d.ts +0 -2
- package/dist/gaesup/component/inner/vehicle/index.js +0 -17
- package/dist/gaesup/component/inner/vehicle/wheels.d.ts +0 -7
- package/dist/gaesup/component/inner/vehicle/wheels.js +0 -64
- package/dist/gaesup/component/passive/airplane/index.d.ts +0 -13
- package/dist/gaesup/component/passive/airplane/index.js +0 -40
- package/dist/gaesup/component/passive/character/index.d.ts +0 -10
- package/dist/gaesup/component/passive/character/index.js +0 -46
- package/dist/gaesup/component/passive/type.d.ts +0 -20
- package/dist/gaesup/component/passive/type.js +0 -1
- package/dist/gaesup/component/passive/vehicle/index.d.ts +0 -13
- package/dist/gaesup/component/passive/vehicle/index.js +0 -17
- package/dist/gaesup/component/type.d.ts +0 -17
- package/dist/gaesup/component/type.js +0 -1
- package/dist/gaesup/controller/context/index.d.ts +0 -49
- package/dist/gaesup/controller/context/index.js +0 -59
- package/dist/gaesup/controller/context/reducer.d.ts +0 -12
- package/dist/gaesup/controller/context/reducer.js +0 -21
- package/dist/gaesup/controller/context/type.d.ts +0 -38
- package/dist/gaesup/controller/context/type.js +0 -1
- package/dist/gaesup/controller/debug/airplane.d.ts +0 -71
- package/dist/gaesup/controller/debug/airplane.js +0 -71
- package/dist/gaesup/controller/debug/character.d.ts +0 -27
- package/dist/gaesup/controller/debug/character.js +0 -27
- package/dist/gaesup/controller/debug/index.d.ts +0 -6
- package/dist/gaesup/controller/debug/index.js +0 -49
- package/dist/gaesup/controller/debug/vehicle.d.ts +0 -27
- package/dist/gaesup/controller/debug/vehicle.js +0 -27
- package/dist/gaesup/controller/index.d.ts +0 -3
- package/dist/gaesup/controller/index.js +0 -74
- package/dist/gaesup/controller/initialize/callback/index.d.ts +0 -2
- package/dist/gaesup/controller/initialize/callback/index.js +0 -62
- package/dist/gaesup/controller/initialize/callback/type.d.ts +0 -27
- package/dist/gaesup/controller/initialize/callback/type.js +0 -1
- package/dist/gaesup/controller/initialize/index.d.ts +0 -10
- package/dist/gaesup/controller/initialize/index.js +0 -75
- package/dist/gaesup/controller/type.d.ts +0 -85
- package/dist/gaesup/controller/type.js +0 -1
- package/dist/gaesup/gaesupProps/index.d.ts +0 -7
- package/dist/gaesup/gaesupProps/index.js +0 -46
- package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +0 -10
- package/dist/gaesup/hooks/useGaesupAnimation/index.js +0 -95
- package/dist/gaesup/hooks/useGaesupController/index.d.ts +0 -10
- package/dist/gaesup/hooks/useGaesupController/index.js +0 -14
- package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +0 -25
- package/dist/gaesup/hooks/useGaesupGltf/index.js +0 -73
- package/dist/gaesup/hooks/useJoyStick/index.d.ts +0 -39
- package/dist/gaesup/hooks/useJoyStick/index.js +0 -61
- package/dist/gaesup/hooks/usePushKey/index.d.ts +0 -3
- package/dist/gaesup/hooks/usePushKey/index.js +0 -29
- package/dist/gaesup/hooks/useRideable/index.d.ts +0 -28
- package/dist/gaesup/hooks/useRideable/index.js +0 -199
- package/dist/gaesup/hooks/useTeleport/index.d.ts +0 -3
- package/dist/gaesup/hooks/useTeleport/index.js +0 -12
- package/dist/gaesup/physics/airplane/damping.d.ts +0 -2
- package/dist/gaesup/physics/airplane/damping.js +0 -5
- package/dist/gaesup/physics/airplane/direction.d.ts +0 -2
- package/dist/gaesup/physics/airplane/direction.js +0 -65
- package/dist/gaesup/physics/airplane/gravity.d.ts +0 -14
- package/dist/gaesup/physics/airplane/gravity.js +0 -18
- package/dist/gaesup/physics/airplane/impulse.d.ts +0 -16
- package/dist/gaesup/physics/airplane/impulse.js +0 -31
- package/dist/gaesup/physics/airplane/index.d.ts +0 -2
- package/dist/gaesup/physics/airplane/index.js +0 -14
- package/dist/gaesup/physics/airplane/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/airplane/innerCalc.js +0 -27
- package/dist/gaesup/physics/airplane/landing.d.ts +0 -2
- package/dist/gaesup/physics/airplane/landing.js +0 -29
- package/dist/gaesup/physics/character/direction.d.ts +0 -23
- package/dist/gaesup/physics/character/direction.js +0 -55
- package/dist/gaesup/physics/character/impulse.d.ts +0 -2
- package/dist/gaesup/physics/character/impulse.js +0 -43
- package/dist/gaesup/physics/character/index.d.ts +0 -2
- package/dist/gaesup/physics/character/index.js +0 -8
- package/dist/gaesup/physics/character/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/character/innerCalc.js +0 -31
- package/dist/gaesup/physics/check/ground.d.ts +0 -2
- package/dist/gaesup/physics/check/ground.js +0 -15
- package/dist/gaesup/physics/check/index.d.ts +0 -2
- package/dist/gaesup/physics/check/index.js +0 -12
- package/dist/gaesup/physics/check/moving.d.ts +0 -2
- package/dist/gaesup/physics/check/moving.js +0 -16
- package/dist/gaesup/physics/check/push.d.ts +0 -2
- package/dist/gaesup/physics/check/push.js +0 -6
- package/dist/gaesup/physics/check/riding.d.ts +0 -2
- package/dist/gaesup/physics/check/riding.js +0 -7
- package/dist/gaesup/physics/check/rotate.d.ts +0 -2
- package/dist/gaesup/physics/check/rotate.js +0 -8
- package/dist/gaesup/physics/index.d.ts +0 -2
- package/dist/gaesup/physics/index.js +0 -58
- package/dist/gaesup/physics/type.d.ts +0 -36
- package/dist/gaesup/physics/type.js +0 -1
- package/dist/gaesup/physics/vehicle/damping.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/damping.js +0 -6
- package/dist/gaesup/physics/vehicle/direction.d.ts +0 -4
- package/dist/gaesup/physics/vehicle/direction.js +0 -30
- package/dist/gaesup/physics/vehicle/impulse.d.ts +0 -16
- package/dist/gaesup/physics/vehicle/impulse.js +0 -40
- package/dist/gaesup/physics/vehicle/index.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/index.js +0 -12
- package/dist/gaesup/physics/vehicle/innerCalc.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/innerCalc.js +0 -24
- package/dist/gaesup/physics/vehicle/landing.d.ts +0 -2
- package/dist/gaesup/physics/vehicle/landing.js +0 -29
- package/dist/gaesup/tools/gameBoy/GameBoyButton.d.ts +0 -9
- package/dist/gaesup/tools/gameBoy/GameBoyButton.js +0 -16
- package/dist/gaesup/tools/gameBoy/index.d.ts +0 -8
- package/dist/gaesup/tools/gameBoy/index.js +0 -22
- package/dist/gaesup/tools/gameBoy/type.d.ts +0 -4
- package/dist/gaesup/tools/gameBoy/type.js +0 -1
- package/dist/gaesup/tools/gamePad/GamePadButton.d.ts +0 -8
- package/dist/gaesup/tools/gamePad/GamePadButton.js +0 -21
- package/dist/gaesup/tools/gamePad/index.d.ts +0 -6
- package/dist/gaesup/tools/gamePad/index.js +0 -32
- package/dist/gaesup/tools/gamePad/type.d.ts +0 -6
- package/dist/gaesup/tools/gamePad/type.js +0 -1
- package/dist/gaesup/tools/joyStick/index.d.ts +0 -6
- package/dist/gaesup/tools/joyStick/index.js +0 -169
- package/dist/gaesup/tools/joyStick/type.d.ts +0 -19
- package/dist/gaesup/tools/joyStick/type.js +0 -1
- package/dist/gaesup/tools/jumpPortal/index.d.ts +0 -16
- package/dist/gaesup/tools/jumpPortal/index.js +0 -18
- package/dist/gaesup/tools/keyBoardToolTip/constant.d.ts +0 -402
- package/dist/gaesup/tools/keyBoardToolTip/constant.js +0 -122
- package/dist/gaesup/tools/keyBoardToolTip/default.d.ts +0 -10
- package/dist/gaesup/tools/keyBoardToolTip/default.js +0 -12
- package/dist/gaesup/tools/keyBoardToolTip/index.d.ts +0 -3
- package/dist/gaesup/tools/keyBoardToolTip/index.js +0 -70
- package/dist/gaesup/tools/keyBoardToolTip/type.d.ts +0 -37
- package/dist/gaesup/tools/keyBoardToolTip/type.js +0 -1
- package/dist/gaesup/tools/miniMap/default.d.ts +0 -9
- package/dist/gaesup/tools/miniMap/default.js +0 -9
- package/dist/gaesup/tools/miniMap/index.d.ts +0 -3
- package/dist/gaesup/tools/miniMap/index.js +0 -72
- package/dist/gaesup/tools/miniMap/type.d.ts +0 -25
- package/dist/gaesup/tools/miniMap/type.js +0 -1
- package/dist/gaesup/tools/rideable/index.d.ts +0 -3
- package/dist/gaesup/tools/rideable/index.js +0 -79
- package/dist/gaesup/tools/type.d.ts +0 -2
- package/dist/gaesup/tools/type.js +0 -1
- package/dist/gaesup/tools/zoomButton/index.d.ts +0 -18
- package/dist/gaesup/tools/zoomButton/index.js +0 -146
- package/dist/gaesup/utils/context.d.ts +0 -2
- package/dist/gaesup/utils/context.js +0 -3
- package/dist/gaesup/utils/debug.d.ts +0 -29
- package/dist/gaesup/utils/debug.js +0 -36
- package/dist/gaesup/utils/index.d.ts +0 -3
- package/dist/gaesup/utils/index.js +0 -3
- package/dist/gaesup/utils/ray.d.ts +0 -7
- package/dist/gaesup/utils/ray.js +0 -6
- package/dist/gaesup/utils/ref.d.ts +0 -2
- package/dist/gaesup/utils/ref.js +0 -16
- package/dist/gaesup/utils/type.d.ts +0 -5
- package/dist/gaesup/utils/type.js +0 -1
- package/dist/gaesup/utils/vector.d.ts +0 -10
- package/dist/gaesup/utils/vector.js +0 -33
- package/dist/gaesup/world/context/index.d.ts +0 -6
- package/dist/gaesup/world/context/index.js +0 -117
- package/dist/gaesup/world/context/reducer.d.ts +0 -29
- package/dist/gaesup/world/context/reducer.js +0 -21
- package/dist/gaesup/world/context/type.d.ts +0 -169
- package/dist/gaesup/world/context/type.js +0 -1
- package/dist/gaesup/world/debug/cameraOption.d.ts +0 -47
- package/dist/gaesup/world/debug/cameraOption.js +0 -47
- package/dist/gaesup/world/debug/index.d.ts +0 -6
- package/dist/gaesup/world/debug/index.js +0 -32
- package/dist/gaesup/world/debug/mode.d.ts +0 -10
- package/dist/gaesup/world/debug/mode.js +0 -10
- package/dist/gaesup/world/index.d.ts +0 -3
- package/dist/gaesup/world/index.js +0 -9
- package/dist/gaesup/world/initalize/index.d.ts +0 -35
- package/dist/gaesup/world/initalize/index.js +0 -62
- package/dist/gaesup/world/type.d.ts +0 -19
- package/dist/gaesup/world/type.js +0 -1
- package/dist/index.d.ts +0 -23
- package/index.ts +0 -29
- package/yarn-error.log +0 -12152
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaesup-world",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -68,5 +68,8 @@
|
|
|
68
68
|
"license": "MIT",
|
|
69
69
|
"bugs": {
|
|
70
70
|
"url": "https://github.com/jigglypop/gaesup-world/issues"
|
|
71
|
-
}
|
|
71
|
+
},
|
|
72
|
+
"files": [
|
|
73
|
+
"dist/*.css"
|
|
74
|
+
]
|
|
72
75
|
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { Ref } from "react";
|
|
2
|
-
import { AnimationAction, AnimationClip, AnimationMixer, Object3D, Object3DEventMap } from "three";
|
|
3
|
-
import { groundRayType } from "../controller/type";
|
|
4
|
-
export type Api<T extends AnimationClip> = {
|
|
5
|
-
ref: React.MutableRefObject<Object3D | undefined | null>;
|
|
6
|
-
clips: AnimationClip[];
|
|
7
|
-
mixer: AnimationMixer;
|
|
8
|
-
names: T["name"][];
|
|
9
|
-
actions: {
|
|
10
|
-
[key in T["name"]]: AnimationAction | null;
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export type playActionsType = {
|
|
14
|
-
type: "character" | "vehicle" | "airplane";
|
|
15
|
-
animationResult: Api<AnimationClip>;
|
|
16
|
-
currentAnimation?: string;
|
|
17
|
-
};
|
|
18
|
-
export type subscribeActionsType = {
|
|
19
|
-
type: "character" | "vehicle" | "airplane";
|
|
20
|
-
groundRay: groundRayType;
|
|
21
|
-
animations: AnimationClip[];
|
|
22
|
-
};
|
|
23
|
-
export type actionsType = {
|
|
24
|
-
[x: string]: THREE.AnimationAction | null;
|
|
25
|
-
};
|
|
26
|
-
export type playResultType = {
|
|
27
|
-
actions: actionsType;
|
|
28
|
-
ref: Ref<Object3D<Object3DEventMap>>;
|
|
29
|
-
};
|
|
30
|
-
export declare function subscribeActions({ type, groundRay, animations, }: subscribeActionsType): {
|
|
31
|
-
animationResult: {
|
|
32
|
-
ref: import("react").MutableRefObject<Object3D<Object3DEventMap>>;
|
|
33
|
-
clips: AnimationClip[];
|
|
34
|
-
mixer: AnimationMixer;
|
|
35
|
-
names: string[];
|
|
36
|
-
actions: {
|
|
37
|
-
[x: string]: AnimationAction;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
export default function playActions({ type, animationResult, currentAnimation, }: playActionsType): {
|
|
42
|
-
animationRef: import("react").MutableRefObject<Object3D<Object3DEventMap>>;
|
|
43
|
-
currentAnimation: string;
|
|
44
|
-
};
|
|
@@ -1,103 +0,0 @@
|
|
|
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 { useAnimations } from "@react-three/drei";
|
|
13
|
-
import { useFrame } from "@react-three/fiber";
|
|
14
|
-
import { useContext, useEffect } from "react";
|
|
15
|
-
import { useGaesupAnimation } from "../hooks/useGaesupAnimation";
|
|
16
|
-
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
|
|
17
|
-
export function subscribeActions(_a) {
|
|
18
|
-
var type = _a.type, groundRay = _a.groundRay, animations = _a.animations;
|
|
19
|
-
var _b = useContext(GaesupWorldContext), states = _b.states, activeState = _b.activeState;
|
|
20
|
-
var subscribeAll = useGaesupAnimation({ type: type }).subscribeAll;
|
|
21
|
-
var animationResult = useAnimations(animations);
|
|
22
|
-
// 초기 기본 애니메이션 등록
|
|
23
|
-
useEffect(function () {
|
|
24
|
-
subscribeAll([
|
|
25
|
-
{
|
|
26
|
-
tag: "walk",
|
|
27
|
-
condition: function () { return !states.isRunning && states.isMoving; },
|
|
28
|
-
action: function () { },
|
|
29
|
-
animationName: "walk",
|
|
30
|
-
key: "walk",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
tag: "run",
|
|
34
|
-
condition: function () { return states.isRunning; },
|
|
35
|
-
action: function () { },
|
|
36
|
-
animationName: "run",
|
|
37
|
-
key: "run",
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
tag: "jump",
|
|
41
|
-
condition: function () { return states.isJumping; },
|
|
42
|
-
action: function () { },
|
|
43
|
-
animationName: "jump",
|
|
44
|
-
key: "jump",
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
tag: "fall",
|
|
48
|
-
condition: function () { return groundRay.hit === null && activeState.velocity.y < 0; },
|
|
49
|
-
action: function () { },
|
|
50
|
-
animationName: "fall",
|
|
51
|
-
key: "fall",
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
tag: "ride",
|
|
55
|
-
condition: function () { return states.isPush["keyR"]; },
|
|
56
|
-
action: function () { },
|
|
57
|
-
animationName: "ride",
|
|
58
|
-
key: "ride",
|
|
59
|
-
},
|
|
60
|
-
]);
|
|
61
|
-
}, []);
|
|
62
|
-
return {
|
|
63
|
-
animationResult: animationResult,
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
export default function playActions(_a) {
|
|
67
|
-
var _b;
|
|
68
|
-
var type = _a.type, animationResult = _a.animationResult, currentAnimation = _a.currentAnimation;
|
|
69
|
-
var _c = useContext(GaesupWorldContext), mode = _c.mode, animationState = _c.animationState;
|
|
70
|
-
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
71
|
-
var _d = useGaesupAnimation({ type: type }), notify = _d.notify, store = _d.store;
|
|
72
|
-
var actions = animationResult.actions, ref = animationResult.ref;
|
|
73
|
-
var play = function (tag) {
|
|
74
|
-
animationState[type].current = tag;
|
|
75
|
-
var currentAnimation = store[tag];
|
|
76
|
-
if (currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.action) {
|
|
77
|
-
currentAnimation.action();
|
|
78
|
-
}
|
|
79
|
-
dispatch({
|
|
80
|
-
type: "update",
|
|
81
|
-
payload: {
|
|
82
|
-
animationState: __assign({}, animationState),
|
|
83
|
-
},
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
useEffect(function () {
|
|
87
|
-
var _a;
|
|
88
|
-
var action = (_a = actions[currentAnimation || animationState[type].current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
|
|
89
|
-
return function () {
|
|
90
|
-
action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
|
|
91
|
-
};
|
|
92
|
-
}, [currentAnimation, mode.type]);
|
|
93
|
-
useFrame(function () {
|
|
94
|
-
if (!currentAnimation) {
|
|
95
|
-
var tag = notify();
|
|
96
|
-
play(tag);
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
return {
|
|
100
|
-
animationRef: ref,
|
|
101
|
-
currentAnimation: (_b = animationState === null || animationState === void 0 ? void 0 : animationState[type]) === null || _b === void 0 ? void 0 : _b.current,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { cameraPropType } from "../../physics/type";
|
|
2
|
-
import { activeStateType, cameraOptionType } from "../../world/context/type";
|
|
3
|
-
export declare const makeNormalCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
|
|
4
|
-
export default function normal(prop: cameraPropType): void;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { V3 } from "../../utils/vector";
|
|
2
|
-
export var makeNormalCameraPosition = function (activeState, cameraOption) {
|
|
3
|
-
var YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
|
|
4
|
-
var cameraPosition = activeState.position
|
|
5
|
-
.clone()
|
|
6
|
-
.add(V3(0, YDistance, ZDistance));
|
|
7
|
-
return cameraPosition;
|
|
8
|
-
};
|
|
9
|
-
export default function normal(prop) {
|
|
10
|
-
var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
|
|
11
|
-
if (!state || !state.camera)
|
|
12
|
-
return;
|
|
13
|
-
var cameraPosition = activeState.position
|
|
14
|
-
.clone()
|
|
15
|
-
.add(V3(0, cameraOption.YDistance, cameraOption.ZDistance));
|
|
16
|
-
state.camera.position.lerp(cameraPosition, 1);
|
|
17
|
-
state.camera.lookAt(activeState.position.clone());
|
|
18
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { cameraPropType } from "../../physics/type";
|
|
2
|
-
import { activeStateType, cameraOptionType } from "../../world/context/type";
|
|
3
|
-
export declare const makeOrbitCameraPosition: (activeState: activeStateType, cameraOption: cameraOptionType) => import("three").Vector3;
|
|
4
|
-
export default function orbit(prop: cameraPropType): void;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { quat } from "@react-three/rapier";
|
|
2
|
-
import { V3 } from "../../utils/vector";
|
|
3
|
-
export var makeOrbitCameraPosition = function (activeState, cameraOption) {
|
|
4
|
-
var XDistance = cameraOption.XDistance, YDistance = cameraOption.YDistance, ZDistance = cameraOption.ZDistance;
|
|
5
|
-
var cameraPosition = activeState.position.clone().add(V3(Math.sin(activeState.euler.y), 1, Math.cos(activeState.euler.y))
|
|
6
|
-
.normalize()
|
|
7
|
-
.clone()
|
|
8
|
-
.multiply(V3(-XDistance, YDistance, -ZDistance)));
|
|
9
|
-
return cameraPosition;
|
|
10
|
-
};
|
|
11
|
-
export default function orbit(prop) {
|
|
12
|
-
var state = prop.state, _a = prop.worldContext, activeState = _a.activeState, cameraOption = _a.cameraOption;
|
|
13
|
-
if (!state || !state.camera)
|
|
14
|
-
return;
|
|
15
|
-
var cameraPosition = makeOrbitCameraPosition(activeState, cameraOption);
|
|
16
|
-
state.camera.position.lerp(cameraPosition, 1);
|
|
17
|
-
state.camera.quaternion.copy(activeState.quat
|
|
18
|
-
.clone()
|
|
19
|
-
.multiply(quat().setFromAxisAngle(V3(0, 1, 0), Math.PI)));
|
|
20
|
-
state.camera.rotation.copy(activeState.euler);
|
|
21
|
-
state.camera.lookAt(activeState.position.clone());
|
|
22
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
export default function detector(cameraProp) {
|
|
3
|
-
var cameraRay = cameraProp.cameraRay, intersectObjectMap = cameraProp.intersectObjectMap;
|
|
4
|
-
var intersects = cameraRay.rayCast.intersectObjects(Object.values(intersectObjectMap));
|
|
5
|
-
var intersectId = {};
|
|
6
|
-
intersects.map(function (_a) {
|
|
7
|
-
var object = _a.object;
|
|
8
|
-
if (object instanceof THREE.Mesh) {
|
|
9
|
-
intersectId[object.uuid] = true;
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
Object.values(intersectObjectMap).map(function (mesh) {
|
|
13
|
-
if (mesh instanceof THREE.Mesh && mesh.material instanceof THREE.Material) {
|
|
14
|
-
var material = mesh.material;
|
|
15
|
-
if (intersectId[mesh.uuid]) {
|
|
16
|
-
material.opacity = 0.2;
|
|
17
|
-
material.transparent = true;
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
material.opacity = 1;
|
|
21
|
-
material.transparent = false;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { controllerInnerType, refsType } from "../controller/type";
|
|
2
|
-
export default function Camera({ refs, prop, control, }: {
|
|
3
|
-
refs: refsType;
|
|
4
|
-
prop: controllerInnerType;
|
|
5
|
-
control: {
|
|
6
|
-
[key: string]: boolean;
|
|
7
|
-
};
|
|
8
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,139 +0,0 @@
|
|
|
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
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
-
function step(op) {
|
|
26
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
-
switch (op[0]) {
|
|
31
|
-
case 0: case 1: t = op; break;
|
|
32
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
-
default:
|
|
36
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
-
if (t[2]) _.ops.pop();
|
|
41
|
-
_.trys.pop(); continue;
|
|
42
|
-
}
|
|
43
|
-
op = body.call(thisArg, _);
|
|
44
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
-
import { CameraControls } from "@react-three/drei";
|
|
50
|
-
import { useFrame, useThree } from "@react-three/fiber";
|
|
51
|
-
import { vec3 } from "@react-three/rapier";
|
|
52
|
-
import { useContext, useEffect, useMemo, useRef } from "react";
|
|
53
|
-
import * as THREE from "three";
|
|
54
|
-
import { GaesupControllerContext } from "../controller/context";
|
|
55
|
-
import { GaesupWorldContext } from "../world/context";
|
|
56
|
-
import normal from "./control/normal";
|
|
57
|
-
import orbit from "./control/orbit";
|
|
58
|
-
import detector from "./detector";
|
|
59
|
-
export default function Camera(_a) {
|
|
60
|
-
var _this = this;
|
|
61
|
-
var refs = _a.refs, prop = _a.prop, control = _a.control;
|
|
62
|
-
var worldContext = useContext(GaesupWorldContext);
|
|
63
|
-
var controllerContext = useContext(GaesupControllerContext);
|
|
64
|
-
var mode = worldContext.mode, cameraOption = worldContext.cameraOption;
|
|
65
|
-
var rigidBodyRef = refs.rigidBodyRef, outerGroupRef = refs.outerGroupRef;
|
|
66
|
-
var _b = useThree(), scene = _b.scene, camera = _b.camera;
|
|
67
|
-
var cameraRef = useRef();
|
|
68
|
-
var intersectObjectMap = useMemo(function () { return ({}); }, []);
|
|
69
|
-
var cameraProp = __assign(__assign({}, prop), { control: control, controllerContext: controllerContext, worldContext: worldContext, intersectObjectMap: intersectObjectMap });
|
|
70
|
-
var getMeshs = function (object) {
|
|
71
|
-
if (object.userData && object.userData.intangible)
|
|
72
|
-
return;
|
|
73
|
-
if (object instanceof THREE.Mesh &&
|
|
74
|
-
object.geometry.type !== "InstancedBufferGeometry") {
|
|
75
|
-
intersectObjectMap[object.uuid] = object;
|
|
76
|
-
}
|
|
77
|
-
object.children.forEach(function (child) {
|
|
78
|
-
getMeshs(child);
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
useEffect(function () {
|
|
82
|
-
scene.children.forEach(function (child) { return getMeshs(child); });
|
|
83
|
-
}, []);
|
|
84
|
-
var position = useMemo(function () { return camera.position; }, []);
|
|
85
|
-
var dir = useMemo(function () { return vec3(); }, []);
|
|
86
|
-
cameraProp.cameraRay.rayCast = new THREE.Raycaster(cameraProp.cameraRay.origin, cameraProp.cameraRay.dir, 0, -cameraOption.maxDistance);
|
|
87
|
-
useEffect(function () {
|
|
88
|
-
cameraProp.cameraRay.origin.copy(position);
|
|
89
|
-
cameraProp.cameraRay.dir.copy(camera.getWorldDirection(dir));
|
|
90
|
-
}, [cameraProp]);
|
|
91
|
-
useFrame(function (state, delta) {
|
|
92
|
-
if (!rigidBodyRef ||
|
|
93
|
-
!rigidBodyRef.current ||
|
|
94
|
-
!outerGroupRef ||
|
|
95
|
-
!outerGroupRef.current)
|
|
96
|
-
return;
|
|
97
|
-
cameraProp.delta = delta;
|
|
98
|
-
cameraProp.state = state;
|
|
99
|
-
if (!worldContext.block.camera) {
|
|
100
|
-
if (mode.control === "orbit") {
|
|
101
|
-
orbit(cameraProp);
|
|
102
|
-
}
|
|
103
|
-
else if (mode.control === "normal") {
|
|
104
|
-
normal(cameraProp);
|
|
105
|
-
}
|
|
106
|
-
detector(cameraProp);
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
// moveTo 함수 정의
|
|
110
|
-
worldContext.moveTo = function (position, target) { return __awaiter(_this, void 0, void 0, function () {
|
|
111
|
-
return __generator(this, function (_a) {
|
|
112
|
-
switch (_a.label) {
|
|
113
|
-
case 0:
|
|
114
|
-
camera.position.copy(position);
|
|
115
|
-
if (!(mode.control === "orbit")) return [3 /*break*/, 2];
|
|
116
|
-
return [4 /*yield*/, Promise.all([
|
|
117
|
-
cameraRef.current.setPosition(position.x, position.y, position.z, true),
|
|
118
|
-
camera.rotation.copy(worldContext.activeState.euler),
|
|
119
|
-
cameraRef.current.setLookAt(position.x, position.y, position.z, target.x, target.y, target.z, true),
|
|
120
|
-
])];
|
|
121
|
-
case 1:
|
|
122
|
-
_a.sent();
|
|
123
|
-
return [3 /*break*/, 4];
|
|
124
|
-
case 2:
|
|
125
|
-
if (!(mode.control === "normal")) return [3 /*break*/, 4];
|
|
126
|
-
return [4 /*yield*/, Promise.all([
|
|
127
|
-
cameraRef.current.setPosition(0, position.y, position.z, true),
|
|
128
|
-
camera.rotation.copy(worldContext.activeState.euler),
|
|
129
|
-
cameraRef.current.setLookAt(0, position.y, position.z, target.x, target.y, target.z, true),
|
|
130
|
-
])];
|
|
131
|
-
case 3:
|
|
132
|
-
_a.sent();
|
|
133
|
-
_a.label = 4;
|
|
134
|
-
case 4: return [2 /*return*/];
|
|
135
|
-
}
|
|
136
|
-
});
|
|
137
|
-
}); };
|
|
138
|
-
return _jsx(CameraControls, { ref: cameraRef });
|
|
139
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export type cameraRayType = {
|
|
2
|
-
origin: THREE.Vector3;
|
|
3
|
-
hit: THREE.Raycaster;
|
|
4
|
-
rayCast: THREE.Raycaster | null;
|
|
5
|
-
length: number;
|
|
6
|
-
dir: THREE.Vector3;
|
|
7
|
-
position: THREE.Vector3;
|
|
8
|
-
intersects: THREE.Intersection<THREE.Mesh>[];
|
|
9
|
-
detected: THREE.Intersection<THREE.Mesh>[];
|
|
10
|
-
intersectObjectMap: {
|
|
11
|
-
[uuid: string]: THREE.Mesh;
|
|
12
|
-
};
|
|
13
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { refsType } from "../../../controller/type";
|
|
3
|
-
import { urlsType } from "../../../world/context/type";
|
|
4
|
-
export declare function AirplaneRef({ children, enableRiding, isRiderOn, offset, refs, urls, }: {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
enableRiding?: boolean;
|
|
7
|
-
isRiderOn?: boolean;
|
|
8
|
-
offset?: THREE.Vector3;
|
|
9
|
-
refs: refsType;
|
|
10
|
-
urls: urlsType;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AirplaneInnerRef } from "../../inner/airplane";
|
|
3
|
-
export function AirplaneRef(_a) {
|
|
4
|
-
var children = _a.children, enableRiding = _a.enableRiding, isRiderOn = _a.isRiderOn, offset = _a.offset, refs = _a.refs, urls = _a.urls;
|
|
5
|
-
return (_jsx(AirplaneInnerRef, { refs: refs, urls: urls, isRiderOn: isRiderOn, enableRiding: enableRiding, offset: offset, children: children }));
|
|
6
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { controllerInnerType, refsType } from "../../../controller/type";
|
|
2
|
-
import { urlsType } from "../../../world/context/type";
|
|
3
|
-
export declare function CharacterRef({ props, refs, urls, }: {
|
|
4
|
-
props: controllerInnerType;
|
|
5
|
-
refs: refsType;
|
|
6
|
-
urls: urlsType;
|
|
7
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { vec3 } from "@react-three/rapier";
|
|
3
|
-
import playActions, { subscribeActions } from "../../../animation/actions";
|
|
4
|
-
import initCallback from "../../../controller/initialize/callback";
|
|
5
|
-
import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
|
|
6
|
-
import { CharacterInnerRef, calcCharacterColliderProps, } from "../../inner/character";
|
|
7
|
-
import { setGroundRay } from "../../inner/common/setGroundRay";
|
|
8
|
-
export function CharacterRef(_a) {
|
|
9
|
-
var props = _a.props, refs = _a.refs, urls = _a.urls;
|
|
10
|
-
initCallback(props, "character");
|
|
11
|
-
var colliderRef = refs.colliderRef;
|
|
12
|
-
var _b = useGltfAndSize({ url: urls.characterUrl }), size = _b.size, gltf = _b.gltf;
|
|
13
|
-
var collider = calcCharacterColliderProps(size);
|
|
14
|
-
props.groundRay.offset = vec3({
|
|
15
|
-
x: 0,
|
|
16
|
-
y: (collider === null || collider === void 0 ? void 0 : collider.halfHeight) ? -(collider === null || collider === void 0 ? void 0 : collider.halfHeight) : -1,
|
|
17
|
-
z: 0,
|
|
18
|
-
});
|
|
19
|
-
setGroundRay({
|
|
20
|
-
groundRay: props.groundRay,
|
|
21
|
-
length: (collider === null || collider === void 0 ? void 0 : collider.radius) || 0 + 2,
|
|
22
|
-
colliderRef: colliderRef,
|
|
23
|
-
});
|
|
24
|
-
var animationResult = subscribeActions({
|
|
25
|
-
type: "character",
|
|
26
|
-
groundRay: props.groundRay,
|
|
27
|
-
animations: gltf.animations,
|
|
28
|
-
}).animationResult;
|
|
29
|
-
var _c = playActions({
|
|
30
|
-
type: "character",
|
|
31
|
-
animationResult: animationResult,
|
|
32
|
-
}), animationRef = _c.animationRef, currentAnimation = _c.currentAnimation;
|
|
33
|
-
return (_jsx(CharacterInnerRef, { animationRef: animationRef, refs: refs, urls: urls, currentAnimation: currentAnimation, children: props.children }));
|
|
34
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { groundRayType, refsType } from "../../../controller/type";
|
|
3
|
-
import { urlsType } from "../../../world/context/type";
|
|
4
|
-
export declare function VehicleRef({ children, groundRay, enableRiding, isRiderOn, offset, refs, urls, }: {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
groundRay: groundRayType;
|
|
7
|
-
enableRiding?: boolean;
|
|
8
|
-
isRiderOn?: boolean;
|
|
9
|
-
offset?: THREE.Vector3;
|
|
10
|
-
refs: refsType;
|
|
11
|
-
urls: urlsType;
|
|
12
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { vec3 } from "@react-three/rapier";
|
|
3
|
-
import playActions, { subscribeActions } from "../../../animation/actions";
|
|
4
|
-
import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
|
|
5
|
-
import { setGroundRay } from "../../inner/common/setGroundRay";
|
|
6
|
-
import { VehicleInnerRef } from "../../inner/vehicle";
|
|
7
|
-
export function VehicleRef(_a) {
|
|
8
|
-
var children = _a.children, groundRay = _a.groundRay, enableRiding = _a.enableRiding, isRiderOn = _a.isRiderOn, offset = _a.offset, refs = _a.refs, urls = _a.urls;
|
|
9
|
-
var colliderRef = refs.colliderRef;
|
|
10
|
-
var _b = useGltfAndSize({ url: urls.vehicleUrl }), size = _b.size, gltf = _b.gltf;
|
|
11
|
-
groundRay.offset = vec3({
|
|
12
|
-
x: 0,
|
|
13
|
-
y: size.y * 3,
|
|
14
|
-
z: 0,
|
|
15
|
-
});
|
|
16
|
-
setGroundRay({
|
|
17
|
-
groundRay: groundRay,
|
|
18
|
-
length: size.y * 3,
|
|
19
|
-
colliderRef: colliderRef,
|
|
20
|
-
});
|
|
21
|
-
var animationResult = subscribeActions({
|
|
22
|
-
type: "vehicle",
|
|
23
|
-
groundRay: groundRay,
|
|
24
|
-
animations: gltf.animations,
|
|
25
|
-
}).animationResult;
|
|
26
|
-
var _c = playActions({
|
|
27
|
-
type: "vehicle",
|
|
28
|
-
animationResult: animationResult,
|
|
29
|
-
}), animationRef = _c.animationRef, currentAnimation = _c.currentAnimation;
|
|
30
|
-
return (_jsx(VehicleInnerRef, { refs: refs, urls: urls, isRiderOn: isRiderOn, enableRiding: enableRiding, offset: offset, currentAnimation: currentAnimation, children: children }));
|
|
31
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { controllerInnerType, refsType } from "../controller/type";
|
|
2
|
-
import { urlsType } from "../world/context/type";
|
|
3
|
-
export declare function GaesupComponent({ props, refs, urls, }: {
|
|
4
|
-
props: controllerInnerType;
|
|
5
|
-
refs: refsType;
|
|
6
|
-
urls: urlsType;
|
|
7
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { vec3 } from "@react-three/rapier";
|
|
3
|
-
import { useContext } from "react";
|
|
4
|
-
import calculation from "../physics";
|
|
5
|
-
import { GaesupWorldContext } from "../world/context";
|
|
6
|
-
import { AirplaneRef } from "./active/airplane";
|
|
7
|
-
import { CharacterRef } from "./active/character";
|
|
8
|
-
import { VehicleRef } from "./active/vehicle";
|
|
9
|
-
export function GaesupComponent(_a) {
|
|
10
|
-
var props = _a.props, refs = _a.refs, urls = _a.urls;
|
|
11
|
-
var _b = useContext(GaesupWorldContext), mode = _b.mode, states = _b.states, rideable = _b.rideable;
|
|
12
|
-
var enableRiding = states.enableRiding, isRiderOn = states.isRiderOn, rideableId = states.rideableId;
|
|
13
|
-
calculation(props);
|
|
14
|
-
return (_jsxs(_Fragment, { children: [mode.type === "character" && (_jsx(CharacterRef, { props: props, refs: refs, urls: urls })), mode.type === "vehicle" && (_jsx(VehicleRef, { groundRay: props.groundRay, refs: refs, urls: urls, enableRiding: enableRiding, isRiderOn: isRiderOn, offset: rideableId && rideable[rideableId]
|
|
15
|
-
? rideable[rideableId].offset
|
|
16
|
-
: vec3(), children: props.children })), mode.type === "airplane" && (_jsx(AirplaneRef, { refs: refs, urls: urls, enableRiding: enableRiding, isRiderOn: isRiderOn, offset: rideableId && rideable[rideableId]
|
|
17
|
-
? rideable[rideableId].offset
|
|
18
|
-
: vec3(), children: props.children }))] }));
|
|
19
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { CuboidCollider } from "@react-three/rapier";
|
|
3
|
-
import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
|
|
4
|
-
import { InnerGroupRef } from "../common/InnerGroupRef";
|
|
5
|
-
import { OuterGroupRef } from "../common/OuterGroupRef";
|
|
6
|
-
import { RigidBodyRef } from "../common/RigidbodyRef";
|
|
7
|
-
import RiderRef from "../rider";
|
|
8
|
-
export function AirplaneInnerRef(_a) {
|
|
9
|
-
var children = _a.children, refs = _a.refs, urls = _a.urls, isRiderOn = _a.isRiderOn, enableRiding = _a.enableRiding, offset = _a.offset, name = _a.name, position = _a.position, rotation = _a.rotation, userData = _a.userData, onCollisionEnter = _a.onCollisionEnter;
|
|
10
|
-
var airplaneUrl = urls.airplaneUrl;
|
|
11
|
-
var rigidBodyRef = refs.rigidBodyRef, innerGroupRef = refs.innerGroupRef, outerGroupRef = refs.outerGroupRef;
|
|
12
|
-
var size = useGltfAndSize({
|
|
13
|
-
url: airplaneUrl,
|
|
14
|
-
}).size;
|
|
15
|
-
return (_jsx(OuterGroupRef, { ref: outerGroupRef, children: airplaneUrl && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, children: [_jsx(CuboidCollider, { args: [size.x / 2, size.y / 2, size.z / 2], position: [0, size.y / 2, 0] }), children, _jsx(InnerGroupRef, { type: "airplane", url: airplaneUrl, currentAnimation: "idle", ref: innerGroupRef, children: enableRiding && isRiderOn && urls.characterUrl && (_jsx(RiderRef, { urls: urls, offset: offset })) })] })) }));
|
|
16
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { refsType } from "../../../controller/type";
|
|
2
|
-
import { ReactNode, Ref } from "react";
|
|
3
|
-
import { Object3D, Object3DEventMap } from "three";
|
|
4
|
-
import { urlsType } from "../../../world/context/type";
|
|
5
|
-
export declare const calcCharacterColliderProps: (characterSize: THREE.Vector3) => {
|
|
6
|
-
height: number;
|
|
7
|
-
halfHeight: number;
|
|
8
|
-
radius: number;
|
|
9
|
-
diameter: number;
|
|
10
|
-
};
|
|
11
|
-
export type characterColliderType = {
|
|
12
|
-
height: number;
|
|
13
|
-
halfHeight: number;
|
|
14
|
-
radius: number;
|
|
15
|
-
diameter: number;
|
|
16
|
-
};
|
|
17
|
-
export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, }: {
|
|
18
|
-
children: ReactNode;
|
|
19
|
-
refs: Partial<refsType>;
|
|
20
|
-
urls: urlsType;
|
|
21
|
-
position?: THREE.Vector3;
|
|
22
|
-
euler?: THREE.Euler;
|
|
23
|
-
animationRef?: Ref<Object3D<Object3DEventMap>>;
|
|
24
|
-
currentAnimation?: string;
|
|
25
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { CapsuleCollider } from "@react-three/rapier";
|
|
3
|
-
import { useGltfAndSize } from "../../../hooks/useGaesupGltf";
|
|
4
|
-
import { InnerGroupRef } from "../common/InnerGroupRef";
|
|
5
|
-
import { OuterGroupRef } from "../common/OuterGroupRef";
|
|
6
|
-
import { RigidBodyRef } from "../common/RigidbodyRef";
|
|
7
|
-
export var calcCharacterColliderProps = function (characterSize) {
|
|
8
|
-
if (!characterSize)
|
|
9
|
-
return null;
|
|
10
|
-
var heightPlusDiameter = characterSize.y / 2;
|
|
11
|
-
var diameter = Math.max(characterSize.x, characterSize.z);
|
|
12
|
-
var radius = diameter / 2;
|
|
13
|
-
var height = heightPlusDiameter - radius;
|
|
14
|
-
var halfHeight = height / 2;
|
|
15
|
-
return {
|
|
16
|
-
height: height,
|
|
17
|
-
halfHeight: halfHeight,
|
|
18
|
-
radius: radius,
|
|
19
|
-
diameter: diameter,
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
export function CharacterInnerRef(_a) {
|
|
23
|
-
var children = _a.children, refs = _a.refs, urls = _a.urls, position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation;
|
|
24
|
-
var outerGroupRef = refs.outerGroupRef, rigidBodyRef = refs.rigidBodyRef, colliderRef = refs.colliderRef, innerGroupRef = refs.innerGroupRef;
|
|
25
|
-
var size = useGltfAndSize({ url: urls.characterUrl }).size;
|
|
26
|
-
var collider = calcCharacterColliderProps(size);
|
|
27
|
-
return (_jsx(_Fragment, { children: collider && (_jsxs(OuterGroupRef, { ref: outerGroupRef, children: [children, _jsxs(RigidBodyRef, { ref: rigidBodyRef, name: "character", position: position, rotation: euler, children: [_jsx(CapsuleCollider, { ref: colliderRef, args: [collider.height, collider.radius], position: [0, collider.height + collider.radius, 0] }), _jsx(InnerGroupRef, { type: "character", ref: innerGroupRef, url: urls.characterUrl, currentAnimation: currentAnimation })] })] })) }));
|
|
28
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
export type InnerGroupRefType = {
|
|
4
|
-
children?: React.ReactNode;
|
|
5
|
-
type: "character" | "vehicle" | "airplane";
|
|
6
|
-
currentAnimation: string;
|
|
7
|
-
url: string;
|
|
8
|
-
rotation?: THREE.Euler;
|
|
9
|
-
};
|
|
10
|
-
export declare const InnerGroupRef: import("react").ForwardRefExoticComponent<InnerGroupRefType & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
|