@react-three/viverse 0.1.12 → 0.1.14
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 +3 -3
- package/dist/character.d.ts +8 -1
- package/dist/character.js +11 -5
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ npm install three @react-three/fiber @react-three/viverse
|
|
|
30
30
|
import { createRoot } from 'react-dom/client'
|
|
31
31
|
import { Sky } from '@react-three/drei'
|
|
32
32
|
import { Canvas } from '@react-three/fiber'
|
|
33
|
-
import { Viverse, SimpleCharacter,
|
|
33
|
+
import { Viverse, SimpleCharacter, BvhPhysicsBody, PrototypeBox } from '@react-three/viverse'
|
|
34
34
|
|
|
35
35
|
createRoot(document.getElementById('root')!).render(
|
|
36
36
|
<Canvas shadows>
|
|
@@ -39,9 +39,9 @@ createRoot(document.getElementById('root')!).render(
|
|
|
39
39
|
<directionalLight intensity={1.2} position={[5, 10, 10]} castShadow />
|
|
40
40
|
<ambientLight intensity={1} />
|
|
41
41
|
<SimpleCharacter />
|
|
42
|
-
<
|
|
42
|
+
<BvhPhysicsBody>
|
|
43
43
|
<PrototypeBox scale={[10, 1, 15]} position={[0, -0.5, 0]} />
|
|
44
|
-
</
|
|
44
|
+
</BvhPhysicsBody>
|
|
45
45
|
</Viverse>
|
|
46
46
|
</Canvas>,
|
|
47
47
|
)
|
package/dist/character.d.ts
CHANGED
|
@@ -20,13 +20,20 @@ export declare const SimpleCharacter: import("react").ForwardRefExoticComponent<
|
|
|
20
20
|
useViverseAvatar?: boolean;
|
|
21
21
|
children?: ReactNode;
|
|
22
22
|
} & import("@react-three/fiber/dist/declarations/src/core/utils.js").Mutable<import("@react-three/fiber/dist/declarations/src/core/utils.js").Overwrite<Partial<import("@react-three/fiber/dist/declarations/src/core/utils.js").Overwrite<Group<import("three").Object3DEventMap>, import("@react-three/fiber").MathProps<Group<import("three").Object3DEventMap>> & import("@react-three/fiber").ReactProps<Group<import("three").Object3DEventMap>> & Partial<import("@react-three/fiber").EventHandlers>>>, Omit<import("@react-three/fiber").InstanceProps<Group<import("three").Object3DEventMap>, typeof Group>, "object">>>, "ref"> & import("react").RefAttributes<Group<import("three").Object3DEventMap>>>;
|
|
23
|
+
/**
|
|
24
|
+
* @deprecated use <BvhPhysicsBody kinematic={false} /> instead (kinematic={false} can be skipped as its the default)
|
|
25
|
+
*/
|
|
26
|
+
export declare const FixedBvhPhysicsBody: import("react").ForwardRefExoticComponent<{
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
} & import("react").RefAttributes<Object3D<import("three").Object3DEventMap>>>;
|
|
23
29
|
/**
|
|
24
30
|
* allows to add all children as static (non-moving) objects to the bvh physics world
|
|
25
31
|
* @requires that the inner content is not dynamic
|
|
26
32
|
* do not wrap the content inside in a suspense!
|
|
27
33
|
*/
|
|
28
|
-
export declare const
|
|
34
|
+
export declare const BvhPhysicsBody: import("react").ForwardRefExoticComponent<{
|
|
29
35
|
children?: ReactNode;
|
|
36
|
+
kinematic?: boolean;
|
|
30
37
|
} & import("react").RefAttributes<Object3D<import("three").Object3DEventMap>>>;
|
|
31
38
|
export declare function CharacterModelBone({ bone, children }: {
|
|
32
39
|
bone: VRMHumanBoneName;
|
package/dist/character.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { VRM } from '@pixiv/three-vrm';
|
|
3
3
|
import { BvhPhysicsWorld as BvhPhysicsWorldImpl, SimpleCharacter as SimpleCharacterImpl, preloadSimpleCharacterAssets, simpleCharacterAnimationNames, InputSystem, LocomotionKeyboardInput, PointerCaptureInput, } from '@pmndrs/viverse';
|
|
4
4
|
import { useFrame, useThree, extend, createPortal } from '@react-three/fiber';
|
|
@@ -85,12 +85,18 @@ export const SimpleCharacter = forwardRef(({ children, useViverseAvatar = true,
|
|
|
85
85
|
useFrame((_, delta) => internalRef.current?.update(delta));
|
|
86
86
|
return (_jsx("simpleCharacterImpl", { ...groupProps, args: [camera, world, domElement, currentOptions], ref: internalRef, children: _jsx(CharacterModelStoreContext.Provider, { value: store, children: children }) }));
|
|
87
87
|
});
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated use <BvhPhysicsBody kinematic={false} /> instead (kinematic={false} can be skipped as its the default)
|
|
90
|
+
*/
|
|
91
|
+
export const FixedBvhPhysicsBody = forwardRef(({ children }, ref) => {
|
|
92
|
+
return _jsxs(BvhPhysicsBody, { children: [" ", children] });
|
|
93
|
+
});
|
|
88
94
|
/**
|
|
89
95
|
* allows to add all children as static (non-moving) objects to the bvh physics world
|
|
90
96
|
* @requires that the inner content is not dynamic
|
|
91
97
|
* do not wrap the content inside in a suspense!
|
|
92
98
|
*/
|
|
93
|
-
export const
|
|
99
|
+
export const BvhPhysicsBody = forwardRef(({ children, kinematic = false }, ref) => {
|
|
94
100
|
const world = useContext(BvhPhyiscsWorldContext);
|
|
95
101
|
if (world == null) {
|
|
96
102
|
throw new Error('FixedPhysicsBody must be used within a BvhPhysicsWorld component');
|
|
@@ -101,9 +107,9 @@ export const FixedBvhPhysicsBody = forwardRef(({ children }, ref) => {
|
|
|
101
107
|
if (body == null) {
|
|
102
108
|
return;
|
|
103
109
|
}
|
|
104
|
-
world.addBody(body,
|
|
105
|
-
return () => world.
|
|
106
|
-
}, [world]);
|
|
110
|
+
world.addBody(body, kinematic);
|
|
111
|
+
return () => world.removeBody(body);
|
|
112
|
+
}, [world, kinematic]);
|
|
107
113
|
useImperativeHandle(ref, () => internalRef.current, []);
|
|
108
114
|
return _jsx("group", { ref: internalRef, children: children });
|
|
109
115
|
});
|
package/package.json
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@pixiv/three-vrm": "^3.4.2",
|
|
29
29
|
"zustand": "^5.0.6",
|
|
30
30
|
"@react-three/xr": "^6.6.20",
|
|
31
|
-
"@pmndrs/viverse": "^0.1.
|
|
31
|
+
"@pmndrs/viverse": "^0.1.14"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"@react-three/fiber": "*"
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/react": "^19.1.8",
|
|
40
40
|
"react": "^19.1.0"
|
|
41
41
|
},
|
|
42
|
-
"version": "0.1.
|
|
42
|
+
"version": "0.1.14",
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsc",
|
|
45
45
|
"check:prettier": "prettier --check src",
|