gaesup-world 0.4.3 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gaesup/animation/actions.d.ts +6 -5
- package/dist/gaesup/camera/type.d.ts +1 -0
- package/dist/gaesup/component/active/airplane/index.d.ts +1 -0
- package/dist/gaesup/component/active/character/index.js +0 -1
- package/dist/gaesup/component/active/vehicle/index.d.ts +1 -0
- package/dist/gaesup/component/inner/airplane/index.d.ts +1 -1
- package/dist/gaesup/component/inner/airplane/index.js +2 -2
- package/dist/gaesup/component/inner/character/index.d.ts +4 -1
- package/dist/gaesup/component/inner/character/index.js +2 -2
- package/dist/gaesup/component/inner/common/OuterGroupRef.d.ts +2 -1
- package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +3 -1
- package/dist/gaesup/component/inner/common/RigidbodyRef.js +2 -2
- package/dist/gaesup/component/inner/common/type.d.ts +3 -1
- package/dist/gaesup/component/inner/vehicle/collider.d.ts +1 -0
- package/dist/gaesup/component/inner/vehicle/index.d.ts +1 -1
- package/dist/gaesup/component/inner/vehicle/index.js +2 -2
- package/dist/gaesup/component/inner/vehicle/wheels.d.ts +1 -0
- package/dist/gaesup/component/passive/airplane/index.d.ts +3 -1
- package/dist/gaesup/component/passive/airplane/index.js +1 -1
- package/dist/gaesup/component/passive/character/index.d.ts +3 -0
- package/dist/gaesup/component/passive/character/index.js +2 -2
- package/dist/gaesup/component/passive/vehicle/index.d.ts +3 -1
- package/dist/gaesup/component/passive/vehicle/index.js +1 -1
- package/dist/gaesup/component/type.d.ts +1 -0
- package/dist/gaesup/controller/context/type.d.ts +1 -0
- package/dist/gaesup/controller/initialize/callback/index.d.ts +1 -0
- package/dist/gaesup/controller/initialize/callback/type.d.ts +1 -0
- package/dist/gaesup/hooks/useFocus/index.d.ts +1 -0
- package/dist/gaesup/hooks/useFocus/index.js +70 -80
- package/dist/gaesup/hooks/useTeleport/index.d.ts +1 -0
- package/dist/gaesup/physics/type.d.ts +1 -0
- package/dist/gaesup/tools/jumpPortal/index.d.ts +1 -0
- package/dist/gaesup/tools/zoomButton/index.d.ts +1 -0
- package/dist/gaesup/utils/debug.d.ts +1 -0
- package/dist/gaesup/world/context/type.d.ts +1 -0
- package/dist/gaesup/world/type.d.ts +1 -0
- package/package.json +18 -18
- package/yarn-error.log +0 -12152
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Ref } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
import { AnimationAction, AnimationClip, AnimationMixer, Object3D, Object3DEventMap } from "three";
|
|
3
4
|
import { groundRayType } from "../controller/type";
|
|
4
5
|
export type Api<T extends AnimationClip> = {
|
|
@@ -29,17 +30,17 @@ export type playResultType = {
|
|
|
29
30
|
};
|
|
30
31
|
export declare function subscribeActions({ type, groundRay, animations, }: subscribeActionsType): {
|
|
31
32
|
animationResult: {
|
|
32
|
-
ref: import("react").MutableRefObject<Object3D<Object3DEventMap>>;
|
|
33
|
-
clips: AnimationClip[];
|
|
34
|
-
mixer: AnimationMixer;
|
|
33
|
+
ref: import("react").MutableRefObject<THREE.Object3D<THREE.Object3DEventMap>>;
|
|
34
|
+
clips: THREE.AnimationClip[];
|
|
35
|
+
mixer: THREE.AnimationMixer;
|
|
35
36
|
names: string[];
|
|
36
37
|
actions: {
|
|
37
|
-
[x: string]: AnimationAction;
|
|
38
|
+
[x: string]: THREE.AnimationAction;
|
|
38
39
|
};
|
|
39
40
|
};
|
|
40
41
|
};
|
|
41
42
|
export default function playActions({ type, animationResult, currentAnimation, }: playActionsType): {
|
|
42
|
-
animationRef: import("react").MutableRefObject<Object3D<Object3DEventMap>>;
|
|
43
|
+
animationRef: import("react").MutableRefObject<THREE.Object3D<THREE.Object3DEventMap>>;
|
|
43
44
|
currentAnimation: string;
|
|
44
45
|
};
|
|
45
46
|
export declare const setAnimation: ({ currentAnimation, actions, type, }: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
import { controllerInnerType, groundRayType, refsType } from "../../../controller/type";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export declare function AirplaneRef({ children, props, groundRay, enableRiding, isRiderOn, offset, refs, urls, }: {
|
|
@@ -18,7 +18,6 @@ export function CharacterRef(_a) {
|
|
|
18
18
|
setGroundRay({
|
|
19
19
|
groundRay: props.groundRay,
|
|
20
20
|
length: ((collider === null || collider === void 0 ? void 0 : collider.height) || 0) + 2,
|
|
21
|
-
// length: collider?.radius || 0 + 2,
|
|
22
21
|
colliderRef: colliderRef,
|
|
23
22
|
});
|
|
24
23
|
var animationResult = subscribeActions({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
import { controllerInnerType, groundRayType, refsType } from "../../../controller/type";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export declare function VehicleRef({ children, props, groundRay, enableRiding, isRiderOn, offset, refs, urls, }: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { refPropsType } from "../common/type";
|
|
2
|
-
export declare function AirplaneInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, onCollisionEnter, }: refPropsType): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function AirplaneInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, onCollisionEnter, type, }: refPropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,11 +6,11 @@ import { OuterGroupRef } from "../common/OuterGroupRef";
|
|
|
6
6
|
import { RigidBodyRef } from "../common/RigidbodyRef";
|
|
7
7
|
import RiderRef from "../rider";
|
|
8
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;
|
|
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, type = _a.type;
|
|
10
10
|
var airplaneUrl = urls.airplaneUrl;
|
|
11
11
|
var rigidBodyRef = refs.rigidBodyRef, innerGroupRef = refs.innerGroupRef, outerGroupRef = refs.outerGroupRef;
|
|
12
12
|
var size = useGltfAndSize({
|
|
13
13
|
url: airplaneUrl,
|
|
14
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 })) })] })) }));
|
|
15
|
+
return (_jsx(OuterGroupRef, { ref: outerGroupRef, children: airplaneUrl && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, type: type, 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
16
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { refsType } from "../../../controller/type";
|
|
2
|
+
import { RigidBodyTypeString } from "@react-three/rapier";
|
|
2
3
|
import { ReactNode, Ref } from "react";
|
|
4
|
+
import * as THREE from "three";
|
|
3
5
|
import { Object3D, Object3DEventMap } from "three";
|
|
4
6
|
import { urlsType } from "../../../world/context/type";
|
|
5
7
|
export declare const calcCharacterColliderProps: (characterSize: THREE.Vector3) => {
|
|
@@ -14,7 +16,7 @@ export type characterColliderType = {
|
|
|
14
16
|
radius: number;
|
|
15
17
|
diameter: number;
|
|
16
18
|
};
|
|
17
|
-
export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, positionLerp, }: {
|
|
19
|
+
export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, positionLerp, type, }: {
|
|
18
20
|
children: ReactNode;
|
|
19
21
|
refs: Partial<refsType>;
|
|
20
22
|
urls: urlsType;
|
|
@@ -23,4 +25,5 @@ export declare function CharacterInnerRef({ children, refs, urls, position, eule
|
|
|
23
25
|
animationRef?: Ref<Object3D<Object3DEventMap>>;
|
|
24
26
|
currentAnimation?: string;
|
|
25
27
|
positionLerp?: number;
|
|
28
|
+
type?: RigidBodyTypeString;
|
|
26
29
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -20,9 +20,9 @@ export var calcCharacterColliderProps = function (characterSize) {
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
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, positionLerp = _a.positionLerp;
|
|
23
|
+
var children = _a.children, refs = _a.refs, urls = _a.urls, position = _a.position, euler = _a.euler, currentAnimation = _a.currentAnimation, positionLerp = _a.positionLerp, type = _a.type;
|
|
24
24
|
var outerGroupRef = refs.outerGroupRef, rigidBodyRef = refs.rigidBodyRef, colliderRef = refs.colliderRef, innerGroupRef = refs.innerGroupRef;
|
|
25
25
|
var size = useGltfAndSize({ url: urls.characterUrl }).size;
|
|
26
26
|
var collider = calcCharacterColliderProps(size);
|
|
27
|
-
return (_jsx(_Fragment, { children: collider && (_jsx(OuterGroupRef, { ref: outerGroupRef, children: _jsxs(RigidBodyRef, { ref: rigidBodyRef, name: "character", position: position, positionLerp: positionLerp, 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, children: children })] }) })) }));
|
|
27
|
+
return (_jsx(_Fragment, { children: collider && (_jsx(OuterGroupRef, { ref: outerGroupRef, children: _jsxs(RigidBodyRef, { ref: rigidBodyRef, name: "character", position: position, positionLerp: positionLerp, rotation: euler, type: type, 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, children: children })] }) })) }));
|
|
28
28
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
export declare const OuterGroupRef: import("react").ForwardRefExoticComponent<{
|
|
3
4
|
children: ReactNode;
|
|
4
|
-
} & import("react").RefAttributes<
|
|
5
|
+
} & import("react").RefAttributes<THREE.Group<THREE.Object3DEventMap>>>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { CollisionEnterPayload, RapierRigidBody } from "@react-three/rapier";
|
|
1
|
+
import { CollisionEnterPayload, RapierRigidBody, RigidBodyTypeString } from "@react-three/rapier";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
name?: string;
|
|
@@ -10,4 +11,5 @@ export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
|
10
11
|
};
|
|
11
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
12
13
|
positionLerp?: number;
|
|
14
|
+
type?: RigidBodyTypeString;
|
|
13
15
|
} & import("react").RefAttributes<RapierRigidBody>>;
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { RigidBody, euler, } from "@react-three/rapier";
|
|
3
3
|
import { forwardRef, useEffect, useState, } from "react";
|
|
4
4
|
export var RigidBodyRef = forwardRef(function (_a, ref) {
|
|
5
|
-
var children = _a.children, name = _a.name, position = _a.position, rotation = _a.rotation, userData = _a.userData, onCollisionEnter = _a.onCollisionEnter, positionLerp = _a.positionLerp;
|
|
5
|
+
var children = _a.children, name = _a.name, position = _a.position, rotation = _a.rotation, userData = _a.userData, onCollisionEnter = _a.onCollisionEnter, positionLerp = _a.positionLerp, type = _a.type;
|
|
6
6
|
var _b = useState(position), newPosition = _b[0], setNewPosition = _b[1];
|
|
7
7
|
useEffect(function () {
|
|
8
8
|
if (!positionLerp)
|
|
@@ -11,5 +11,5 @@ export var RigidBodyRef = forwardRef(function (_a, ref) {
|
|
|
11
11
|
return ordPosition.lerp(position.clone(), positionLerp);
|
|
12
12
|
});
|
|
13
13
|
}, [position, positionLerp]);
|
|
14
|
-
return (_jsx(RigidBody, { colliders: false, ref: ref, name: name, position: positionLerp ? newPosition === null || newPosition === void 0 ? void 0 : newPosition.clone() : position, rotation: euler().set(0, (rotation === null || rotation === void 0 ? void 0 : rotation.clone().y) || 0, 0), userData: userData, onCollisionEnter: onCollisionEnter, children: children }));
|
|
14
|
+
return (_jsx(RigidBody, { colliders: false, ref: ref, name: name, position: positionLerp ? newPosition === null || newPosition === void 0 ? void 0 : newPosition.clone() : position, rotation: euler().set(0, (rotation === null || rotation === void 0 ? void 0 : rotation.clone().y) || 0, 0), userData: userData, onCollisionEnter: onCollisionEnter, type: type || "dynamic", children: children }));
|
|
15
15
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { refsType } from "../../../controller/type";
|
|
4
5
|
import { urlsType } from "../../../world/context/type";
|
|
5
6
|
export type refPropsType = {
|
|
@@ -17,4 +18,5 @@ export type refPropsType = {
|
|
|
17
18
|
};
|
|
18
19
|
currentAnimation?: string;
|
|
19
20
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
21
|
+
type?: RigidBodyTypeString;
|
|
20
22
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Collider } from "@dimforge/rapier3d-compat";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export declare const VehicleWheelCollider: import("react").ForwardRefExoticComponent<{
|
|
5
6
|
urls: urlsType;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { refPropsType } from "../common/type";
|
|
2
|
-
export declare function VehicleInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, currentAnimation, onCollisionEnter, }: refPropsType): import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare function VehicleInnerRef({ children, refs, urls, isRiderOn, enableRiding, offset, name, position, rotation, userData, currentAnimation, onCollisionEnter, type, }: refPropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -7,11 +7,11 @@ import RiderRef from "../rider";
|
|
|
7
7
|
import { VehicleCollider, VehicleWheelCollider } from "./collider";
|
|
8
8
|
import { WheelsRef } from "./wheels";
|
|
9
9
|
export function VehicleInnerRef(_a) {
|
|
10
|
-
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, currentAnimation = _a.currentAnimation, onCollisionEnter = _a.onCollisionEnter;
|
|
10
|
+
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, currentAnimation = _a.currentAnimation, onCollisionEnter = _a.onCollisionEnter, type = _a.type;
|
|
11
11
|
var vehicleUrl = urls.vehicleUrl, wheelUrl = urls.wheelUrl;
|
|
12
12
|
var rigidBodyRef = refs.rigidBodyRef, innerGroupRef = refs.innerGroupRef, outerGroupRef = refs.outerGroupRef;
|
|
13
13
|
var vehicleSize = useGltfAndSize({
|
|
14
14
|
url: urls.vehicleUrl,
|
|
15
15
|
}).size;
|
|
16
|
-
return (_jsxs(OuterGroupRef, { ref: outerGroupRef, children: [vehicleUrl && rigidBodyRef && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, children: [wheelUrl ? (_jsx(VehicleWheelCollider, { urls: urls, vehicleSize: vehicleSize })) : (_jsx(VehicleCollider, { vehicleSize: vehicleSize })), enableRiding && isRiderOn && urls.characterUrl && (_jsx(RiderRef, { urls: urls, offset: offset })), children, _jsx(InnerGroupRef, { type: "vehicle", url: vehicleUrl, currentAnimation: currentAnimation, ref: innerGroupRef })] })), wheelUrl && (_jsx(WheelsRef, { refs: refs, urls: urls, vehicleSize: vehicleSize }))] }));
|
|
16
|
+
return (_jsxs(OuterGroupRef, { ref: outerGroupRef, children: [vehicleUrl && rigidBodyRef && (_jsxs(RigidBodyRef, { ref: rigidBodyRef, name: name, position: position, rotation: rotation, userData: userData, onCollisionEnter: onCollisionEnter, type: type, children: [wheelUrl ? (_jsx(VehicleWheelCollider, { urls: urls, vehicleSize: vehicleSize })) : (_jsx(VehicleCollider, { vehicleSize: vehicleSize })), enableRiding && isRiderOn && urls.characterUrl && (_jsx(RiderRef, { urls: urls, offset: offset })), children, _jsx(InnerGroupRef, { type: "vehicle", url: vehicleUrl, currentAnimation: currentAnimation, ref: innerGroupRef })] })), wheelUrl && (_jsx(WheelsRef, { refs: refs, urls: urls, vehicleSize: vehicleSize }))] }));
|
|
17
17
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export type passiveAirplanePropsType = {
|
|
5
6
|
position: THREE.Vector3;
|
|
@@ -9,5 +10,6 @@ export type passiveAirplanePropsType = {
|
|
|
9
10
|
offset?: THREE.Vector3;
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
12
14
|
};
|
|
13
15
|
export declare function PassiveAirplane(props: passiveAirplanePropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -36,5 +36,5 @@ export function PassiveAirplane(props) {
|
|
|
36
36
|
: 0.1, false);
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
|
-
return (_jsx(AirplaneInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: props.currentAnimation, children: props.children }));
|
|
39
|
+
return (_jsx(AirplaneInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: props.currentAnimation, type: props.type, children: props.children }));
|
|
40
40
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { RigidBodyTypeString } from "@react-three/rapier";
|
|
3
|
+
import * as THREE from "three";
|
|
2
4
|
import { urlsType } from "../../../world/context/type";
|
|
3
5
|
export type passiveCharacterPropsType = {
|
|
4
6
|
position: THREE.Vector3;
|
|
@@ -8,5 +10,6 @@ export type passiveCharacterPropsType = {
|
|
|
8
10
|
gravityScale?: number;
|
|
9
11
|
children?: React.ReactNode;
|
|
10
12
|
positionLerp?: number;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
11
14
|
};
|
|
12
15
|
export declare function PassiveCharacter(props: passiveCharacterPropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useFrame } from "@react-three/fiber";
|
|
3
|
-
import { quat } from "@react-three/rapier";
|
|
3
|
+
import { quat, } from "@react-three/rapier";
|
|
4
4
|
import { useEffect, useMemo, useRef } from "react";
|
|
5
5
|
import { CharacterInnerRef } from "../../inner/character";
|
|
6
6
|
export function PassiveCharacter(props) {
|
|
@@ -31,5 +31,5 @@ export function PassiveCharacter(props) {
|
|
|
31
31
|
innerGroupRef.current.quaternion.rotateTowards(quat().setFromEuler(euler), 10 * delta);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
|
-
return (_jsx(CharacterInnerRef, { position: position, refs: refs, urls: props.urls, currentAnimation: props.currentAnimation, positionLerp: props.positionLerp, children: props.children }));
|
|
34
|
+
return (_jsx(CharacterInnerRef, { position: position, refs: refs, urls: props.urls, currentAnimation: props.currentAnimation, positionLerp: props.positionLerp, type: props.type, children: props.children }));
|
|
35
35
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export type passiveVehiclePropsType = {
|
|
5
6
|
position: THREE.Vector3;
|
|
@@ -9,5 +10,6 @@ export type passiveVehiclePropsType = {
|
|
|
9
10
|
children?: React.ReactNode;
|
|
10
11
|
offset?: THREE.Vector3;
|
|
11
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
12
14
|
};
|
|
13
15
|
export declare function PassiveVehicle(props: passiveVehiclePropsType): import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,5 +13,5 @@ export function PassiveVehicle(props) {
|
|
|
13
13
|
colliderRef: colliderRef,
|
|
14
14
|
};
|
|
15
15
|
var position = props.position, euler = props.euler, currentAnimation = props.currentAnimation, urls = props.urls;
|
|
16
|
-
return (_jsx(VehicleInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: currentAnimation, children: props.children }));
|
|
16
|
+
return (_jsx(VehicleInnerRef, { refs: refs, urls: urls, position: position, rotation: euler, userData: { intangible: true }, onCollisionEnter: props.onCollisionEnter, currentAnimation: currentAnimation, type: props.type, children: props.children }));
|
|
17
17
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RootState } from "@react-three/fiber";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
import { cameraRayType } from "../../../camera/type";
|
|
3
4
|
import { activeStateType, animationAtomType, animationStateType, keyControlType, statesType } from "../../../world/context/type";
|
|
4
5
|
import { actionsType, groundRayType } from "../../type";
|
|
@@ -102,91 +102,81 @@ export function useFocus() {
|
|
|
102
102
|
return [2 /*return*/];
|
|
103
103
|
});
|
|
104
104
|
}); };
|
|
105
|
-
var focus = function (_a) {
|
|
106
|
-
var zoom =
|
|
107
|
-
return
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
return [2 /*return*/];
|
|
114
|
-
});
|
|
105
|
+
var focus = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
106
|
+
var zoom = _b.zoom, target = _b.target, position = _b.position;
|
|
107
|
+
return __generator(this, function (_c) {
|
|
108
|
+
if (zoom)
|
|
109
|
+
cameraOption.zoom = zoom;
|
|
110
|
+
cameraOption.position.lerp(position, 0.1);
|
|
111
|
+
cameraOption.target.lerp(target, 0.1);
|
|
112
|
+
return [2 /*return*/];
|
|
115
113
|
});
|
|
116
|
-
};
|
|
117
|
-
var free = function (_a) {
|
|
118
|
-
var zoom =
|
|
119
|
-
return
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
return [2 /*return*/];
|
|
126
|
-
});
|
|
114
|
+
}); };
|
|
115
|
+
var free = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
116
|
+
var zoom = _b.zoom;
|
|
117
|
+
return __generator(this, function (_c) {
|
|
118
|
+
if (zoom)
|
|
119
|
+
cameraOption.zoom = zoom;
|
|
120
|
+
cameraOption.position.lerp(makeNormalCameraPosition(activeState, cameraOption), 0.1);
|
|
121
|
+
cameraOption.target.lerp(activeState.position.clone(), 0.1);
|
|
122
|
+
return [2 /*return*/];
|
|
127
123
|
});
|
|
128
|
-
};
|
|
129
|
-
var move = function (_a) {
|
|
130
|
-
var newPosition =
|
|
131
|
-
return
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return [2 /*return*/];
|
|
135
|
-
});
|
|
124
|
+
}); };
|
|
125
|
+
var move = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
126
|
+
var newPosition = _b.newPosition;
|
|
127
|
+
return __generator(this, function (_c) {
|
|
128
|
+
cameraOption.position.lerp(newPosition.clone(), 0.1);
|
|
129
|
+
return [2 /*return*/];
|
|
136
130
|
});
|
|
137
|
-
};
|
|
138
|
-
var focusOn = function (_a) {
|
|
139
|
-
var zoom =
|
|
140
|
-
return
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}
|
|
160
|
-
});
|
|
131
|
+
}); };
|
|
132
|
+
var focusOn = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
133
|
+
var zoom = _b.zoom, target = _b.target, position = _b.position;
|
|
134
|
+
return __generator(this, function (_c) {
|
|
135
|
+
switch (_c.label) {
|
|
136
|
+
case 0: return [4 /*yield*/, close()];
|
|
137
|
+
case 1:
|
|
138
|
+
_c.sent();
|
|
139
|
+
return [4 /*yield*/, on()];
|
|
140
|
+
case 2:
|
|
141
|
+
_c.sent();
|
|
142
|
+
return [4 /*yield*/, move({ newPosition: position })];
|
|
143
|
+
case 3:
|
|
144
|
+
_c.sent();
|
|
145
|
+
return [4 /*yield*/, focus({ zoom: zoom, target: target, position: position })];
|
|
146
|
+
case 4:
|
|
147
|
+
_c.sent();
|
|
148
|
+
return [4 /*yield*/, dispatchAsync()];
|
|
149
|
+
case 5:
|
|
150
|
+
_c.sent();
|
|
151
|
+
return [2 /*return*/];
|
|
152
|
+
}
|
|
161
153
|
});
|
|
162
|
-
};
|
|
163
|
-
var focusOff = function (_a) {
|
|
164
|
-
var zoom =
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
});
|
|
154
|
+
}); };
|
|
155
|
+
var focusOff = function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
156
|
+
var zoom = _b.zoom;
|
|
157
|
+
return __generator(this, function (_c) {
|
|
158
|
+
switch (_c.label) {
|
|
159
|
+
case 0: return [4 /*yield*/, open()];
|
|
160
|
+
case 1:
|
|
161
|
+
_c.sent();
|
|
162
|
+
return [4 /*yield*/, off()];
|
|
163
|
+
case 2:
|
|
164
|
+
_c.sent();
|
|
165
|
+
return [4 /*yield*/, move({
|
|
166
|
+
newPosition: makeNormalCameraPosition(activeState, cameraOption),
|
|
167
|
+
})];
|
|
168
|
+
case 3:
|
|
169
|
+
_c.sent();
|
|
170
|
+
return [4 /*yield*/, free({ zoom: zoom })];
|
|
171
|
+
case 4:
|
|
172
|
+
_c.sent();
|
|
173
|
+
return [4 /*yield*/, dispatchAsync()];
|
|
174
|
+
case 5:
|
|
175
|
+
_c.sent();
|
|
176
|
+
return [2 /*return*/];
|
|
177
|
+
}
|
|
188
178
|
});
|
|
189
|
-
};
|
|
179
|
+
}); };
|
|
190
180
|
return {
|
|
191
181
|
open: open,
|
|
192
182
|
close: close,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RootState } from "@react-three/fiber";
|
|
2
2
|
import { World } from "@dimforge/rapier3d-compat";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { gaesupControllerType } from "../controller/context/type";
|
|
4
5
|
import { controllerInnerType, refsType } from "../controller/type";
|
|
5
6
|
import { dispatchType } from "../utils/type";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
2
|
import { actionsType, refsType } from "../../controller/type";
|
|
3
|
+
import * as THREE from "three";
|
|
3
4
|
import { joyStickInnerType } from "../../tools/joyStick/type";
|
|
4
5
|
import { keyboardMapType } from "../../tools/keyBoardToolTip/type";
|
|
5
6
|
import { minimapInnerType } from "../../tools/miniMap/type";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
+
import * as THREE from "three";
|
|
2
3
|
import { keyboardMapType } from "../tools/keyBoardToolTip/type";
|
|
3
4
|
import { dispatchType } from "../utils/type";
|
|
4
5
|
import { blockType, cameraOptionType, gaesupWorldContextType, modeType, urlsType } from "./context/type";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gaesup-world",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@dimforge/rapier3d": "^0.12.0",
|
|
21
21
|
"@react-icons/all-files": "^4.1.0",
|
|
22
|
-
"@react-three/drei": "9.
|
|
23
|
-
"@react-three/fiber": "8.
|
|
24
|
-
"@react-three/rapier": "^1.
|
|
25
|
-
"@types/three": "^0.
|
|
22
|
+
"@react-three/drei": "9.102.6",
|
|
23
|
+
"@react-three/fiber": "8.16.1",
|
|
24
|
+
"@react-three/rapier": "^1.3.0",
|
|
25
|
+
"@types/three": "^0.162.0",
|
|
26
26
|
"gh-pages": "^6.1.1",
|
|
27
27
|
"leva": "0.9.35",
|
|
28
28
|
"node-fetch": "3.3.2",
|
|
@@ -31,29 +31,29 @@
|
|
|
31
31
|
"react-dom": "^18.2.0",
|
|
32
32
|
"react-icons": "^5.0.1",
|
|
33
33
|
"react-use-refs": "^1.0.1",
|
|
34
|
-
"three": "^0.
|
|
34
|
+
"three": "^0.163.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/react": "^18.2.
|
|
38
|
-
"@types/react-dom": "^18.2.
|
|
39
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
40
|
-
"@typescript-eslint/parser": "^
|
|
41
|
-
"@vanilla-extract/css": "^1.14.
|
|
37
|
+
"@types/react": "^18.2.73",
|
|
38
|
+
"@types/react-dom": "^18.2.23",
|
|
39
|
+
"@typescript-eslint/eslint-plugin": "^7.4.0",
|
|
40
|
+
"@typescript-eslint/parser": "^7.4.0",
|
|
41
|
+
"@vanilla-extract/css": "^1.14.2",
|
|
42
42
|
"@vanilla-extract/dynamic": "^2.1.0",
|
|
43
|
-
"@vanilla-extract/recipes": "^0.5.
|
|
43
|
+
"@vanilla-extract/recipes": "^0.5.2",
|
|
44
44
|
"@vanilla-extract/sprinkles": "^1.6.1",
|
|
45
|
-
"@vanilla-extract/vite-plugin": "^4.0.
|
|
45
|
+
"@vanilla-extract/vite-plugin": "^4.0.7",
|
|
46
46
|
"@vitejs/plugin-react-swc": "^3.6.0",
|
|
47
47
|
"copyfiles": "^2.4.1",
|
|
48
48
|
"css-loader": "^6.10.0",
|
|
49
|
-
"eslint": "^8.
|
|
49
|
+
"eslint": "^8.57.0",
|
|
50
50
|
"eslint-plugin-react-hooks": "^4.6.0",
|
|
51
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
51
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
52
52
|
"path": "^0.12.7",
|
|
53
|
-
"prettier": "^3.2.
|
|
53
|
+
"prettier": "^3.2.5",
|
|
54
54
|
"rimraf": "^5.0.5",
|
|
55
|
-
"typescript": "^5.
|
|
56
|
-
"vite": "^5.
|
|
55
|
+
"typescript": "^5.4.3",
|
|
56
|
+
"vite": "^5.2.7",
|
|
57
57
|
"vite-plugin-svgr": "^4.2.0"
|
|
58
58
|
},
|
|
59
59
|
"description": "Web 3D Character Controller and World Platform Library",
|