gaesup-world 0.0.691 → 0.0.692
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 +16 -0
- package/dist/gaesup/animation/actions.d.ts +4 -3
- package/dist/gaesup/animation/actions.js +18 -5
- package/dist/gaesup/animation/passiveActions.d.ts +9 -0
- package/dist/gaesup/animation/passiveActions.js +16 -0
- package/dist/gaesup/component/index.d.ts +5 -5
- package/dist/gaesup/component/index.js +11 -5
- package/dist/gaesup/component/{Airplane.d.ts → mode/Airplane.d.ts} +1 -1
- package/dist/gaesup/component/mode/Airplane.js +8 -0
- package/dist/gaesup/component/{Character.d.ts → mode/Character.d.ts} +1 -1
- package/dist/gaesup/component/mode/Character.js +8 -0
- package/dist/gaesup/component/{Vehicle.d.ts → mode/Vehicle.d.ts} +1 -1
- package/dist/gaesup/component/mode/Vehicle.js +8 -0
- package/dist/gaesup/component/mode/index.d.ts +3 -0
- package/dist/gaesup/component/mode/index.js +3 -0
- package/dist/gaesup/component/passive/Airplane.d.ts +5 -0
- package/dist/gaesup/component/passive/Airplane.js +8 -0
- package/dist/gaesup/component/passive/Vehicle.d.ts +5 -0
- package/dist/gaesup/component/passive/Vehicle.js +8 -0
- package/dist/gaesup/component/passive/index.d.ts +3 -0
- package/dist/gaesup/component/passive/index.js +3 -0
- package/dist/gaesup/component/passive/passiveCharacter/index.d.ts +2 -0
- package/dist/gaesup/component/passive/passiveCharacter/index.js +20 -0
- package/dist/gaesup/component/passive/passiveCharacter/innerGltf.d.ts +3 -0
- package/dist/gaesup/component/passive/passiveCharacter/innerGltf.js +24 -0
- package/dist/gaesup/component/passive/passiveCharacter/outerGroup.d.ts +4 -0
- package/dist/gaesup/component/passive/passiveCharacter/outerGroup.js +8 -0
- package/dist/gaesup/component/passive/passiveCharacter/rigidbody.d.ts +5 -0
- package/dist/gaesup/component/passive/passiveCharacter/rigidbody.js +7 -0
- package/dist/gaesup/component/passive/type.d.ts +11 -0
- package/dist/gaesup/component/ref/airplane/collider.d.ts +6 -0
- package/dist/gaesup/component/ref/airplane/collider.js +22 -0
- package/dist/gaesup/component/ref/airplane/group.d.ts +6 -0
- package/dist/gaesup/component/ref/airplane/group.js +19 -0
- package/dist/gaesup/component/ref/airplane/index.d.ts +5 -0
- package/dist/gaesup/component/ref/airplane/index.js +10 -0
- package/dist/gaesup/component/{gltf/AirplaneGltf.js → ref/airplane/innerGltf.js} +1 -1
- package/dist/gaesup/component/ref/airplane/rigidbody.d.ts +7 -0
- package/dist/gaesup/component/ref/airplane/rigidbody.js +22 -0
- package/dist/gaesup/component/ref/character/collider.d.ts +6 -0
- package/dist/gaesup/component/ref/character/collider.js +24 -0
- package/dist/gaesup/component/ref/character/group.d.ts +6 -0
- package/dist/gaesup/component/ref/character/group.js +17 -0
- package/dist/gaesup/component/ref/character/index.d.ts +6 -0
- package/dist/gaesup/component/ref/character/index.js +13 -0
- package/dist/gaesup/component/{gltf/CharacterGltf.d.ts → ref/character/innerGltf.d.ts} +2 -2
- package/dist/gaesup/component/{gltf/CharacterGltf.js → ref/character/innerGltf.js} +16 -15
- package/dist/gaesup/component/ref/character/outerGroup.d.ts +4 -0
- package/dist/gaesup/component/ref/character/outerGroup.js +8 -0
- package/dist/gaesup/component/ref/character/rigidbody.d.ts +7 -0
- package/dist/gaesup/component/ref/character/rigidbody.js +22 -0
- package/dist/gaesup/component/ref/character/slopeRay.d.ts +6 -0
- package/dist/gaesup/component/ref/character/slopeRay.js +10 -0
- package/dist/gaesup/component/ref/vehicle/collider.d.ts +3 -0
- package/dist/gaesup/component/ref/vehicle/collider.js +9 -0
- package/dist/gaesup/component/ref/vehicle/group.d.ts +6 -0
- package/dist/gaesup/component/ref/vehicle/group.js +19 -0
- package/dist/gaesup/component/ref/vehicle/index.d.ts +5 -0
- package/dist/gaesup/component/ref/vehicle/index.js +14 -0
- package/dist/gaesup/component/{gltf/VehicleGltf.js → ref/vehicle/innerGltf.js} +1 -1
- package/dist/gaesup/component/ref/vehicle/rigidbody.d.ts +7 -0
- package/dist/gaesup/component/ref/vehicle/rigidbody.js +22 -0
- package/dist/gaesup/component/ref/vehicle/wheel.d.ts +11 -0
- package/dist/gaesup/component/ref/vehicle/wheel.js +12 -0
- package/dist/gaesup/component/{gltf/WheelJoint.d.ts → ref/vehicle/wheels.d.ts} +1 -1
- package/dist/gaesup/component/{gltf/WheelJoint.js → ref/vehicle/wheels.js} +5 -5
- package/dist/gaesup/controller/context/reducer.d.ts +1 -1
- package/dist/gaesup/controller/context/type.d.ts +1 -1
- package/dist/gaesup/controller/index.js +14 -16
- package/dist/gaesup/controller/initialize/callback/index.d.ts +2 -0
- package/dist/gaesup/{initial → controller/initialize}/callback/index.js +5 -6
- package/dist/gaesup/{initial → controller/initialize}/callback/type.d.ts +3 -6
- package/dist/gaesup/controller/initialize/callback/type.js +1 -0
- package/dist/gaesup/controller/type.d.ts +6 -4
- package/dist/gaesup/hooks/index.d.ts +1 -0
- package/dist/gaesup/hooks/index.js +1 -0
- package/dist/gaesup/hooks/useGaesupController/index.d.ts +6 -0
- package/dist/gaesup/hooks/useGaesupController/index.js +12 -0
- package/dist/gaesup/index.d.ts +2 -2
- package/dist/gaesup/index.js +2 -2
- package/dist/gaesup/mutation/character/index.d.ts +2 -0
- package/dist/gaesup/mutation/character/index.js +8 -0
- package/dist/gaesup/mutation/character/rotation.d.ts +2 -0
- package/dist/gaesup/mutation/character/rotation.js +5 -0
- package/dist/gaesup/mutation/character/stabilizing.d.ts +2 -0
- package/dist/gaesup/mutation/character/stabilizing.js +4 -0
- package/dist/gaesup/mutation/character/transition.d.ts +2 -0
- package/dist/gaesup/mutation/character/transition.js +4 -0
- package/dist/gaesup/mutation/index.d.ts +2 -0
- package/dist/gaesup/mutation/index.js +22 -0
- package/dist/gaesup/mutation/type.d.ts +18 -0
- package/dist/gaesup/mutation/type.js +1 -0
- package/dist/gaesup/physics/index.js +9 -2
- package/dist/gaesup/utils/gltf.d.ts +7 -0
- package/dist/gaesup/utils/gltf.js +10 -0
- package/dist/gaesup/world/context/index.js +2 -0
- package/dist/gaesup/world/context/reducer.d.ts +4 -4
- package/dist/gaesup/world/context/type.d.ts +1 -1
- package/dist/gaesup/world/initalize/collider/gltf.d.ts +1 -1
- package/dist/gaesup/world/initalize/collider/gltf.js +15 -32
- package/dist/gaesup/world/initalize/collider/vehicle.js +38 -17
- package/dist/gaesup/world/initalize/index.d.ts +4 -4
- package/package.json +5 -2
- package/dist/gaesup/component/Airplane.js +0 -14
- package/dist/gaesup/component/Character.js +0 -13
- package/dist/gaesup/component/Vehicle.js +0 -15
- package/dist/gaesup/component/gltf/index.d.ts +0 -4
- package/dist/gaesup/component/gltf/index.js +0 -4
- package/dist/gaesup/component/ref/airplane.d.ts +0 -16
- package/dist/gaesup/component/ref/airplane.js +0 -46
- package/dist/gaesup/component/ref/character.d.ts +0 -20
- package/dist/gaesup/component/ref/character.js +0 -56
- package/dist/gaesup/component/ref/index.d.ts +0 -3
- package/dist/gaesup/component/ref/index.js +0 -3
- package/dist/gaesup/component/ref/vehicle.d.ts +0 -24
- package/dist/gaesup/component/ref/vehicle.js +0 -41
- package/dist/gaesup/component/setInit.d.ts +0 -3
- package/dist/gaesup/component/setInit.js +0 -10
- package/dist/gaesup/initial/callback/index.d.ts +0 -2
- package/dist/gaesup/initial/index.d.ts +0 -1
- package/dist/gaesup/initial/index.js +0 -1
- package/dist/gaesup/utils/constant.d.ts +0 -1
- package/dist/gaesup/utils/constant.js +0 -1
- /package/dist/gaesup/component/{gltf → passive}/type.js +0 -0
- /package/dist/gaesup/component/{gltf/AirplaneGltf.d.ts → ref/airplane/innerGltf.d.ts} +0 -0
- /package/dist/gaesup/component/{gltf/VehicleGltf.d.ts → ref/vehicle/innerGltf.d.ts} +0 -0
- /package/dist/gaesup/component/{gltf/type.d.ts → type.d.ts} +0 -0
- /package/dist/gaesup/{initial/callback → component}/type.js +0 -0
package/README.md
CHANGED
|
@@ -182,3 +182,19 @@ This is the airplane control in Gaesup World. Characters can board the airplane.
|
|
|
182
182
|
## Tools
|
|
183
183
|
|
|
184
184
|
#### [Tools](#tools)
|
|
185
|
+
|
|
186
|
+
#### [joystick](#joystick)
|
|
187
|
+
|
|
188
|
+
#### [keyboardtooltip](#keyboard tooltip)
|
|
189
|
+
|
|
190
|
+
#### [minimap](#minimap)
|
|
191
|
+
|
|
192
|
+
#### [gameboy](#gameboy)
|
|
193
|
+
|
|
194
|
+
## joystick
|
|
195
|
+
|
|
196
|
+
## keyboard tooltip
|
|
197
|
+
|
|
198
|
+
## minimap
|
|
199
|
+
|
|
200
|
+
## gameboy
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { groundRayType } from "../controller/type";
|
|
3
3
|
export type playActionsType = {
|
|
4
|
-
outerGroupRef: RefObject<THREE.Group>;
|
|
5
4
|
groundRay: groundRayType;
|
|
6
5
|
isRider?: boolean;
|
|
7
6
|
};
|
|
8
|
-
export default function playActions({
|
|
7
|
+
export default function playActions({ groundRay, isRider }: playActionsType): {
|
|
8
|
+
animationRef: import("react").MutableRefObject<import("three").Object3D<import("three").Object3DEventMap>>;
|
|
9
|
+
};
|
|
@@ -14,12 +14,12 @@ import { useFrame } from "@react-three/fiber";
|
|
|
14
14
|
import { useContext, useEffect } from "react";
|
|
15
15
|
import { GaesupWorldContext, GaesupWorldDispatchContext, } from "../world/context";
|
|
16
16
|
export default function playActions(_a) {
|
|
17
|
-
var
|
|
17
|
+
var groundRay = _a.groundRay, isRider = _a.isRider;
|
|
18
18
|
var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, characterAnimations = _b.animations;
|
|
19
19
|
var dispatch = useContext(GaesupWorldDispatchContext);
|
|
20
20
|
var animations = characterGltf.animations;
|
|
21
21
|
var control = useKeyboardControls()[1]();
|
|
22
|
-
var
|
|
22
|
+
var _c = useAnimations(animations), actions = _c.actions, animationRef = _c.ref;
|
|
23
23
|
useEffect(function () {
|
|
24
24
|
characterAnimations.keyControl = control;
|
|
25
25
|
dispatch({
|
|
@@ -57,6 +57,7 @@ export default function playActions(_a) {
|
|
|
57
57
|
var playJump = function () { return play("jump"); };
|
|
58
58
|
var playFall = function () { return play("fall"); };
|
|
59
59
|
var playRide = function () { return play("ride"); };
|
|
60
|
+
var playLanding = function () { return play("land"); };
|
|
60
61
|
useEffect(function () {
|
|
61
62
|
return function () {
|
|
62
63
|
resetAni();
|
|
@@ -64,15 +65,14 @@ export default function playActions(_a) {
|
|
|
64
65
|
}, []);
|
|
65
66
|
useEffect(function () {
|
|
66
67
|
var _a;
|
|
67
|
-
// Play animation
|
|
68
68
|
var action = (_a = actions[characterAnimations.current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
|
|
69
69
|
setAnimationName(actions);
|
|
70
70
|
return function () {
|
|
71
71
|
action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
|
|
72
72
|
};
|
|
73
73
|
}, [characterAnimations.current]);
|
|
74
|
-
var
|
|
75
|
-
var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter;
|
|
74
|
+
var _d = useContext(GaesupWorldContext), states = _d.states, activeState = _d.activeState;
|
|
75
|
+
var isNotMoving = states.isNotMoving, isMoving = states.isMoving, isJumping = states.isJumping, isRunning = states.isRunning, isAnimationOuter = states.isAnimationOuter, isOnTheGround = states.isOnTheGround;
|
|
76
76
|
useFrame(function () {
|
|
77
77
|
if (isRider) {
|
|
78
78
|
playRide();
|
|
@@ -91,10 +91,23 @@ export default function playActions(_a) {
|
|
|
91
91
|
else if (isMoving) {
|
|
92
92
|
playWalk();
|
|
93
93
|
}
|
|
94
|
+
if (groundRay.hit) {
|
|
95
|
+
if (!isJumping && !isOnTheGround) {
|
|
96
|
+
if (groundRay.hit.toi < 5) {
|
|
97
|
+
playLanding();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
playFall();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
94
104
|
if (groundRay.hit === null && activeState.velocity.y < 0) {
|
|
95
105
|
playFall();
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
108
|
}
|
|
99
109
|
});
|
|
110
|
+
return {
|
|
111
|
+
animationRef: animationRef,
|
|
112
|
+
};
|
|
100
113
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { AnimationClip } from "three";
|
|
3
|
+
export type playPassiveActionsType = {
|
|
4
|
+
current: string;
|
|
5
|
+
animations: AnimationClip[];
|
|
6
|
+
};
|
|
7
|
+
export default function playPassiveActions({ current, animations, }: playPassiveActionsType): {
|
|
8
|
+
animationRef: import("react").MutableRefObject<import("three").Object3D<import("three").Object3DEventMap>>;
|
|
9
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useAnimations } from "@react-three/drei";
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
export default function playPassiveActions(_a) {
|
|
4
|
+
var current = _a.current, animations = _a.animations;
|
|
5
|
+
var _b = useAnimations(animations), actions = _b.actions, animationRef = _b.ref;
|
|
6
|
+
useEffect(function () {
|
|
7
|
+
var _a;
|
|
8
|
+
var action = (_a = actions[current]) === null || _a === void 0 ? void 0 : _a.reset().fadeIn(0.2).play();
|
|
9
|
+
return function () {
|
|
10
|
+
action === null || action === void 0 ? void 0 : action.fadeOut(0.2);
|
|
11
|
+
};
|
|
12
|
+
}, [current]);
|
|
13
|
+
return {
|
|
14
|
+
animationRef: animationRef,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { controllerInnerType, refsType } from "../controller/type";
|
|
2
|
+
export declare function GaesupComponent({ props, refs, }: {
|
|
3
|
+
props: controllerInnerType;
|
|
4
|
+
refs: refsType;
|
|
5
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext } from "react";
|
|
3
|
+
import { GaesupWorldContext } from "../world/context";
|
|
4
|
+
import { Airplane } from "./mode/Airplane";
|
|
5
|
+
import { Character } from "./mode/Character";
|
|
6
|
+
import { Vehicle } from "./mode/Vehicle";
|
|
7
|
+
export function GaesupComponent(_a) {
|
|
8
|
+
var props = _a.props, refs = _a.refs;
|
|
9
|
+
var mode = useContext(GaesupWorldContext).mode;
|
|
10
|
+
return (_jsxs(_Fragment, { children: [mode.type === "character" && _jsx(Character, { props: props, refs: refs }), mode.type === "vehicle" && _jsx(Vehicle, { props: props, refs: refs }), mode.type === "airplane" && _jsx(Airplane, { props: props, refs: refs })] }));
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import calculation from "../../physics";
|
|
3
|
+
import { AirplaneRef } from "../ref/airplane";
|
|
4
|
+
export function Airplane(_a) {
|
|
5
|
+
var props = _a.props, refs = _a.refs;
|
|
6
|
+
calculation(props);
|
|
7
|
+
return _jsx(AirplaneRef, { props: props, refs: refs });
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import calculation from "../../physics";
|
|
3
|
+
import { CharacterRef } from "../ref/character";
|
|
4
|
+
export function Character(_a) {
|
|
5
|
+
var props = _a.props, refs = _a.refs;
|
|
6
|
+
calculation(props);
|
|
7
|
+
return _jsx(CharacterRef, { props: props, refs: refs, isPassive: false });
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import calculation from "../../physics";
|
|
3
|
+
import { VehicleRef } from "../ref/vehicle";
|
|
4
|
+
export function Vehicle(_a) {
|
|
5
|
+
var props = _a.props, refs = _a.refs;
|
|
6
|
+
calculation(props);
|
|
7
|
+
return _jsx(VehicleRef, { props: props, refs: refs });
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import calculation from "../../physics";
|
|
3
|
+
import { AirplaneRef } from "../ref/airplane";
|
|
4
|
+
export function Airplane(_a) {
|
|
5
|
+
var props = _a.props, refs = _a.refs;
|
|
6
|
+
calculation(props);
|
|
7
|
+
return _jsx(AirplaneRef, { props: props, refs: refs });
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import calculation from "../../physics";
|
|
3
|
+
import { VehicleRef } from "../ref/vehicle";
|
|
4
|
+
export function Vehicle(_a) {
|
|
5
|
+
var props = _a.props, refs = _a.refs;
|
|
6
|
+
calculation(props);
|
|
7
|
+
return _jsx(VehicleRef, { props: props, refs: refs });
|
|
8
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import mutation from "../../../mutation";
|
|
4
|
+
import { PassiveCharacterInnerGroupRef } from "./innerGltf";
|
|
5
|
+
import { PassiveCharacterOuterGroup } from "./outerGroup";
|
|
6
|
+
import { PassiveCharacterRigidBody } from "./rigidbody";
|
|
7
|
+
export function PassiveCharacter(_a) {
|
|
8
|
+
var mode = _a.mode, state = _a.state, url = _a.url, current = _a.current;
|
|
9
|
+
var passiveCharacterRef = useRef(null);
|
|
10
|
+
var passiveCharacterOuterRef = useRef(null);
|
|
11
|
+
var passiveRigidBodyRef = useRef(null);
|
|
12
|
+
mutation({
|
|
13
|
+
outerGroupRef: passiveCharacterOuterRef,
|
|
14
|
+
rigidBodyRef: passiveRigidBodyRef,
|
|
15
|
+
state: state,
|
|
16
|
+
mode: mode,
|
|
17
|
+
delta: 0.9,
|
|
18
|
+
});
|
|
19
|
+
return (_jsx(PassiveCharacterRigidBody, { ref: passiveRigidBodyRef, children: _jsx(PassiveCharacterOuterGroup, { ref: passiveCharacterOuterRef, children: _jsx(PassiveCharacterInnerGroupRef, { url: url, current: current, ref: passiveCharacterRef }) }) }));
|
|
20
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { passiveCharacterInnerType } from "../type";
|
|
3
|
+
export declare const PassiveCharacterInnerGroupRef: import("react").ForwardRefExoticComponent<passiveCharacterInnerType & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useMemo } from "react";
|
|
3
|
+
import { useGraph, useLoader } from "@react-three/fiber";
|
|
4
|
+
import { SkeletonUtils } from "three-stdlib";
|
|
5
|
+
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader";
|
|
6
|
+
import playPassiveActions from "../../../animation/passiveActions";
|
|
7
|
+
export var PassiveCharacterInnerGroupRef = forwardRef(function (_a, ref) {
|
|
8
|
+
var url = _a.url, current = _a.current;
|
|
9
|
+
var _b = useLoader(GLTFLoader, url), materials = _b.materials, scene = _b.scene, animations = _b.animations;
|
|
10
|
+
var clone = useMemo(function () { return SkeletonUtils.clone(scene); }, [scene]);
|
|
11
|
+
var nodes = useGraph(clone).nodes;
|
|
12
|
+
var animationRef = playPassiveActions({
|
|
13
|
+
current: current,
|
|
14
|
+
animations: animations,
|
|
15
|
+
}).animationRef;
|
|
16
|
+
return (_jsx(_Fragment, { children: nodes && materials && (_jsxs("group", { receiveShadow: true, castShadow: true, ref: ref, children: [Object.values(nodes).find(function (node) { return node.type === "Object3D"; }) && (_jsx("primitive", { object: Object.values(nodes).find(function (node) { return node.type === "Object3D"; }), visible: false, receiveShadow: true, castShadow: true, ref: animationRef })), Object.keys(nodes).map(function (name, key) {
|
|
17
|
+
if (nodes[name].type === "SkinnedMesh") {
|
|
18
|
+
return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: materials[name], geometry: nodes[name].geometry, skeleton: nodes[name].skeleton }, key));
|
|
19
|
+
}
|
|
20
|
+
else if (nodes[name].type === "Mesh") {
|
|
21
|
+
return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: materials[name], geometry: nodes[name].geometry }, key));
|
|
22
|
+
}
|
|
23
|
+
})] })) }));
|
|
24
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useContext } from "react";
|
|
3
|
+
import { GaesupWorldContext } from "../../../world/context";
|
|
4
|
+
export var PassiveCharacterOuterGroup = forwardRef(function (_a, ref) {
|
|
5
|
+
var children = _a.children;
|
|
6
|
+
var mode = useContext(GaesupWorldContext).mode;
|
|
7
|
+
return (_jsx("group", { ref: ref, userData: { intangible: true }, visible: mode.type === "character", children: children }));
|
|
8
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { RigidBody } from "@react-three/rapier";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
export var PassiveCharacterRigidBody = forwardRef(function (_a, ref) {
|
|
5
|
+
var children = _a.children;
|
|
6
|
+
return (_jsx(RigidBody, { colliders: false, canSleep: false, ref: ref, children: children }));
|
|
7
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { activeStateType, modeType } from "../../world/context/type";
|
|
2
|
+
export type passiveCharacterType = {
|
|
3
|
+
mode: modeType;
|
|
4
|
+
state: activeStateType;
|
|
5
|
+
current: string;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
export type passiveCharacterInnerType = {
|
|
9
|
+
current: string;
|
|
10
|
+
url: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Collider } from "@dimforge/rapier3d-compat";
|
|
3
|
+
import { controllerInnerType } from "../../../controller/type";
|
|
4
|
+
export declare const AirplaneCollider: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
prop: controllerInnerType;
|
|
6
|
+
} & import("react").RefAttributes<Collider>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CuboidCollider, useRapier } from "@react-three/rapier";
|
|
3
|
+
import { forwardRef, useContext } from "react";
|
|
4
|
+
import { getRayHit, useForwardRef } from "../../../utils";
|
|
5
|
+
import { GaesupWorldContext } from "../../../world/context";
|
|
6
|
+
export var AirplaneCollider = forwardRef(function (_a, ref) {
|
|
7
|
+
var _b;
|
|
8
|
+
var prop = _a.prop;
|
|
9
|
+
var collider = useContext(GaesupWorldContext).airplaneCollider;
|
|
10
|
+
var airplaneSizeX = collider.airplaneSizeX, airplaneSizeY = collider.airplaneSizeY, airplaneSizeZ = collider.airplaneSizeZ;
|
|
11
|
+
var colliderRef = useForwardRef(ref);
|
|
12
|
+
var rapier = useRapier().rapier;
|
|
13
|
+
var groundRay = prop.groundRay;
|
|
14
|
+
groundRay.length = airplaneSizeY * 5 + 2;
|
|
15
|
+
groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
|
|
16
|
+
groundRay.hit = getRayHit({
|
|
17
|
+
ray: groundRay,
|
|
18
|
+
ref: colliderRef,
|
|
19
|
+
});
|
|
20
|
+
groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
|
|
21
|
+
return (_jsx(CuboidCollider, { ref: ref, args: [airplaneSizeX / 2, airplaneSizeY / 2, airplaneSizeZ / 2], position: [0, airplaneSizeY / 2, 0] }));
|
|
22
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { controllerType } from "../../../controller/type";
|
|
3
|
+
export declare const AirplaneGroup: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
props: controllerType;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
} & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
|
|
@@ -0,0 +1,19 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef, useContext } from "react";
|
|
14
|
+
import { GaesupWorldContext } from "../../../world/context";
|
|
15
|
+
export var AirplaneGroup = forwardRef(function (_a, ref) {
|
|
16
|
+
var props = _a.props, children = _a.children;
|
|
17
|
+
var mode = useContext(GaesupWorldContext).mode;
|
|
18
|
+
return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.airplane, { visible: mode.type === "airplane", children: children })));
|
|
19
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { CharacterInnerGroupRef } from "../character/innerGltf";
|
|
3
|
+
import { AirplaneCollider } from "./collider";
|
|
4
|
+
import { AirplaneGroup } from "./group";
|
|
5
|
+
import { AirplaneInnerGroupRef } from "./innerGltf";
|
|
6
|
+
import { AirplaneRigidBody } from "./rigidbody";
|
|
7
|
+
export function AirplaneRef(_a) {
|
|
8
|
+
var props = _a.props, refs = _a.refs;
|
|
9
|
+
return (_jsx(AirplaneGroup, { ref: refs.outerGroupRef, props: props, children: _jsxs(AirplaneRigidBody, { ref: refs.rigidBodyRef, props: props, children: [_jsx(AirplaneCollider, { prop: props, ref: refs.capsuleColliderRef }), props.isRider && (_jsx(CharacterInnerGroupRef, { props: props, groundRay: props.groundRay, refs: refs, ref: refs.characterInnerRef })), _jsx(AirplaneInnerGroupRef, { ref: refs.innerGroupRef })] }) }));
|
|
10
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useContext } from "react";
|
|
3
|
-
import { GaesupWorldContext } from "
|
|
3
|
+
import { GaesupWorldContext } from "../../../world/context";
|
|
4
4
|
export var AirplaneInnerGroupRef = forwardRef(function (_, ref) {
|
|
5
5
|
var gltf = useContext(GaesupWorldContext).airplaneGltf;
|
|
6
6
|
var materials = gltf.materials, nodes = gltf.nodes;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RapierRigidBody } from "@react-three/rapier";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { controllerInnerType } from "../../../controller/type";
|
|
4
|
+
export declare const AirplaneRigidBody: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
props: controllerInnerType;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
} & import("react").RefAttributes<RapierRigidBody>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
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 { RigidBody } from "@react-three/rapier";
|
|
14
|
+
import { forwardRef } from "react";
|
|
15
|
+
export var AirplaneRigidBody = forwardRef(function (_a, ref) {
|
|
16
|
+
var props = _a.props, children = _a.children;
|
|
17
|
+
return (_jsxs(RigidBody, __assign({ colliders: false, ref: ref }, props.rigidBodyProps, { children: [props.debug && (_jsx("mesh", { visible: props.debug, children: _jsx("arrowHelper", { args: [
|
|
18
|
+
props.groundRay.dir,
|
|
19
|
+
props.groundRay.origin,
|
|
20
|
+
props.groundRay.length,
|
|
21
|
+
] }) })), children] })));
|
|
22
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Collider } from "@dimforge/rapier3d-compat";
|
|
3
|
+
import { controllerInnerType } from "../../../controller/type";
|
|
4
|
+
export declare const CharacterCapsuleCollider: import("react").ForwardRefExoticComponent<{
|
|
5
|
+
props: controllerInnerType;
|
|
6
|
+
} & import("react").RefAttributes<Collider>>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CapsuleCollider, useRapier } from "@react-three/rapier";
|
|
3
|
+
import { forwardRef, useContext } from "react";
|
|
4
|
+
import { getRayHit, useForwardRef } from "../../../utils";
|
|
5
|
+
import { GaesupWorldContext } from "../../../world/context";
|
|
6
|
+
export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
|
|
7
|
+
var _b;
|
|
8
|
+
var props = _a.props;
|
|
9
|
+
var collider = useContext(GaesupWorldContext).characterCollider;
|
|
10
|
+
var colliderRef = useForwardRef(ref);
|
|
11
|
+
var rapier = useRapier().rapier;
|
|
12
|
+
var groundRay = props.groundRay, slopeRay = props.slopeRay;
|
|
13
|
+
groundRay.length = collider.radius + 2;
|
|
14
|
+
groundRay.rayCast = new rapier.Ray(groundRay.origin, groundRay.dir);
|
|
15
|
+
groundRay.hit = getRayHit({
|
|
16
|
+
ray: groundRay,
|
|
17
|
+
ref: colliderRef,
|
|
18
|
+
});
|
|
19
|
+
groundRay.parent = (_b = groundRay.hit) === null || _b === void 0 ? void 0 : _b.collider.parent();
|
|
20
|
+
slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
|
|
21
|
+
slopeRay.length = collider.radius + 3;
|
|
22
|
+
slopeRay.rayCast = new rapier.Ray(slopeRay.origin, slopeRay.dir);
|
|
23
|
+
return (_jsx(CapsuleCollider, { ref: ref, args: [collider.height, collider.radius] }));
|
|
24
|
+
});
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { controllerType } from "../../../controller/type";
|
|
3
|
+
export declare const CharacterGroup: import("react").ForwardRefExoticComponent<{
|
|
4
|
+
props: controllerType;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
} & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
13
|
+
import { forwardRef } from "react";
|
|
14
|
+
export var CharacterGroup = forwardRef(function (_a, ref) {
|
|
15
|
+
var props = _a.props, children = _a.children;
|
|
16
|
+
return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.character, { children: children })));
|
|
17
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import initCallback from "../../../controller/initialize/callback";
|
|
3
|
+
import { CharacterCapsuleCollider } from "./collider";
|
|
4
|
+
import { CharacterGroup } from "./group";
|
|
5
|
+
import { CharacterInnerGroupRef, InnerGroupRef } from "./innerGltf";
|
|
6
|
+
import { CharacterOuterGroup } from "./outerGroup";
|
|
7
|
+
import { CharacterRigidBody } from "./rigidbody";
|
|
8
|
+
import { CharacterSlopeRay } from "./slopeRay";
|
|
9
|
+
export function CharacterRef(_a) {
|
|
10
|
+
var props = _a.props, refs = _a.refs, isPassive = _a.isPassive;
|
|
11
|
+
initCallback(props);
|
|
12
|
+
return (_jsx(CharacterOuterGroup, { children: _jsxs(CharacterRigidBody, { ref: refs.rigidBodyRef, props: props, children: [_jsx(CharacterCapsuleCollider, { props: props, ref: refs.capsuleColliderRef }), _jsxs(CharacterGroup, { ref: refs.outerGroupRef, props: props, children: [_jsx(CharacterSlopeRay, { slopeRay: props.slopeRay, groundRay: props.groundRay, ref: refs.slopeRayOriginRef }), props.children, _jsx(InnerGroupRef, { ref: refs.innerGroupRef }), _jsx(CharacterInnerGroupRef, { props: props, groundRay: props.groundRay, refs: refs, ref: refs.characterInnerRef })] })] }) }));
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { controllerInnerType, groundRayType, refsType } from "
|
|
3
|
-
import { callbackType } from "
|
|
2
|
+
import { controllerInnerType, groundRayType, refsType } from "../../../controller/type";
|
|
3
|
+
import { callbackType } from "../../../controller/initialize/callback/type";
|
|
4
4
|
export type characterGltfType = {
|
|
5
5
|
props: controllerInnerType;
|
|
6
6
|
groundRay: groundRayType;
|