@react-three/rapier 0.1.1 → 0.1.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/CHANGELOG.md
CHANGED
@@ -4,6 +4,7 @@ import { RigidBodyAutoCollider, Vector3Array } from "./types";
|
|
4
4
|
export interface RapierContext {
|
5
5
|
RAPIER: typeof Rapier;
|
6
6
|
world: Rapier.World;
|
7
|
+
colliders: RigidBodyAutoCollider;
|
7
8
|
stepFuncs: Array<() => void>;
|
8
9
|
}
|
9
10
|
export declare const RapierContext: React.Context<RapierContext | undefined>;
|
@@ -314,7 +314,8 @@ const useCollider = (body, options = {}) => {
|
|
314
314
|
const useRigidBody = options => {
|
315
315
|
const {
|
316
316
|
RAPIER,
|
317
|
-
world
|
317
|
+
world,
|
318
|
+
colliders
|
318
319
|
} = useRapier();
|
319
320
|
const ref = React.useRef(); // Create rigidbody
|
320
321
|
|
@@ -339,7 +340,7 @@ const useRigidBody = options => {
|
|
339
340
|
}, []); // Setup
|
340
341
|
|
341
342
|
React.useEffect(() => {
|
342
|
-
var _ref$current$parent, _options$colliders;
|
343
|
+
var _ref$current$parent, _ref, _options$colliders;
|
343
344
|
|
344
345
|
if (!ref.current) {
|
345
346
|
ref.current = new three.Object3D();
|
@@ -372,7 +373,7 @@ const useRigidBody = options => {
|
|
372
373
|
}, false);
|
373
374
|
rigidBody.resetForces(false);
|
374
375
|
rigidBody.resetTorques(false);
|
375
|
-
const colliderSetting = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : false;
|
376
|
+
const colliderSetting = (_ref = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : colliders) !== null && _ref !== void 0 ? _ref : false;
|
376
377
|
const autoColliders = colliderSetting !== false ? createCollidersFromChildren(ref.current, rigidBody, colliderSetting, world) : [];
|
377
378
|
return () => {
|
378
379
|
world.removeRigidBody(rigidBody);
|
@@ -314,7 +314,8 @@ const useCollider = (body, options = {}) => {
|
|
314
314
|
const useRigidBody = options => {
|
315
315
|
const {
|
316
316
|
RAPIER,
|
317
|
-
world
|
317
|
+
world,
|
318
|
+
colliders
|
318
319
|
} = useRapier();
|
319
320
|
const ref = React.useRef(); // Create rigidbody
|
320
321
|
|
@@ -339,7 +340,7 @@ const useRigidBody = options => {
|
|
339
340
|
}, []); // Setup
|
340
341
|
|
341
342
|
React.useEffect(() => {
|
342
|
-
var _ref$current$parent, _options$colliders;
|
343
|
+
var _ref$current$parent, _ref, _options$colliders;
|
343
344
|
|
344
345
|
if (!ref.current) {
|
345
346
|
ref.current = new three.Object3D();
|
@@ -372,7 +373,7 @@ const useRigidBody = options => {
|
|
372
373
|
}, false);
|
373
374
|
rigidBody.resetForces(false);
|
374
375
|
rigidBody.resetTorques(false);
|
375
|
-
const colliderSetting = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : false;
|
376
|
+
const colliderSetting = (_ref = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : colliders) !== null && _ref !== void 0 ? _ref : false;
|
376
377
|
const autoColliders = colliderSetting !== false ? createCollidersFromChildren(ref.current, rigidBody, colliderSetting, world) : [];
|
377
378
|
return () => {
|
378
379
|
world.removeRigidBody(rigidBody);
|
@@ -289,7 +289,8 @@ const useCollider = (body, options = {}) => {
|
|
289
289
|
const useRigidBody = options => {
|
290
290
|
const {
|
291
291
|
RAPIER,
|
292
|
-
world
|
292
|
+
world,
|
293
|
+
colliders
|
293
294
|
} = useRapier();
|
294
295
|
const ref = useRef(); // Create rigidbody
|
295
296
|
|
@@ -314,7 +315,7 @@ const useRigidBody = options => {
|
|
314
315
|
}, []); // Setup
|
315
316
|
|
316
317
|
useEffect(() => {
|
317
|
-
var _ref$current$parent, _options$colliders;
|
318
|
+
var _ref$current$parent, _ref, _options$colliders;
|
318
319
|
|
319
320
|
if (!ref.current) {
|
320
321
|
ref.current = new Object3D();
|
@@ -347,7 +348,7 @@ const useRigidBody = options => {
|
|
347
348
|
}, false);
|
348
349
|
rigidBody.resetForces(false);
|
349
350
|
rigidBody.resetTorques(false);
|
350
|
-
const colliderSetting = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : false;
|
351
|
+
const colliderSetting = (_ref = (_options$colliders = options === null || options === void 0 ? void 0 : options.colliders) !== null && _options$colliders !== void 0 ? _options$colliders : colliders) !== null && _ref !== void 0 ? _ref : false;
|
351
352
|
const autoColliders = colliderSetting !== false ? createCollidersFromChildren(ref.current, rigidBody, colliderSetting, world) : [];
|
352
353
|
return () => {
|
353
354
|
world.removeRigidBody(rigidBody);
|