gaesup-world 0.1.3 → 0.2.0
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 +220 -228
- package/dist/gaesup/animation/actions.d.ts +29 -13
- package/dist/gaesup/animation/actions.js +33 -60
- package/dist/gaesup/camera/index.js +1 -2
- package/dist/gaesup/component/active/airplane/index.d.ts +9 -3
- package/dist/gaesup/component/active/airplane/index.js +3 -7
- package/dist/gaesup/component/active/character/index.d.ts +3 -1
- package/dist/gaesup/component/active/character/index.js +29 -11
- package/dist/gaesup/component/active/vehicle/index.d.ts +10 -3
- package/dist/gaesup/component/active/vehicle/index.js +29 -9
- package/dist/gaesup/component/index.d.ts +3 -1
- package/dist/gaesup/component/index.js +9 -3
- 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/{passive → inner}/common/InnerGroupRef.d.ts +2 -0
- package/dist/gaesup/component/{passive → inner}/common/InnerGroupRef.js +12 -10
- package/dist/gaesup/component/{passive → inner}/common/RigidbodyRef.d.ts +4 -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/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 +12 -1
- package/dist/gaesup/component/passive/airplane/index.js +6 -9
- package/dist/gaesup/component/passive/character/index.d.ts +9 -1
- package/dist/gaesup/component/passive/character/index.js +16 -9
- package/dist/gaesup/component/passive/type.d.ts +1 -11
- package/dist/gaesup/component/passive/vehicle/index.d.ts +12 -1
- package/dist/gaesup/component/passive/vehicle/index.js +6 -25
- package/dist/gaesup/controller/context/index.d.ts +7 -3
- package/dist/gaesup/controller/context/index.js +7 -3
- package/dist/gaesup/controller/context/reducer.d.ts +1 -1
- package/dist/gaesup/controller/index.js +5 -8
- package/dist/gaesup/controller/initialize/callback/index.d.ts +1 -1
- package/dist/gaesup/controller/initialize/callback/index.js +61 -54
- package/dist/gaesup/controller/initialize/index.d.ts +1 -2
- package/dist/gaesup/controller/initialize/index.js +1 -14
- package/dist/gaesup/controller/type.d.ts +3 -6
- package/dist/gaesup/gaesupProps/index.js +1 -1
- package/dist/gaesup/hooks/useGaesupAnimation/index.d.ts +3 -1
- package/dist/gaesup/hooks/useGaesupAnimation/index.js +17 -16
- package/dist/gaesup/hooks/useGaesupController/index.d.ts +2 -5
- package/dist/gaesup/hooks/useGaesupController/index.js +4 -5
- package/dist/gaesup/hooks/useGaesupGltf/index.d.ts +25 -0
- package/dist/gaesup/hooks/useGaesupGltf/index.js +73 -0
- package/dist/gaesup/hooks/useRideable/index.js +36 -35
- package/dist/gaesup/physics/airplane/direction.d.ts +1 -1
- package/dist/gaesup/physics/airplane/direction.js +3 -1
- package/dist/gaesup/physics/airplane/gravity.js +1 -1
- package/dist/gaesup/physics/airplane/landing.js +1 -1
- package/dist/gaesup/physics/check/ground.js +3 -3
- package/dist/gaesup/physics/check/index.js +0 -2
- package/dist/gaesup/physics/check/riding.js +3 -3
- package/dist/gaesup/physics/index.js +8 -6
- package/dist/gaesup/physics/type.d.ts +4 -1
- package/dist/gaesup/physics/vehicle/impulse.d.ts +15 -1
- package/dist/gaesup/physics/vehicle/impulse.js +32 -12
- package/dist/gaesup/physics/vehicle/innerCalc.js +1 -1
- package/dist/gaesup/physics/vehicle/landing.js +1 -1
- package/dist/gaesup/tools/joyStick/index.d.ts +1 -1
- package/dist/gaesup/tools/keyBoardToolTip/index.js +3 -3
- package/dist/gaesup/tools/rideable/index.js +5 -6
- package/dist/gaesup/tools/zoomButton/index.js +5 -3
- package/dist/gaesup/world/context/index.js +27 -62
- package/dist/gaesup/world/context/reducer.d.ts +7 -12
- package/dist/gaesup/world/context/type.d.ts +36 -49
- package/dist/gaesup/world/debug/index.d.ts +6 -2
- package/dist/gaesup/world/initalize/index.d.ts +7 -12
- package/dist/gaesup/world/initalize/index.js +8 -15
- package/dist/gaesup/world/type.d.ts +3 -8
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -1
- package/package.json +1 -1
- package/dist/gaesup/animation/index.d.ts +0 -1
- package/dist/gaesup/animation/index.js +0 -1
- package/dist/gaesup/animation/passiveActions.d.ts +0 -9
- package/dist/gaesup/animation/passiveActions.js +0 -16
- package/dist/gaesup/component/active/airplane/collider.d.ts +0 -6
- package/dist/gaesup/component/active/airplane/collider.js +0 -22
- package/dist/gaesup/component/active/character/collider.d.ts +0 -6
- package/dist/gaesup/component/active/character/collider.js +0 -24
- package/dist/gaesup/component/active/common/InnerGroupRef.d.ts +0 -10
- package/dist/gaesup/component/active/common/InnerGroupRef.js +0 -35
- package/dist/gaesup/component/active/common/OuterGroupRef.d.ts +0 -6
- package/dist/gaesup/component/active/common/OuterGroupRef.js +0 -17
- package/dist/gaesup/component/active/common/RiderGroupRef.d.ts +0 -7
- package/dist/gaesup/component/active/common/RiderGroupRef.js +0 -32
- package/dist/gaesup/component/active/common/RigidbodyRef.d.ts +0 -11
- package/dist/gaesup/component/active/common/RigidbodyRef.js +0 -22
- package/dist/gaesup/component/active/common/WrapperRef.d.ts +0 -13
- package/dist/gaesup/component/active/common/WrapperRef.js +0 -9
- package/dist/gaesup/component/active/common/slopeRayRef.d.ts +0 -6
- package/dist/gaesup/component/active/common/slopeRayRef.js +0 -10
- package/dist/gaesup/component/active/vehicle/collider.d.ts +0 -3
- package/dist/gaesup/component/active/vehicle/collider.js +0 -9
- package/dist/gaesup/component/active/vehicle/wheel.d.ts +0 -12
- package/dist/gaesup/component/active/vehicle/wheel.js +0 -13
- package/dist/gaesup/component/active/vehicle/wheels.d.ts +0 -7
- package/dist/gaesup/component/active/vehicle/wheels.js +0 -20
- package/dist/gaesup/component/passive/airplane/collider.d.ts +0 -5
- package/dist/gaesup/component/passive/airplane/collider.js +0 -7
- package/dist/gaesup/component/passive/airplane/type.d.ts +0 -12
- package/dist/gaesup/component/passive/character/collider.d.ts +0 -6
- package/dist/gaesup/component/passive/character/collider.js +0 -7
- package/dist/gaesup/component/passive/character/type.d.ts +0 -27
- package/dist/gaesup/component/passive/character/type.js +0 -1
- package/dist/gaesup/component/passive/common/RigidbodyRef.js +0 -10
- package/dist/gaesup/component/passive/vehicle/type.d.ts +0 -21
- package/dist/gaesup/component/passive/vehicle/type.js +0 -1
- package/dist/gaesup/component/passive/vehicle/wheel.d.ts +0 -15
- package/dist/gaesup/component/passive/vehicle/wheel.js +0 -16
- package/dist/gaesup/component/passive/vehicle/wheels.d.ts +0 -11
- package/dist/gaesup/component/passive/vehicle/wheels.js +0 -25
- package/dist/gaesup/physics/check/slope.d.ts +0 -2
- package/dist/gaesup/physics/check/slope.js +0 -30
- package/dist/gaesup/utils/gltf.d.ts +0 -7
- package/dist/gaesup/utils/gltf.js +0 -10
- package/dist/gaesup/world/initalize/collider/airplane.d.ts +0 -2
- package/dist/gaesup/world/initalize/collider/airplane.js +0 -25
- package/dist/gaesup/world/initalize/collider/character.d.ts +0 -2
- package/dist/gaesup/world/initalize/collider/character.js +0 -27
- package/dist/gaesup/world/initalize/collider/gltf.d.ts +0 -14
- package/dist/gaesup/world/initalize/collider/gltf.js +0 -54
- package/dist/gaesup/world/initalize/collider/index.d.ts +0 -2
- package/dist/gaesup/world/initalize/collider/index.js +0 -17
- package/dist/gaesup/world/initalize/collider/vehicle.d.ts +0 -2
- package/dist/gaesup/world/initalize/collider/vehicle.js +0 -55
- package/dist/gaesup/world/initalize/type.d.ts +0 -13
- package/dist/gaesup/world/initalize/type.js +0 -1
- /package/dist/gaesup/component/{passive → inner}/common/OuterGroupRef.d.ts +0 -0
- /package/dist/gaesup/component/{passive → inner}/common/OuterGroupRef.js +0 -0
- /package/dist/gaesup/component/{passive/airplane → inner/common}/type.js +0 -0
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Ref } from "react";
|
|
2
|
-
import { controllerInnerType } from "../../../controller/type";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
import { GLTFResult } from "../../type";
|
|
5
|
-
export type InnerGroupRefType = {
|
|
6
|
-
props: controllerInnerType;
|
|
7
|
-
animationRef?: Ref<THREE.Object3D<THREE.Object3DEventMap>>;
|
|
8
|
-
gltf: GLTFResult;
|
|
9
|
-
};
|
|
10
|
-
export declare const InnerGroupRef: import("react").ForwardRefExoticComponent<InnerGroupRefType & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
|
|
@@ -1,35 +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 { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { Suspense, forwardRef, useContext, useMemo } from "react";
|
|
14
|
-
import { useGraph } from "@react-three/fiber";
|
|
15
|
-
import * as THREE from "three";
|
|
16
|
-
import { SkeletonUtils } from "three-stdlib";
|
|
17
|
-
import { GaesupWorldContext } from "../../../world/context";
|
|
18
|
-
import { RiderGroup } from "./RiderGroupRef";
|
|
19
|
-
export var InnerGroupRef = forwardRef(function (_a, ref) {
|
|
20
|
-
var props = _a.props, animationRef = _a.animationRef, gltf = _a.gltf;
|
|
21
|
-
var _b = useContext(GaesupWorldContext), mode = _b.mode, states = _b.states;
|
|
22
|
-
var scene = gltf.scene;
|
|
23
|
-
var clone = useMemo(function () { return SkeletonUtils.clone(scene); }, [scene]);
|
|
24
|
-
var nodes = useGraph(clone).nodes;
|
|
25
|
-
var objectNode = Object.values(nodes).find(function (node) { return node.type === "Object3D"; });
|
|
26
|
-
return (_jsx(Suspense, { fallback: null, children: _jsxs("group", __assign({ receiveShadow: true, castShadow: true }, props.groupProps, { ref: ref, children: [mode.type !== "character" && states.isRiderOn && (_jsx(RiderGroup, { props: props })), objectNode && animationRef && (_jsx("primitive", { object: objectNode, visible: false, receiveShadow: true, castShadow: true, ref: animationRef })), Object.keys(nodes).map(function (name, key) {
|
|
27
|
-
var node = nodes[name];
|
|
28
|
-
if (node instanceof THREE.SkinnedMesh) {
|
|
29
|
-
return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry, skeleton: node.skeleton }, key));
|
|
30
|
-
}
|
|
31
|
-
else if (node instanceof THREE.Mesh) {
|
|
32
|
-
return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: node.material, geometry: node.geometry }, key));
|
|
33
|
-
}
|
|
34
|
-
})] })) }));
|
|
35
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from "react";
|
|
2
|
-
import { controllerType } from "../../../controller/type";
|
|
3
|
-
export declare const OuterGroupRef: import("react").ForwardRefExoticComponent<{
|
|
4
|
-
props: controllerType;
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
} & import("react").RefAttributes<import("three").Group<import("three").Object3DEventMap>>>;
|
|
@@ -1,17 +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 { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { forwardRef } from "react";
|
|
14
|
-
export var OuterGroupRef = forwardRef(function (_a, ref) {
|
|
15
|
-
var props = _a.props, children = _a.children;
|
|
16
|
-
return (_jsx("group", __assign({ ref: ref, userData: { intangible: true } }, props.vehicle, { children: children })));
|
|
17
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { Ref } from "react";
|
|
2
|
-
import { controllerInnerType } from "../../../controller/type";
|
|
3
|
-
import * as THREE from "three";
|
|
4
|
-
export type RiderGroupRefType = {
|
|
5
|
-
props: controllerInnerType;
|
|
6
|
-
};
|
|
7
|
-
export declare const RiderGroup: ({ props }: RiderGroupRefType, ref: Ref<THREE.Group>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { useContext, useMemo } from "react";
|
|
3
|
-
import { useGraph } from "@react-three/fiber";
|
|
4
|
-
import * as THREE from "three";
|
|
5
|
-
import { SkeletonUtils } from "three-stdlib";
|
|
6
|
-
import playPassiveActions from "../../../animation/passiveActions";
|
|
7
|
-
import { GaesupWorldContext } from "../../../world/context";
|
|
8
|
-
export var RiderGroup = function (_a, ref) {
|
|
9
|
-
var props = _a.props;
|
|
10
|
-
var _b = useContext(GaesupWorldContext), characterGltf = _b.characterGltf, states = _b.states, characterCollider = _b.characterCollider;
|
|
11
|
-
var characterAnimationRef = playPassiveActions({
|
|
12
|
-
current: "ride",
|
|
13
|
-
animations: characterGltf.animations,
|
|
14
|
-
}).animationRef;
|
|
15
|
-
var characterScene = characterGltf.scene;
|
|
16
|
-
var characterClone = useMemo(function () { return SkeletonUtils.clone(characterScene); }, [characterScene]);
|
|
17
|
-
var characterNodes = useGraph(characterClone).nodes;
|
|
18
|
-
var characterObjectNode = Object.values(characterNodes).find(function (node) { return node.type === "Object3D"; });
|
|
19
|
-
return (_jsx(_Fragment, { children: characterAnimationRef && (_jsxs("group", { position: [
|
|
20
|
-
(characterCollider === null || characterCollider === void 0 ? void 0 : characterCollider.riderOffsetX) || 0,
|
|
21
|
-
(characterCollider === null || characterCollider === void 0 ? void 0 : characterCollider.riderOffsetY) || 0,
|
|
22
|
-
(characterCollider === null || characterCollider === void 0 ? void 0 : characterCollider.riderOffsetZ) || 0,
|
|
23
|
-
], children: [characterObjectNode && (_jsx("primitive", { object: characterObjectNode, visible: false, receiveShadow: true, castShadow: true, ref: characterAnimationRef })), Object.keys(characterNodes).map(function (name, key) {
|
|
24
|
-
var characterNode = characterNodes[name];
|
|
25
|
-
if (characterNode instanceof THREE.SkinnedMesh) {
|
|
26
|
-
return (_jsx("skinnedMesh", { castShadow: true, receiveShadow: true, material: characterNode.material, geometry: characterNode.geometry, skeleton: characterNode.skeleton }, key));
|
|
27
|
-
}
|
|
28
|
-
else if (characterNode instanceof THREE.Mesh) {
|
|
29
|
-
return (_jsx("mesh", { castShadow: true, receiveShadow: true, material: characterNode.material, geometry: characterNode.geometry }, key));
|
|
30
|
-
}
|
|
31
|
-
})] })) }));
|
|
32
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { RapierRigidBody } from "@react-three/rapier";
|
|
2
|
-
import { ReactNode } from "react";
|
|
3
|
-
import { controllerInnerType } from "../../../controller/type";
|
|
4
|
-
export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
name?: string;
|
|
7
|
-
} & import("react").RefAttributes<RapierRigidBody>>;
|
|
8
|
-
export declare const PassiveRigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
9
|
-
props: controllerInnerType;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
} & import("react").RefAttributes<RapierRigidBody>>;
|
|
@@ -1,22 +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 { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { RigidBody } from "@react-three/rapier";
|
|
14
|
-
import { forwardRef } from "react";
|
|
15
|
-
export var RigidBodyRef = forwardRef(function (_a, ref) {
|
|
16
|
-
var children = _a.children, name = _a.name;
|
|
17
|
-
return (_jsx(RigidBody, { colliders: false, ref: ref, name: name, children: children }));
|
|
18
|
-
});
|
|
19
|
-
export var PassiveRigidBodyRef = forwardRef(function (_a, ref) {
|
|
20
|
-
var props = _a.props, children = _a.children;
|
|
21
|
-
return (_jsx(RigidBody, __assign({ colliders: false, ref: ref }, props.rigidBodyProps, { children: children })));
|
|
22
|
-
});
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ReactNode, Ref } from "react";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
import { controllerInnerType, refsType } from "../../../controller/type";
|
|
4
|
-
import { GLTFResult } from "../../type";
|
|
5
|
-
export declare function WrapperRef({ children, outerChildren, props, refs, gltf, animationRef, name, }: {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
outerChildren?: ReactNode;
|
|
8
|
-
props: controllerInnerType;
|
|
9
|
-
refs: refsType;
|
|
10
|
-
gltf: GLTFResult;
|
|
11
|
-
animationRef?: Ref<THREE.Object3D<THREE.Object3DEventMap>>;
|
|
12
|
-
name?: string;
|
|
13
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { InnerGroupRef } from "../common/InnerGroupRef";
|
|
3
|
-
import { OuterGroupRef } from "../common/OuterGroupRef";
|
|
4
|
-
import { SlopeRayRef } from "../common/slopeRayRef";
|
|
5
|
-
import { RigidBodyRef } from "./RigidbodyRef";
|
|
6
|
-
export function WrapperRef(_a) {
|
|
7
|
-
var children = _a.children, outerChildren = _a.outerChildren, props = _a.props, refs = _a.refs, gltf = _a.gltf, animationRef = _a.animationRef, name = _a.name;
|
|
8
|
-
return (_jsxs(OuterGroupRef, { ref: refs.outerGroupRef, props: props, children: [_jsxs(RigidBodyRef, { ref: refs.rigidBodyRef, name: name, children: [_jsx(SlopeRayRef, { slopeRay: props.slopeRay, groundRay: props.groundRay, ref: refs.slopeRayOriginRef }), children, props.children, _jsx(InnerGroupRef, { props: props, gltf: gltf, ref: refs.innerGroupRef, animationRef: animationRef })] }), outerChildren] }));
|
|
9
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { groundRayType, slopeRayType } from "../../../controller/type";
|
|
3
|
-
export declare const SlopeRayRef: import("react").ForwardRefExoticComponent<{
|
|
4
|
-
groundRay: groundRayType;
|
|
5
|
-
slopeRay: slopeRayType;
|
|
6
|
-
} & import("react").RefAttributes<import("three").Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes>, import("three").Material | import("three").Material[], import("three").Object3DEventMap>>>;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
export var SlopeRayRef = forwardRef(function (_a, ref) {
|
|
4
|
-
var groundRay = _a.groundRay, slopeRay = _a.slopeRay;
|
|
5
|
-
return (_jsx("mesh", { position: [
|
|
6
|
-
groundRay.offset.x,
|
|
7
|
-
groundRay.offset.y,
|
|
8
|
-
groundRay.offset.z + slopeRay.offset.z,
|
|
9
|
-
], ref: ref, visible: false, children: _jsx("boxGeometry", { args: [0.15, 0.15, 0.15] }) }));
|
|
10
|
-
});
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { CuboidCollider } from "@react-three/rapier";
|
|
3
|
-
import { forwardRef, useContext } from "react";
|
|
4
|
-
import { GaesupWorldContext } from "../../../world/context";
|
|
5
|
-
export var VehicleCollider = forwardRef(function (_, ref) {
|
|
6
|
-
var _a = useContext(GaesupWorldContext), collider = _a.vehicleCollider, url = _a.url;
|
|
7
|
-
var vehicleSizeX = collider.vehicleSizeX, vehicleSizeY = collider.vehicleSizeY, vehicleSizeZ = collider.vehicleSizeZ;
|
|
8
|
-
return (_jsx(_Fragment, { children: url.wheelUrl ? (_jsx(CuboidCollider, { ref: ref, args: [vehicleSizeX / 2, vehicleSizeY / 2, vehicleSizeZ / 2], position: [0, vehicleSizeY + collider.wheelSizeY / 2, 0] })) : (_jsx(CuboidCollider, { ref: ref, args: [vehicleSizeX / 2, vehicleSizeY / 2, vehicleSizeZ / 2], position: [0, vehicleSizeY, 0] })) }));
|
|
9
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RapierRigidBody } from "@react-three/rapier";
|
|
2
|
-
import { RefObject } from "react";
|
|
3
|
-
export type wheelRegidBodyType = {
|
|
4
|
-
index: number;
|
|
5
|
-
wheelPosition: [number, number, number];
|
|
6
|
-
bodyRef: RefObject<RapierRigidBody>;
|
|
7
|
-
wheel: RefObject<RapierRigidBody>;
|
|
8
|
-
bodyAnchor: THREE.Vector3Tuple;
|
|
9
|
-
wheelAnchor: THREE.Vector3Tuple;
|
|
10
|
-
rotationAxis: THREE.Vector3Tuple;
|
|
11
|
-
};
|
|
12
|
-
export declare const WheelRegidBodyRef: import("react").ForwardRefExoticComponent<wheelRegidBodyType & import("react").RefAttributes<RapierRigidBody>>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Gltf } from "@react-three/drei";
|
|
3
|
-
import { CylinderCollider, RigidBody, useRevoluteJoint, } from "@react-three/rapier";
|
|
4
|
-
import { forwardRef, useContext, useRef } from "react";
|
|
5
|
-
import { GaesupWorldContext } from "../../../world/context";
|
|
6
|
-
export var WheelRegidBodyRef = forwardRef(function (_a, ref) {
|
|
7
|
-
var bodyRef = _a.bodyRef, wheel = _a.wheel, bodyAnchor = _a.bodyAnchor, wheelAnchor = _a.wheelAnchor, rotationAxis = _a.rotationAxis;
|
|
8
|
-
var _b = useContext(GaesupWorldContext), collider = _b.vehicleCollider, url = _b.url;
|
|
9
|
-
var wheelSizeX = collider.wheelSizeX, wheelSizeY = collider.wheelSizeY;
|
|
10
|
-
useRevoluteJoint(bodyRef, wheel, [bodyAnchor, wheelAnchor, rotationAxis]);
|
|
11
|
-
var colliderRef = useRef(null);
|
|
12
|
-
return (_jsxs(RigidBody, { colliders: false, ref: ref, userData: { intangible: true }, args: [wheelSizeX / 2, wheelSizeY / 2], rotation: [0, 0, Math.PI / 2], children: [_jsx(CylinderCollider, { args: [wheelSizeX / 2, wheelSizeY / 2], rotation: [0, 0, Math.PI / 2], ref: colliderRef }), _jsx(Gltf, { src: url.wheelUrl })] }));
|
|
13
|
-
});
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { controllerInnerType } from "../../../controller/type";
|
|
2
|
-
export type useSetWheelType = {
|
|
3
|
-
wheelPositions: [number, number, number][];
|
|
4
|
-
};
|
|
5
|
-
export declare function Wheels({ props }: {
|
|
6
|
-
props: controllerInnerType;
|
|
7
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createRef, useContext, useRef } from "react";
|
|
3
|
-
import { GaesupWorldContext } from "../../../world/context";
|
|
4
|
-
import { WheelRegidBodyRef } from "./wheel";
|
|
5
|
-
export function Wheels(_a) {
|
|
6
|
-
var props = _a.props;
|
|
7
|
-
var rigidBodyRef = props.rigidBodyRef;
|
|
8
|
-
var collider = useContext(GaesupWorldContext).vehicleCollider;
|
|
9
|
-
var vehicleSizeX = collider.vehicleSizeX, vehicleSizeZ = collider.vehicleSizeZ, wheelSizeX = collider.wheelSizeX, wheelSizeZ = collider.wheelSizeZ;
|
|
10
|
-
var X = (vehicleSizeX - wheelSizeX) / 2 + 0.5;
|
|
11
|
-
var Z = (vehicleSizeZ - 2 * wheelSizeZ) / 2 + 0.5;
|
|
12
|
-
var wheelPositions = [
|
|
13
|
-
[-X, 0, Z],
|
|
14
|
-
[-X, 0, -Z],
|
|
15
|
-
[X, 0, Z],
|
|
16
|
-
[X, 0, -Z],
|
|
17
|
-
];
|
|
18
|
-
var wheelRefs = useRef(wheelPositions.map(function () { return createRef(); }));
|
|
19
|
-
return (_jsx(_Fragment, { children: wheelPositions.map(function (wheelPosition, index) { return (_jsx(WheelRegidBodyRef, { index: index, ref: wheelRefs.current[index], wheelPosition: wheelPosition, bodyRef: rigidBodyRef, wheel: wheelRefs.current[index], bodyAnchor: wheelPosition, wheelAnchor: [0, 0, 0], rotationAxis: [1, 0, 0] }, index)); }) }));
|
|
20
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CuboidCollider } from "@react-three/rapier";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export var AirplaneCollider = forwardRef(function (_a, ref) {
|
|
5
|
-
var airplaneSize = _a.airplaneSize;
|
|
6
|
-
return (_jsx(CuboidCollider, { ref: ref, args: [airplaneSize.x / 2, airplaneSize.y / 2, airplaneSize.z / 2], position: [0, airplaneSize.y / 2, 0] }));
|
|
7
|
-
});
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
3
|
-
export type passiveAirplanePropsType = {
|
|
4
|
-
position: THREE.Vector3;
|
|
5
|
-
euler: THREE.Euler;
|
|
6
|
-
airplaneSize: THREE.Vector3;
|
|
7
|
-
airplaneUrl: string;
|
|
8
|
-
currentAnimation: string;
|
|
9
|
-
children?: React.ReactNode;
|
|
10
|
-
gravity?: number;
|
|
11
|
-
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
12
|
-
};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { CapsuleCollider } from "@react-three/rapier";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export var CharacterCapsuleCollider = forwardRef(function (_a, ref) {
|
|
5
|
-
var height = _a.height, diameter = _a.diameter;
|
|
6
|
-
return (_jsx(CapsuleCollider, { ref: ref, args: [height, diameter / 2], position: [0, height + diameter / 2, 0] }));
|
|
7
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { refsType } from "../../../controller/type";
|
|
3
|
-
import { activeStateType, characterColliderType, modeType, urlType } from "../../../world/context/type";
|
|
4
|
-
export type gaesupPassiveCharacterPropsType = {
|
|
5
|
-
state: activeStateType;
|
|
6
|
-
characterCollider?: characterColliderType;
|
|
7
|
-
mode: modeType;
|
|
8
|
-
url: urlType;
|
|
9
|
-
currentAnimation: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export type passiveCharacterPropsType = {
|
|
13
|
-
position: THREE.Vector3;
|
|
14
|
-
euler: THREE.Euler;
|
|
15
|
-
height: number;
|
|
16
|
-
diameter: number;
|
|
17
|
-
url: urlType;
|
|
18
|
-
currentAnimation: string;
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
};
|
|
21
|
-
export type mutateCharacterPropsType = {
|
|
22
|
-
position: THREE.Vector3;
|
|
23
|
-
euler: THREE.Euler;
|
|
24
|
-
height: number;
|
|
25
|
-
diameter: number;
|
|
26
|
-
delta?: number;
|
|
27
|
-
} & Partial<refsType>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { RigidBody, } from "@react-three/rapier";
|
|
3
|
-
import { forwardRef } from "react";
|
|
4
|
-
export var RigidBodyRef = forwardRef(function (_a, ref) {
|
|
5
|
-
var children = _a.children, position = _a.position, rotation = _a.rotation, onCollisionEnter = _a.onCollisionEnter;
|
|
6
|
-
var _euler = rotation.clone();
|
|
7
|
-
_euler.x = 0;
|
|
8
|
-
_euler.z = 0;
|
|
9
|
-
return (_jsx(RigidBody, { colliders: false, ref: ref, position: position, rotation: _euler, userData: { intangible: true }, onCollisionEnter: onCollisionEnter, children: children }));
|
|
10
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
3
|
-
import { activeStateType, characterColliderType, modeType, urlType } from "../../../world/context/type";
|
|
4
|
-
export type gaesupPassiveCharacterPropsType = {
|
|
5
|
-
state: activeStateType;
|
|
6
|
-
characterCollider?: characterColliderType;
|
|
7
|
-
mode: modeType;
|
|
8
|
-
url: urlType;
|
|
9
|
-
currentAnimation: string;
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
};
|
|
12
|
-
export type passiveVehiclePropsType = {
|
|
13
|
-
position: THREE.Vector3;
|
|
14
|
-
euler: THREE.Euler;
|
|
15
|
-
vehicleSize: THREE.Vector3;
|
|
16
|
-
wheelSize: THREE.Vector3;
|
|
17
|
-
url: urlType;
|
|
18
|
-
currentAnimation: string;
|
|
19
|
-
children?: React.ReactNode;
|
|
20
|
-
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
21
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RapierRigidBody } from "@react-three/rapier";
|
|
2
|
-
import { RefObject } from "react";
|
|
3
|
-
export type wheelRegidBodyType = {
|
|
4
|
-
wheelPosition: [number, number, number];
|
|
5
|
-
bodyRef: RefObject<RapierRigidBody>;
|
|
6
|
-
wheel: RefObject<RapierRigidBody>;
|
|
7
|
-
bodyAnchor: THREE.Vector3Tuple;
|
|
8
|
-
wheelAnchor: THREE.Vector3Tuple;
|
|
9
|
-
rotationAxis: THREE.Vector3Tuple;
|
|
10
|
-
wheelSize: THREE.Vector3;
|
|
11
|
-
url: string;
|
|
12
|
-
};
|
|
13
|
-
export declare const WheelRegidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
14
|
-
props: wheelRegidBodyType;
|
|
15
|
-
} & import("react").RefAttributes<RapierRigidBody>>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Gltf } from "@react-three/drei";
|
|
3
|
-
import { CylinderCollider, RigidBody, useRevoluteJoint, } from "@react-three/rapier";
|
|
4
|
-
import { forwardRef, useRef } from "react";
|
|
5
|
-
export var WheelRegidBodyRef = forwardRef(function (_a, ref) {
|
|
6
|
-
var props = _a.props;
|
|
7
|
-
var bodyRef = props.bodyRef, wheel = props.wheel, bodyAnchor = props.bodyAnchor, wheelAnchor = props.wheelAnchor, rotationAxis = props.rotationAxis, wheelPosition = props.wheelPosition, wheelSize = props.wheelSize, url = props.url;
|
|
8
|
-
useRevoluteJoint(bodyRef, wheel, [
|
|
9
|
-
bodyAnchor,
|
|
10
|
-
wheelAnchor,
|
|
11
|
-
rotationAxis,
|
|
12
|
-
[0, 0],
|
|
13
|
-
]);
|
|
14
|
-
var refs = useRef(null);
|
|
15
|
-
return (_jsxs(RigidBody, { position: wheelPosition, colliders: false, ref: ref, children: [_jsx(CylinderCollider, { args: [wheelSize.x / 2, wheelSize.y / 2], rotation: [0, 0, Math.PI / 2], ref: refs }), _jsx(Gltf, { src: url })] }));
|
|
16
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { RapierRigidBody } from "@react-three/rapier";
|
|
3
|
-
export type useSetWheelType = {
|
|
4
|
-
wheelPositions: [number, number, number][];
|
|
5
|
-
};
|
|
6
|
-
export declare function Wheels({ vehicleSize, wheelSize, rigidBodyRef, url, }: {
|
|
7
|
-
vehicleSize: THREE.Vector3;
|
|
8
|
-
wheelSize: THREE.Vector3;
|
|
9
|
-
rigidBodyRef: React.MutableRefObject<RapierRigidBody>;
|
|
10
|
-
url: string;
|
|
11
|
-
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { createRef, useRef } from "react";
|
|
3
|
-
import { WheelRegidBodyRef } from "./wheel";
|
|
4
|
-
export function Wheels(_a) {
|
|
5
|
-
var vehicleSize = _a.vehicleSize, wheelSize = _a.wheelSize, rigidBodyRef = _a.rigidBodyRef, url = _a.url;
|
|
6
|
-
var X = (vehicleSize.x - wheelSize.x) / 2 + 0.5;
|
|
7
|
-
var Z = (vehicleSize.z - 2 * wheelSize.z) / 2 + 0.5;
|
|
8
|
-
var wheelPositions = [
|
|
9
|
-
[-X, 0, Z],
|
|
10
|
-
[-X, 0, -Z],
|
|
11
|
-
[X, 0, Z],
|
|
12
|
-
[X, 0, -Z],
|
|
13
|
-
];
|
|
14
|
-
var wheelRefs = useRef(wheelPositions.map(function () { return createRef(); }));
|
|
15
|
-
return (_jsx(_Fragment, { children: wheelPositions.map(function (wheelPosition, index) { return (_jsx(WheelRegidBodyRef, { ref: wheelRefs.current[index], props: {
|
|
16
|
-
wheelPosition: wheelPosition,
|
|
17
|
-
bodyRef: rigidBodyRef,
|
|
18
|
-
wheel: wheelRefs.current[index],
|
|
19
|
-
bodyAnchor: wheelPosition,
|
|
20
|
-
wheelSize: wheelSize,
|
|
21
|
-
wheelAnchor: [0, 0, 0],
|
|
22
|
-
rotationAxis: [1, 0, 0],
|
|
23
|
-
url: url,
|
|
24
|
-
} }, index)); }) }));
|
|
25
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export default function slope(prop) {
|
|
2
|
-
var capsuleColliderRef = prop.capsuleColliderRef, slopeRayOriginRef = prop.slopeRayOriginRef, slopeRay = prop.slopeRay, groundRay = prop.groundRay, worldContext = prop.worldContext, world = prop.world;
|
|
3
|
-
var collider = worldContext.characterCollider;
|
|
4
|
-
if (!slopeRayOriginRef.current ||
|
|
5
|
-
!capsuleColliderRef.current ||
|
|
6
|
-
!slopeRay.rayCast)
|
|
7
|
-
return null;
|
|
8
|
-
slopeRayOriginRef.current.getWorldPosition(slopeRay.origin);
|
|
9
|
-
slopeRay.origin.y = groundRay.origin.y;
|
|
10
|
-
slopeRay.hit = world.castRay(slopeRay.rayCast, slopeRay.length, true, undefined, undefined, capsuleColliderRef.current);
|
|
11
|
-
// if (slopeRay.hit && groundRay.rayCast) {
|
|
12
|
-
// const castRayNormal = slopeRay.hit.collider.castRayAndGetNormal(
|
|
13
|
-
// groundRay.rayCast,
|
|
14
|
-
// slopeRay.length,
|
|
15
|
-
// false
|
|
16
|
-
// );
|
|
17
|
-
// if (castRayNormal) slopeRay.current = vec3(castRayNormal.normal);
|
|
18
|
-
// }
|
|
19
|
-
// if (
|
|
20
|
-
// slopeRay.hit &&
|
|
21
|
-
// groundRay.hit &&
|
|
22
|
-
// slopeRay.hit.toi < collider.radius + 0.3 + 0.5
|
|
23
|
-
// ) {
|
|
24
|
-
// slopeRay.angle = Number(
|
|
25
|
-
// Math.atan(
|
|
26
|
-
// (groundRay.hit.toi - slopeRay.hit.toi) / slopeRay.offset.z
|
|
27
|
-
// ).toFixed(2)
|
|
28
|
-
// );
|
|
29
|
-
// }
|
|
30
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useGLTF } from "@react-three/drei";
|
|
2
|
-
import * as THREE from "three";
|
|
3
|
-
export var useGltfAndSize = function (url) {
|
|
4
|
-
var gltf = useGLTF(url);
|
|
5
|
-
var scene = gltf.scene;
|
|
6
|
-
var size = new THREE.Box3()
|
|
7
|
-
.setFromObject(scene)
|
|
8
|
-
.getSize(new THREE.Vector3());
|
|
9
|
-
return { gltf: gltf, size: size };
|
|
10
|
-
};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { isVectorNonZero } from "../../../utils";
|
|
3
|
-
import { update } from "../../../utils/context";
|
|
4
|
-
export function airplane(_a) {
|
|
5
|
-
var gltf = _a.gltf, value = _a.value, dispatch = _a.dispatch;
|
|
6
|
-
var url = value.url;
|
|
7
|
-
if (!url || !url.airplaneUrl)
|
|
8
|
-
return;
|
|
9
|
-
var airplaneSize = gltf.airplaneSize;
|
|
10
|
-
useEffect(function () {
|
|
11
|
-
if (isVectorNonZero(airplaneSize)) {
|
|
12
|
-
update({
|
|
13
|
-
airplaneCollider: {
|
|
14
|
-
airplaneSizeX: airplaneSize.x,
|
|
15
|
-
airplaneSizeY: airplaneSize.y,
|
|
16
|
-
airplaneSizeZ: airplaneSize.z,
|
|
17
|
-
airplaneX: airplaneSize.x / 2,
|
|
18
|
-
airplaneY: airplaneSize.y / 2,
|
|
19
|
-
airplaneZ: airplaneSize.z / 2,
|
|
20
|
-
gravity: 0.2,
|
|
21
|
-
},
|
|
22
|
-
}, dispatch);
|
|
23
|
-
}
|
|
24
|
-
}, [airplaneSize.x, airplaneSize.y, airplaneSize.z]);
|
|
25
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { isVectorNonZero } from "../../../utils";
|
|
3
|
-
import { update } from "../../../utils/context";
|
|
4
|
-
export function character(_a) {
|
|
5
|
-
var gltf = _a.gltf, value = _a.value, dispatch = _a.dispatch;
|
|
6
|
-
var url = value.url;
|
|
7
|
-
if (!url || !url.characterUrl)
|
|
8
|
-
return;
|
|
9
|
-
var characterSize = gltf.characterSize;
|
|
10
|
-
useEffect(function () {
|
|
11
|
-
if (isVectorNonZero(characterSize)) {
|
|
12
|
-
var heightPlusDiameter = characterSize.y / 2;
|
|
13
|
-
var diameter = Math.max(characterSize.x, characterSize.z);
|
|
14
|
-
var radius = diameter / 2;
|
|
15
|
-
var height = heightPlusDiameter - radius;
|
|
16
|
-
var halfHeight = height / 2;
|
|
17
|
-
update({
|
|
18
|
-
characterCollider: {
|
|
19
|
-
height: height,
|
|
20
|
-
halfHeight: halfHeight,
|
|
21
|
-
radius: radius,
|
|
22
|
-
diameter: diameter,
|
|
23
|
-
},
|
|
24
|
-
}, dispatch);
|
|
25
|
-
}
|
|
26
|
-
}, [characterSize.x, characterSize.y, characterSize.z]);
|
|
27
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import * as THREE from "three";
|
|
2
|
-
import { GLTFResult } from "../../../component/type";
|
|
3
|
-
import { innerColliderPropType } from "../type";
|
|
4
|
-
export type getGltfResultType = {
|
|
5
|
-
characterGltf: GLTFResult;
|
|
6
|
-
vehicleGltf: GLTFResult;
|
|
7
|
-
wheelGltf: GLTFResult;
|
|
8
|
-
airplaneGltf: GLTFResult;
|
|
9
|
-
characterSize: THREE.Vector3;
|
|
10
|
-
vehicleSize: THREE.Vector3;
|
|
11
|
-
wheelSize: THREE.Vector3;
|
|
12
|
-
airplaneSize: THREE.Vector3;
|
|
13
|
-
};
|
|
14
|
-
export default function getGltf({ value, dispatch, }: innerColliderPropType): getGltfResultType;
|