gaesup-world 0.4.4 → 0.5.2
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/component/active/character/index.js +0 -1
- 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 +3 -1
- package/dist/gaesup/component/inner/character/index.js +2 -2
- package/dist/gaesup/component/inner/common/RigidbodyRef.d.ts +2 -1
- package/dist/gaesup/component/inner/common/RigidbodyRef.js +2 -2
- package/dist/gaesup/component/inner/common/type.d.ts +2 -1
- 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/passive/airplane/index.d.ts +2 -1
- package/dist/gaesup/component/passive/airplane/index.js +1 -1
- package/dist/gaesup/component/passive/character/index.d.ts +2 -0
- package/dist/gaesup/component/passive/character/index.js +2 -2
- package/dist/gaesup/component/passive/vehicle/index.d.ts +2 -1
- package/dist/gaesup/component/passive/vehicle/index.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -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,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,4 +1,5 @@
|
|
|
1
1
|
import { refsType } from "../../../controller/type";
|
|
2
|
+
import { RigidBodyTypeString } from "@react-three/rapier";
|
|
2
3
|
import { ReactNode, Ref } from "react";
|
|
3
4
|
import * as THREE from "three";
|
|
4
5
|
import { Object3D, Object3DEventMap } from "three";
|
|
@@ -15,7 +16,7 @@ export type characterColliderType = {
|
|
|
15
16
|
radius: number;
|
|
16
17
|
diameter: number;
|
|
17
18
|
};
|
|
18
|
-
export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, positionLerp, }: {
|
|
19
|
+
export declare function CharacterInnerRef({ children, refs, urls, position, euler, currentAnimation, positionLerp, type, }: {
|
|
19
20
|
children: ReactNode;
|
|
20
21
|
refs: Partial<refsType>;
|
|
21
22
|
urls: urlsType;
|
|
@@ -24,4 +25,5 @@ export declare function CharacterInnerRef({ children, refs, urls, position, eule
|
|
|
24
25
|
animationRef?: Ref<Object3D<Object3DEventMap>>;
|
|
25
26
|
currentAnimation?: string;
|
|
26
27
|
positionLerp?: number;
|
|
28
|
+
type?: RigidBodyTypeString;
|
|
27
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,4 @@
|
|
|
1
|
-
import { CollisionEnterPayload, RapierRigidBody } from "@react-three/rapier";
|
|
1
|
+
import { CollisionEnterPayload, RapierRigidBody, RigidBodyTypeString } from "@react-three/rapier";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import * as THREE from "three";
|
|
4
4
|
export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
@@ -11,4 +11,5 @@ export declare const RigidBodyRef: import("react").ForwardRefExoticComponent<{
|
|
|
11
11
|
};
|
|
12
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
13
13
|
positionLerp?: number;
|
|
14
|
+
type?: RigidBodyTypeString;
|
|
14
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,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
3
|
import * as THREE from "three";
|
|
4
4
|
import { refsType } from "../../../controller/type";
|
|
5
5
|
import { urlsType } from "../../../world/context/type";
|
|
@@ -18,4 +18,5 @@ export type refPropsType = {
|
|
|
18
18
|
};
|
|
19
19
|
currentAnimation?: string;
|
|
20
20
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
21
|
+
type?: RigidBodyTypeString;
|
|
21
22
|
};
|
|
@@ -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,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
3
|
import * as THREE from "three";
|
|
4
4
|
import { urlsType } from "../../../world/context/type";
|
|
5
5
|
export type passiveAirplanePropsType = {
|
|
@@ -10,5 +10,6 @@ export type passiveAirplanePropsType = {
|
|
|
10
10
|
offset?: THREE.Vector3;
|
|
11
11
|
children?: React.ReactNode;
|
|
12
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
13
14
|
};
|
|
14
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,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { RigidBodyTypeString } from "@react-three/rapier";
|
|
2
3
|
import * as THREE from "three";
|
|
3
4
|
import { urlsType } from "../../../world/context/type";
|
|
4
5
|
export type passiveCharacterPropsType = {
|
|
@@ -9,5 +10,6 @@ export type passiveCharacterPropsType = {
|
|
|
9
10
|
gravityScale?: number;
|
|
10
11
|
children?: React.ReactNode;
|
|
11
12
|
positionLerp?: number;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
12
14
|
};
|
|
13
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,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { CollisionEnterPayload } from "@react-three/rapier";
|
|
2
|
+
import { CollisionEnterPayload, RigidBodyTypeString } from "@react-three/rapier";
|
|
3
3
|
import * as THREE from "three";
|
|
4
4
|
import { urlsType } from "../../../world/context/type";
|
|
5
5
|
export type passiveVehiclePropsType = {
|
|
@@ -10,5 +10,6 @@ export type passiveVehiclePropsType = {
|
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
offset?: THREE.Vector3;
|
|
12
12
|
onCollisionEnter?: (e: CollisionEnterPayload) => Promise<void>;
|
|
13
|
+
type?: RigidBodyTypeString;
|
|
13
14
|
};
|
|
14
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
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ export { ZoomButton } from "./gaesup/tools/zoomButton";
|
|
|
17
17
|
export { InnerHtml } from "./gaesup/utils/innerHtml";
|
|
18
18
|
export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
|
|
19
19
|
export { GaesupWorld } from "./gaesup/world";
|
|
20
|
+
export * as useClicker from "./gaesup/hooks/useClicker";
|
|
20
21
|
export { useFocus } from "./gaesup/hooks/useFocus";
|
|
21
22
|
export { useGaesupAnimation } from "./gaesup/hooks/useGaesupAnimation";
|
|
22
23
|
export { useGaesupController } from "./gaesup/hooks/useGaesupController";
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ export { ZoomButton } from "./gaesup/tools/zoomButton";
|
|
|
17
17
|
export { InnerHtml } from "./gaesup/utils/innerHtml";
|
|
18
18
|
export { Elr, Qt, V3, V30, V31 } from "./gaesup/utils/vector";
|
|
19
19
|
export { GaesupWorld } from "./gaesup/world";
|
|
20
|
+
export * as useClicker from "./gaesup/hooks/useClicker";
|
|
20
21
|
export { useFocus } from "./gaesup/hooks/useFocus";
|
|
21
22
|
export { useGaesupAnimation } from "./gaesup/hooks/useGaesupAnimation";
|
|
22
23
|
export { useGaesupController } from "./gaesup/hooks/useGaesupController";
|