@react-three/viverse 0.1.10 → 0.1.12

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 CHANGED
@@ -67,8 +67,12 @@ Get started with **[building a simple game](https://pmndrs.github.io/viverse/tut
67
67
 
68
68
  > No Problem
69
69
 
70
- Check out how to build games using @pmndrs/viverse and only [vanilla three.js](https://pmndrs.github.io/viverse/without-react).
70
+ Check out how to build games using @pmndrs/viverse and only [vanilla three.js](https://pmndrs.github.io/viverse/without-react/introduction).
71
71
 
72
72
  ## Acknowledgments
73
73
 
74
- This project would not be possible without the default model and default animations made by [Quaternius](https://quaternius.com/), the prototype texture from [kenney.nl](https://www.kenney.nl/), the [three-vrm project](https://github.com/pixiv/three-vrm) from the [pixiv team](https://github.com/pixiv), [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) from [Garrett Johnson](https://github.com/gkjohnson) and is based on prior work from [Felix Zhang](https://github.com/felixtrz) and [Erdong Chen](https://github.com/ErdongChen-Andrew)!
74
+ This project would not be possible without the default model and default animations made by [Quaternius](https://quaternius.com/), the prototype texture from [kenney.nl](https://www.kenney.nl/), the [three-vrm project](https://github.com/pixiv/three-vrm) from the [pixiv team](https://github.com/pixiv), [three-mesh-bvh](https://github.com/gkjohnson/three-mesh-bvh) from [Garrett Johnson](https://github.com/gkjohnson) and is based on prior work from [Felix Zhang](https://github.com/felixtrz) and [Erdong Chen](https://github.com/ErdongChen-Andrew)!
75
+
76
+ ## Sponsoring
77
+
78
+ The development of this library was sponsored by HTC Viverse.
@@ -16,10 +16,10 @@ export declare function BvhPhysicsWorld({ children }: {
16
16
  /**
17
17
  * creates a simple character controller supporting running, walking, and jumping with a default avatar and animations with can be configutred
18
18
  */
19
- export declare const SimpleCharacter: import("react").ForwardRefExoticComponent<SimpleCharacterOptions & {
19
+ export declare const SimpleCharacter: import("react").ForwardRefExoticComponent<Omit<SimpleCharacterOptions & {
20
20
  useViverseAvatar?: boolean;
21
21
  children?: ReactNode;
22
- } & import("react").RefAttributes<Group<import("three").Object3DEventMap>>>;
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
23
  /**
24
24
  * allows to add all children as static (non-moving) objects to the bvh physics world
25
25
  * @requires that the inner content is not dynamic
package/dist/character.js CHANGED
@@ -20,7 +20,7 @@ const PreloadSimpleCharacterAssetsSymbol = Symbol('preload-simple-character-asse
20
20
  /**
21
21
  * creates a simple character controller supporting running, walking, and jumping with a default avatar and animations with can be configutred
22
22
  */
23
- export const SimpleCharacter = forwardRef(({ children, input, useViverseAvatar = true, ...options }, ref) => {
23
+ export const SimpleCharacter = forwardRef(({ children, useViverseAvatar = true, input, movement, model, physics, cameraBehavior, animation, ...groupProps }, ref) => {
24
24
  const avatar = useViverseActiveAvatar();
25
25
  const world = useContext(BvhPhyiscsWorldContext);
26
26
  if (world == null) {
@@ -29,14 +29,17 @@ export const SimpleCharacter = forwardRef(({ children, input, useViverseAvatar =
29
29
  const camera = useThree((s) => s.camera);
30
30
  const domElement = useThree((s) => s.gl.domElement);
31
31
  const newOptions = {
32
- ...options,
33
- model: options.model != false && avatar != null && useViverseAvatar
32
+ movement,
33
+ physics,
34
+ cameraBehavior,
35
+ animation,
36
+ model: model != false && avatar != null && useViverseAvatar
34
37
  ? {
35
38
  type: avatar.vrmUrl != null ? 'vrm' : undefined,
36
39
  url: avatar?.vrmUrl,
37
- ...(options.model === true ? undefined : options.model),
40
+ ...(model === true ? undefined : model),
38
41
  }
39
- : options.model,
42
+ : model,
40
43
  };
41
44
  const preloadSimpleCharacterAssetsKeys = [
42
45
  JSON.stringify(newOptions.model),
@@ -80,7 +83,7 @@ export const SimpleCharacter = forwardRef(({ children, input, useViverseAvatar =
80
83
  // eslint-disable-next-line react-hooks/exhaustive-deps
81
84
  useImperativeHandle(ref, () => internalRef.current, [camera, world, domElement, currentOptions]);
82
85
  useFrame((_, delta) => internalRef.current?.update(delta));
83
- return (_jsx("simpleCharacterImpl", { args: [camera, world, domElement, currentOptions], ref: internalRef, children: _jsx(CharacterModelStoreContext.Provider, { value: store, children: children }) }));
86
+ return (_jsx("simpleCharacterImpl", { ...groupProps, args: [camera, world, domElement, currentOptions], ref: internalRef, children: _jsx(CharacterModelStoreContext.Provider, { value: store, children: children }) }));
84
87
  });
85
88
  /**
86
89
  * allows to add all children as static (non-moving) objects to the bvh physics world
@@ -98,7 +101,7 @@ export const FixedBvhPhysicsBody = forwardRef(({ children }, ref) => {
98
101
  if (body == null) {
99
102
  return;
100
103
  }
101
- world.addFixedBody(body);
104
+ world.addBody(body, false);
102
105
  return () => world.removeFixedBody(body);
103
106
  }, [world]);
104
107
  useImperativeHandle(ref, () => internalRef.current, []);
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.10"
31
+ "@pmndrs/viverse": "^0.1.12"
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.10",
42
+ "version": "0.1.12",
43
43
  "scripts": {
44
44
  "build": "tsc",
45
45
  "check:prettier": "prettier --check src",