@react-three/rapier 0.7.2 → 0.7.3

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.
@@ -15,7 +15,7 @@ export interface RigidBodyState {
15
15
  scale: Vector3;
16
16
  isSleeping: boolean;
17
17
  }
18
- export declare type RigidBodyStateMap = Map<RigidBody['handle'], RigidBodyState>;
18
+ export declare type RigidBodyStateMap = Map<RigidBody["handle"], RigidBodyState>;
19
19
  export interface ColliderState {
20
20
  collider: Collider;
21
21
  object: Object3D;
@@ -25,7 +25,7 @@ export interface ColliderState {
25
25
  */
26
26
  worldParent: Object3D;
27
27
  }
28
- export declare type ColliderStateMap = Map<Collider['handle'], ColliderState>;
28
+ export declare type ColliderStateMap = Map<Collider["handle"], ColliderState>;
29
29
  export interface RapierContext {
30
30
  rapier: typeof Rapier;
31
31
  world: WorldApi;
@@ -1,8 +1,8 @@
1
1
  export * from "./types";
2
2
  export type { RigidBodyApi, WorldApi, InstancedRigidBodyApi } from "./api";
3
- export type { RigidBodyProps } from './RigidBody';
4
- export type { InstancedRigidBodiesProps } from './InstancedRigidBodies';
5
- export type { CylinderColliderProps, BallColliderProps, CapsuleColliderProps, ConeColliderProps, ConvexHullColliderProps, CuboidColliderProps, HeightfieldColliderProps, RoundCuboidColliderProps, TrimeshColliderProps } from './AnyCollider';
3
+ export type { RigidBodyProps } from "./RigidBody";
4
+ export type { InstancedRigidBodiesProps } from "./InstancedRigidBodies";
5
+ export type { CylinderColliderProps, BallColliderProps, CapsuleColliderProps, ConeColliderProps, ConvexHullColliderProps, CuboidColliderProps, HeightfieldColliderProps, RoundCuboidColliderProps, TrimeshColliderProps } from "./AnyCollider";
6
6
  export { Physics } from "./Physics";
7
7
  export { RigidBody } from "./RigidBody";
8
8
  export { MeshCollider } from "./MeshCollider";
@@ -118,19 +118,19 @@ export interface UseColliderOptions<ColliderArgs extends Array<unknown>> {
118
118
  /**
119
119
  * The position of this collider relative to the rigid body
120
120
  */
121
- position?: Object3DProps['position'];
121
+ position?: Object3DProps["position"];
122
122
  /**
123
123
  * The rotation of this collider relative to the rigid body
124
124
  */
125
- rotation?: Object3DProps['rotation'];
125
+ rotation?: Object3DProps["rotation"];
126
126
  /**
127
127
  * The rotation, as a Quaternion, of this collider relative to the rigid body
128
128
  */
129
- quaternion?: Object3DProps['quaternion'];
129
+ quaternion?: Object3DProps["quaternion"];
130
130
  /**
131
131
  * The scale of this collider relative to the rigid body
132
132
  */
133
- scale?: Object3DProps['scale'];
133
+ scale?: Object3DProps["scale"];
134
134
  /**
135
135
  * Callback when this collider collides with another collider.
136
136
  */
@@ -219,11 +219,11 @@ export interface UseRigidBodyOptions extends ColliderProps {
219
219
  /**
220
220
  * Initial position of the RigidBody
221
221
  */
222
- position?: Object3DProps['position'];
222
+ position?: Object3DProps["position"];
223
223
  /**
224
224
  * Initial rotation of the RigidBody
225
225
  */
226
- rotation?: Object3DProps['rotation'];
226
+ rotation?: Object3DProps["rotation"];
227
227
  /**
228
228
  * Automatically generate colliders based on meshes inside this
229
229
  * rigid body.
@@ -250,8 +250,8 @@ export interface UseRigidBodyOptions extends ColliderProps {
250
250
  */
251
251
  collisionGroups?: InteractionGroups;
252
252
  /**
253
- * The default solver groups bitmask for all colliders in this rigid body.
254
- * Can be customized per-collider.
253
+ * The default solver groups bitmask for all colliders in this rigid body.
254
+ * Can be customized per-collider.
255
255
  */
256
256
  solverGroups?: InteractionGroups;
257
257
  onSleep?(): void;
@@ -275,7 +275,7 @@ export interface UseRigidBodyOptions extends ColliderProps {
275
275
  /**
276
276
  * Passed down to the object3d representing this collider.
277
277
  */
278
- userData?: Object3DProps['userData'];
278
+ userData?: Object3DProps["userData"];
279
279
  }
280
280
  export declare type SphericalJointParams = [
281
281
  body1Anchor: Vector3Array,
@@ -7,7 +7,6 @@ var React = require('react');
7
7
  var useAsset = require('use-asset');
8
8
  var fiber = require('@react-three/fiber');
9
9
  var three = require('three');
10
- var MathUtils = require('three/src/math/MathUtils');
11
10
  var threeStdlib = require('three-stdlib');
12
11
 
13
12
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -277,9 +276,9 @@ const Physics = ({
277
276
  /**
278
277
  * Fixed timeStep simulation progression
279
278
  * @see https://gafferongames.com/post/fix_your_timestep/
280
- */
279
+ */
281
280
 
282
- const clampedDelta = MathUtils.clamp(dt, 0, 0.2);
281
+ const clampedDelta = three.MathUtils.clamp(dt, 0, 0.2);
283
282
 
284
283
  if (timeStepVariable) {
285
284
  world.timestep = clampedDelta;
@@ -7,7 +7,6 @@ var React = require('react');
7
7
  var useAsset = require('use-asset');
8
8
  var fiber = require('@react-three/fiber');
9
9
  var three = require('three');
10
- var MathUtils = require('three/src/math/MathUtils');
11
10
  var threeStdlib = require('three-stdlib');
12
11
 
13
12
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
@@ -277,9 +276,9 @@ const Physics = ({
277
276
  /**
278
277
  * Fixed timeStep simulation progression
279
278
  * @see https://gafferongames.com/post/fix_your_timestep/
280
- */
279
+ */
281
280
 
282
- const clampedDelta = MathUtils.clamp(dt, 0, 0.2);
281
+ const clampedDelta = three.MathUtils.clamp(dt, 0, 0.2);
283
282
 
284
283
  if (timeStepVariable) {
285
284
  world.timestep = clampedDelta;
@@ -3,8 +3,7 @@ export { CoefficientCombineRule, Collider as RapierCollider, RigidBody as Rapier
3
3
  import React, { useState, useEffect, useRef, useMemo, createContext, useContext, memo, forwardRef, useImperativeHandle, useLayoutEffect } from 'react';
4
4
  import { useAsset } from 'use-asset';
5
5
  import { useFrame } from '@react-three/fiber';
6
- import { Quaternion, Euler, Vector3, Object3D, Matrix4, InstancedMesh, MeshBasicMaterial, Color, PlaneGeometry, ConeBufferGeometry, CapsuleBufferGeometry, CylinderBufferGeometry, BufferGeometry, BufferAttribute, SphereBufferGeometry, BoxBufferGeometry, DynamicDrawUsage } from 'three';
7
- import { clamp } from 'three/src/math/MathUtils';
6
+ import { Quaternion, Euler, Vector3, Object3D, Matrix4, MathUtils, InstancedMesh, MeshBasicMaterial, Color, PlaneGeometry, ConeBufferGeometry, CapsuleBufferGeometry, CylinderBufferGeometry, BufferGeometry, BufferAttribute, SphereBufferGeometry, BoxBufferGeometry, DynamicDrawUsage } from 'three';
8
7
  import { mergeVertices, RoundedBoxGeometry } from 'three-stdlib';
9
8
 
10
9
  const _quaternion = new Quaternion();
@@ -252,9 +251,9 @@ const Physics = ({
252
251
  /**
253
252
  * Fixed timeStep simulation progression
254
253
  * @see https://gafferongames.com/post/fix_your_timestep/
255
- */
254
+ */
256
255
 
257
- const clampedDelta = clamp(dt, 0, 0.2);
256
+ const clampedDelta = MathUtils.clamp(dt, 0, 0.2);
258
257
 
259
258
  if (timeStepVariable) {
260
259
  world.timestep = clampedDelta;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-three/rapier",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "source": "src/index.ts",
5
5
  "main": "dist/react-three-rapier.cjs.js",
6
6
  "module": "dist/react-three-rapier.esm.js",
package/readme.md CHANGED
@@ -141,7 +141,7 @@ const Scene = () => {
141
141
  instancedApi.at(40).applyImpulse({ x: 0, y: 10, z: 0 });
142
142
 
143
143
  // Or update all instances as if they were in an array
144
- instancedApi.forEach(api => {
144
+ instancedApi.forEach((api) => {
145
145
  api.applyImpulse({ x: 0, y: 10, z: 0 });
146
146
  });
147
147
  }, []);
@@ -239,10 +239,10 @@ You may also subscribe to collision events on individual Colliders:
239
239
 
240
240
  ```tsx
241
241
  <CuboidCollider
242
- onCollisionEnter={payload => {
242
+ onCollisionEnter={(payload) => {
243
243
  /* ... */
244
244
  }}
245
- onCollisionExit={payload => {
245
+ onCollisionExit={(payload) => {
246
246
  /* ... */
247
247
  }}
248
248
  />