@react-three/rapier 0.6.5 → 0.6.6
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.
@@ -7,4 +7,4 @@ export interface InstancedRigidBodiesProps extends Omit<RigidBodyProps, "positio
|
|
7
7
|
rotations?: Vector3Array[];
|
8
8
|
scales?: Vector3Array[];
|
9
9
|
}
|
10
|
-
export declare const InstancedRigidBodies: React.ForwardRefExoticComponent<InstancedRigidBodiesProps & React.RefAttributes<InstancedRigidBodyApi>>;
|
10
|
+
export declare const InstancedRigidBodies: React.ForwardRefExoticComponent<Pick<InstancedRigidBodiesProps, "type" | "canSleep" | "linearDamping" | "angularDamping" | "linearVelocity" | "angularVelocity" | "gravityScale" | "ccd" | "colliders" | "friction" | "restitution" | "onSleep" | "onWake" | "lockRotations" | "lockTranslations" | "enabledRotations" | "enabledTranslations" | "children" | "quaternion" | "attach" | "args" | "key" | "onUpdate" | "up" | "scale" | "matrix" | "layers" | "dispose" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "visible" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onClick" | "onContextMenu" | "onDoubleClick" | "onPointerUp" | "onPointerDown" | "onPointerOver" | "onPointerOut" | "onPointerEnter" | "onPointerLeave" | "onPointerMove" | "onPointerMissed" | "onPointerCancel" | "onWheel" | "positions" | "rotations" | "scales"> & React.RefAttributes<InstancedRigidBodyApi>>;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import React, { MutableRefObject, RefObject } from "react";
|
2
2
|
import { ReactNode } from "react";
|
3
3
|
import { Object3D } from "three";
|
4
|
+
import { Object3DProps } from "@react-three/fiber";
|
4
5
|
import { InstancedRigidBodyApi } from "./api";
|
5
6
|
import { InstancedRigidBodiesProps } from "./InstancedRigidBodies";
|
6
7
|
import { RigidBodyApi, UseRigidBodyOptions } from "./types";
|
@@ -16,7 +17,7 @@ export declare const useRigidBodyContext: () => {
|
|
16
17
|
hasCollisionEvents: boolean;
|
17
18
|
options: UseRigidBodyOptions | InstancedRigidBodiesProps;
|
18
19
|
};
|
19
|
-
export interface RigidBodyProps extends UseRigidBodyOptions {
|
20
|
+
export interface RigidBodyProps extends UseRigidBodyOptions, Omit<Object3DProps, 'type' | 'position' | 'rotation'> {
|
20
21
|
children?: ReactNode;
|
21
22
|
}
|
22
|
-
export declare const RigidBody: React.ForwardRefExoticComponent<RigidBodyProps & React.RefAttributes<import("./api").RigidBodyApi>>;
|
23
|
+
export declare const RigidBody: React.ForwardRefExoticComponent<Pick<RigidBodyProps, "type" | "canSleep" | "linearDamping" | "angularDamping" | "linearVelocity" | "angularVelocity" | "gravityScale" | "ccd" | "position" | "rotation" | "colliders" | "friction" | "restitution" | "onCollisionEnter" | "onCollisionExit" | "onSleep" | "onWake" | "lockRotations" | "lockTranslations" | "enabledRotations" | "enabledTranslations" | "children" | "quaternion" | "attach" | "args" | "key" | "onUpdate" | "up" | "scale" | "matrix" | "layers" | "dispose" | "id" | "uuid" | "name" | "parent" | "modelViewMatrix" | "normalMatrix" | "matrixWorld" | "matrixAutoUpdate" | "matrixWorldNeedsUpdate" | "visible" | "castShadow" | "receiveShadow" | "frustumCulled" | "renderOrder" | "animations" | "userData" | "customDepthMaterial" | "customDistanceMaterial" | "isObject3D" | "onBeforeRender" | "onAfterRender" | "applyMatrix4" | "applyQuaternion" | "setRotationFromAxisAngle" | "setRotationFromEuler" | "setRotationFromMatrix" | "setRotationFromQuaternion" | "rotateOnAxis" | "rotateOnWorldAxis" | "rotateX" | "rotateY" | "rotateZ" | "translateOnAxis" | "translateX" | "translateY" | "translateZ" | "localToWorld" | "worldToLocal" | "lookAt" | "add" | "remove" | "removeFromParent" | "clear" | "getObjectById" | "getObjectByName" | "getObjectByProperty" | "getWorldPosition" | "getWorldQuaternion" | "getWorldScale" | "getWorldDirection" | "raycast" | "traverse" | "traverseVisible" | "traverseAncestors" | "updateMatrix" | "updateMatrixWorld" | "updateWorldMatrix" | "toJSON" | "clone" | "copy" | "addEventListener" | "hasEventListener" | "removeEventListener" | "dispatchEvent" | "onClick" | "onContextMenu" | "onDoubleClick" | "onPointerUp" | "onPointerDown" | "onPointerOver" | "onPointerOut" | "onPointerEnter" | "onPointerLeave" | "onPointerMove" | "onPointerMissed" | "onPointerCancel" | "onWheel"> & React.RefAttributes<import("./api").RigidBodyApi>>;
|
@@ -7,6 +7,7 @@ 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 BufferGeometryUtils = require('three/examples/jsm/utils/BufferGeometryUtils');
|
10
11
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
12
13
|
|
@@ -244,7 +245,9 @@ const colliderDescFromGeometry = (geometry, colliders, scale, hasCollisionEvents
|
|
244
245
|
{
|
245
246
|
var _g$index;
|
246
247
|
|
247
|
-
const
|
248
|
+
const clonedGeometry = geometry.index ? geometry.clone() : BufferGeometryUtils.mergeVertices(geometry);
|
249
|
+
|
250
|
+
const _g = clonedGeometry.scale(scale.x, scale.y, scale.z);
|
248
251
|
|
249
252
|
desc = rapier3dCompat.ColliderDesc.trimesh(_g.attributes.position.array, (_g$index = _g.index) === null || _g$index === void 0 ? void 0 : _g$index.array);
|
250
253
|
}
|
@@ -537,8 +540,8 @@ const Physics = ({
|
|
537
540
|
// Collect previous state
|
538
541
|
world.bodies.forEach(b => {
|
539
542
|
previousTranslations[b.handle] = {
|
540
|
-
rotation: b.rotation(),
|
541
|
-
translation: b.translation()
|
543
|
+
rotation: rapierQuaternionToQuaternion(b.rotation()).normalize(),
|
544
|
+
translation: rapierVector3ToVector3(b.translation())
|
542
545
|
};
|
543
546
|
});
|
544
547
|
world.step(eventQueue);
|
@@ -576,8 +579,8 @@ const Physics = ({
|
|
576
579
|
let oldState = previousTranslations[rigidBody.handle];
|
577
580
|
let newTranslation = rapierVector3ToVector3(rigidBody.translation());
|
578
581
|
let newRotation = rapierQuaternionToQuaternion(rigidBody.rotation());
|
579
|
-
let interpolatedTranslation = oldState ?
|
580
|
-
let interpolatedRotation = oldState ?
|
582
|
+
let interpolatedTranslation = oldState ? oldState.translation.lerp(newTranslation, 1) : newTranslation;
|
583
|
+
let interpolatedRotation = oldState ? oldState.rotation.slerp(newRotation, interpolationAlpha) : newRotation;
|
581
584
|
state.setMatrix(_matrix4.compose(interpolatedTranslation, interpolatedRotation, state.worldScale).premultiply(state.invertedMatrixWorld));
|
582
585
|
|
583
586
|
if (state.mesh instanceof three.InstancedMesh) {
|
@@ -647,6 +650,24 @@ const Physics = ({
|
|
647
650
|
}, children);
|
648
651
|
};
|
649
652
|
|
653
|
+
function _extends() {
|
654
|
+
_extends = Object.assign || function (target) {
|
655
|
+
for (var i = 1; i < arguments.length; i++) {
|
656
|
+
var source = arguments[i];
|
657
|
+
|
658
|
+
for (var key in source) {
|
659
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
660
|
+
target[key] = source[key];
|
661
|
+
}
|
662
|
+
}
|
663
|
+
}
|
664
|
+
|
665
|
+
return target;
|
666
|
+
};
|
667
|
+
|
668
|
+
return _extends.apply(this, arguments);
|
669
|
+
}
|
670
|
+
|
650
671
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
651
672
|
if (source == null) return {};
|
652
673
|
var target = {};
|
@@ -913,7 +934,8 @@ const usePrismaticJoint = (body1, body2, [body1Anchor, body2Anchor, axis]) => {
|
|
913
934
|
return useImpulseJoint(body1, body2, rapier.JointData.prismatic(vectorArrayToVector3(body1Anchor), vectorArrayToVector3(body2Anchor), vectorArrayToVector3(axis)));
|
914
935
|
};
|
915
936
|
|
916
|
-
const _excluded$1 = ["children"]
|
937
|
+
const _excluded$1 = ["children"],
|
938
|
+
_excluded2 = ["type", "position", "rotation"];
|
917
939
|
const RigidBodyContext = /*#__PURE__*/React.createContext(undefined);
|
918
940
|
const useRigidBodyContext = () => React.useContext(RigidBodyContext); // RigidBody
|
919
941
|
|
@@ -924,6 +946,9 @@ const RigidBody = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
924
946
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
925
947
|
|
926
948
|
const [object, api] = useRigidBody(props);
|
949
|
+
|
950
|
+
const objectProps = _objectWithoutProperties(props, _excluded2);
|
951
|
+
|
927
952
|
React.useImperativeHandle(ref, () => api);
|
928
953
|
return /*#__PURE__*/React__default["default"].createElement(RigidBodyContext.Provider, {
|
929
954
|
value: {
|
@@ -932,9 +957,9 @@ const RigidBody = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
932
957
|
hasCollisionEvents: !!(props.onCollisionEnter || props.onCollisionExit),
|
933
958
|
options: props
|
934
959
|
}
|
935
|
-
}, /*#__PURE__*/React__default["default"].createElement("object3D", {
|
960
|
+
}, /*#__PURE__*/React__default["default"].createElement("object3D", _extends({
|
936
961
|
ref: object
|
937
|
-
}, children));
|
962
|
+
}, objectProps), children));
|
938
963
|
});
|
939
964
|
|
940
965
|
const MeshCollider = ({
|
@@ -1224,24 +1249,6 @@ const InstancedRigidBodies = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
1224
1249
|
}, props.children));
|
1225
1250
|
});
|
1226
1251
|
|
1227
|
-
function _extends() {
|
1228
|
-
_extends = Object.assign || function (target) {
|
1229
|
-
for (var i = 1; i < arguments.length; i++) {
|
1230
|
-
var source = arguments[i];
|
1231
|
-
|
1232
|
-
for (var key in source) {
|
1233
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1234
|
-
target[key] = source[key];
|
1235
|
-
}
|
1236
|
-
}
|
1237
|
-
}
|
1238
|
-
|
1239
|
-
return target;
|
1240
|
-
};
|
1241
|
-
|
1242
|
-
return _extends.apply(this, arguments);
|
1243
|
-
}
|
1244
|
-
|
1245
1252
|
const _excluded = ["children"];
|
1246
1253
|
|
1247
1254
|
const AnyCollider = _ref => {
|
@@ -7,6 +7,7 @@ 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 BufferGeometryUtils = require('three/examples/jsm/utils/BufferGeometryUtils');
|
10
11
|
|
11
12
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
12
13
|
|
@@ -244,7 +245,9 @@ const colliderDescFromGeometry = (geometry, colliders, scale, hasCollisionEvents
|
|
244
245
|
{
|
245
246
|
var _g$index;
|
246
247
|
|
247
|
-
const
|
248
|
+
const clonedGeometry = geometry.index ? geometry.clone() : BufferGeometryUtils.mergeVertices(geometry);
|
249
|
+
|
250
|
+
const _g = clonedGeometry.scale(scale.x, scale.y, scale.z);
|
248
251
|
|
249
252
|
desc = rapier3dCompat.ColliderDesc.trimesh(_g.attributes.position.array, (_g$index = _g.index) === null || _g$index === void 0 ? void 0 : _g$index.array);
|
250
253
|
}
|
@@ -537,8 +540,8 @@ const Physics = ({
|
|
537
540
|
// Collect previous state
|
538
541
|
world.bodies.forEach(b => {
|
539
542
|
previousTranslations[b.handle] = {
|
540
|
-
rotation: b.rotation(),
|
541
|
-
translation: b.translation()
|
543
|
+
rotation: rapierQuaternionToQuaternion(b.rotation()).normalize(),
|
544
|
+
translation: rapierVector3ToVector3(b.translation())
|
542
545
|
};
|
543
546
|
});
|
544
547
|
world.step(eventQueue);
|
@@ -576,8 +579,8 @@ const Physics = ({
|
|
576
579
|
let oldState = previousTranslations[rigidBody.handle];
|
577
580
|
let newTranslation = rapierVector3ToVector3(rigidBody.translation());
|
578
581
|
let newRotation = rapierQuaternionToQuaternion(rigidBody.rotation());
|
579
|
-
let interpolatedTranslation = oldState ?
|
580
|
-
let interpolatedRotation = oldState ?
|
582
|
+
let interpolatedTranslation = oldState ? oldState.translation.lerp(newTranslation, 1) : newTranslation;
|
583
|
+
let interpolatedRotation = oldState ? oldState.rotation.slerp(newRotation, interpolationAlpha) : newRotation;
|
581
584
|
state.setMatrix(_matrix4.compose(interpolatedTranslation, interpolatedRotation, state.worldScale).premultiply(state.invertedMatrixWorld));
|
582
585
|
|
583
586
|
if (state.mesh instanceof three.InstancedMesh) {
|
@@ -647,6 +650,24 @@ const Physics = ({
|
|
647
650
|
}, children);
|
648
651
|
};
|
649
652
|
|
653
|
+
function _extends() {
|
654
|
+
_extends = Object.assign || function (target) {
|
655
|
+
for (var i = 1; i < arguments.length; i++) {
|
656
|
+
var source = arguments[i];
|
657
|
+
|
658
|
+
for (var key in source) {
|
659
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
660
|
+
target[key] = source[key];
|
661
|
+
}
|
662
|
+
}
|
663
|
+
}
|
664
|
+
|
665
|
+
return target;
|
666
|
+
};
|
667
|
+
|
668
|
+
return _extends.apply(this, arguments);
|
669
|
+
}
|
670
|
+
|
650
671
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
651
672
|
if (source == null) return {};
|
652
673
|
var target = {};
|
@@ -913,7 +934,8 @@ const usePrismaticJoint = (body1, body2, [body1Anchor, body2Anchor, axis]) => {
|
|
913
934
|
return useImpulseJoint(body1, body2, rapier.JointData.prismatic(vectorArrayToVector3(body1Anchor), vectorArrayToVector3(body2Anchor), vectorArrayToVector3(axis)));
|
914
935
|
};
|
915
936
|
|
916
|
-
const _excluded$1 = ["children"]
|
937
|
+
const _excluded$1 = ["children"],
|
938
|
+
_excluded2 = ["type", "position", "rotation"];
|
917
939
|
const RigidBodyContext = /*#__PURE__*/React.createContext(undefined);
|
918
940
|
const useRigidBodyContext = () => React.useContext(RigidBodyContext); // RigidBody
|
919
941
|
|
@@ -924,6 +946,9 @@ const RigidBody = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
924
946
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
925
947
|
|
926
948
|
const [object, api] = useRigidBody(props);
|
949
|
+
|
950
|
+
const objectProps = _objectWithoutProperties(props, _excluded2);
|
951
|
+
|
927
952
|
React.useImperativeHandle(ref, () => api);
|
928
953
|
return /*#__PURE__*/React__default["default"].createElement(RigidBodyContext.Provider, {
|
929
954
|
value: {
|
@@ -932,9 +957,9 @@ const RigidBody = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
932
957
|
hasCollisionEvents: !!(props.onCollisionEnter || props.onCollisionExit),
|
933
958
|
options: props
|
934
959
|
}
|
935
|
-
}, /*#__PURE__*/React__default["default"].createElement("object3D", {
|
960
|
+
}, /*#__PURE__*/React__default["default"].createElement("object3D", _extends({
|
936
961
|
ref: object
|
937
|
-
}, children));
|
962
|
+
}, objectProps), children));
|
938
963
|
});
|
939
964
|
|
940
965
|
const MeshCollider = ({
|
@@ -1224,24 +1249,6 @@ const InstancedRigidBodies = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
1224
1249
|
}, props.children));
|
1225
1250
|
});
|
1226
1251
|
|
1227
|
-
function _extends() {
|
1228
|
-
_extends = Object.assign || function (target) {
|
1229
|
-
for (var i = 1; i < arguments.length; i++) {
|
1230
|
-
var source = arguments[i];
|
1231
|
-
|
1232
|
-
for (var key in source) {
|
1233
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1234
|
-
target[key] = source[key];
|
1235
|
-
}
|
1236
|
-
}
|
1237
|
-
}
|
1238
|
-
|
1239
|
-
return target;
|
1240
|
-
};
|
1241
|
-
|
1242
|
-
return _extends.apply(this, arguments);
|
1243
|
-
}
|
1244
|
-
|
1245
1252
|
const _excluded = ["children"];
|
1246
1253
|
|
1247
1254
|
const AnyCollider = _ref => {
|
@@ -4,6 +4,7 @@ import React, { useState, useEffect, useRef, useMemo, createContext, useContext,
|
|
4
4
|
import { useAsset } from 'use-asset';
|
5
5
|
import { useFrame } from '@react-three/fiber';
|
6
6
|
import { Quaternion, Euler, Vector3, Object3D, Matrix4, InstancedMesh, CylinderBufferGeometry, BufferGeometry, BufferAttribute, SphereBufferGeometry, BoxBufferGeometry, DynamicDrawUsage } from 'three';
|
7
|
+
import { mergeVertices } from 'three/examples/jsm/utils/BufferGeometryUtils';
|
7
8
|
|
8
9
|
const _quaternion = new Quaternion();
|
9
10
|
const _euler = new Euler();
|
@@ -219,7 +220,9 @@ const colliderDescFromGeometry = (geometry, colliders, scale, hasCollisionEvents
|
|
219
220
|
{
|
220
221
|
var _g$index;
|
221
222
|
|
222
|
-
const
|
223
|
+
const clonedGeometry = geometry.index ? geometry.clone() : mergeVertices(geometry);
|
224
|
+
|
225
|
+
const _g = clonedGeometry.scale(scale.x, scale.y, scale.z);
|
223
226
|
|
224
227
|
desc = ColliderDesc.trimesh(_g.attributes.position.array, (_g$index = _g.index) === null || _g$index === void 0 ? void 0 : _g$index.array);
|
225
228
|
}
|
@@ -512,8 +515,8 @@ const Physics = ({
|
|
512
515
|
// Collect previous state
|
513
516
|
world.bodies.forEach(b => {
|
514
517
|
previousTranslations[b.handle] = {
|
515
|
-
rotation: b.rotation(),
|
516
|
-
translation: b.translation()
|
518
|
+
rotation: rapierQuaternionToQuaternion(b.rotation()).normalize(),
|
519
|
+
translation: rapierVector3ToVector3(b.translation())
|
517
520
|
};
|
518
521
|
});
|
519
522
|
world.step(eventQueue);
|
@@ -551,8 +554,8 @@ const Physics = ({
|
|
551
554
|
let oldState = previousTranslations[rigidBody.handle];
|
552
555
|
let newTranslation = rapierVector3ToVector3(rigidBody.translation());
|
553
556
|
let newRotation = rapierQuaternionToQuaternion(rigidBody.rotation());
|
554
|
-
let interpolatedTranslation = oldState ?
|
555
|
-
let interpolatedRotation = oldState ?
|
557
|
+
let interpolatedTranslation = oldState ? oldState.translation.lerp(newTranslation, 1) : newTranslation;
|
558
|
+
let interpolatedRotation = oldState ? oldState.rotation.slerp(newRotation, interpolationAlpha) : newRotation;
|
556
559
|
state.setMatrix(_matrix4.compose(interpolatedTranslation, interpolatedRotation, state.worldScale).premultiply(state.invertedMatrixWorld));
|
557
560
|
|
558
561
|
if (state.mesh instanceof InstancedMesh) {
|
@@ -622,6 +625,24 @@ const Physics = ({
|
|
622
625
|
}, children);
|
623
626
|
};
|
624
627
|
|
628
|
+
function _extends() {
|
629
|
+
_extends = Object.assign || function (target) {
|
630
|
+
for (var i = 1; i < arguments.length; i++) {
|
631
|
+
var source = arguments[i];
|
632
|
+
|
633
|
+
for (var key in source) {
|
634
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
635
|
+
target[key] = source[key];
|
636
|
+
}
|
637
|
+
}
|
638
|
+
}
|
639
|
+
|
640
|
+
return target;
|
641
|
+
};
|
642
|
+
|
643
|
+
return _extends.apply(this, arguments);
|
644
|
+
}
|
645
|
+
|
625
646
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
626
647
|
if (source == null) return {};
|
627
648
|
var target = {};
|
@@ -888,7 +909,8 @@ const usePrismaticJoint = (body1, body2, [body1Anchor, body2Anchor, axis]) => {
|
|
888
909
|
return useImpulseJoint(body1, body2, rapier.JointData.prismatic(vectorArrayToVector3(body1Anchor), vectorArrayToVector3(body2Anchor), vectorArrayToVector3(axis)));
|
889
910
|
};
|
890
911
|
|
891
|
-
const _excluded$1 = ["children"]
|
912
|
+
const _excluded$1 = ["children"],
|
913
|
+
_excluded2 = ["type", "position", "rotation"];
|
892
914
|
const RigidBodyContext = /*#__PURE__*/createContext(undefined);
|
893
915
|
const useRigidBodyContext = () => useContext(RigidBodyContext); // RigidBody
|
894
916
|
|
@@ -899,6 +921,9 @@ const RigidBody = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
899
921
|
props = _objectWithoutProperties(_ref, _excluded$1);
|
900
922
|
|
901
923
|
const [object, api] = useRigidBody(props);
|
924
|
+
|
925
|
+
const objectProps = _objectWithoutProperties(props, _excluded2);
|
926
|
+
|
902
927
|
useImperativeHandle(ref, () => api);
|
903
928
|
return /*#__PURE__*/React.createElement(RigidBodyContext.Provider, {
|
904
929
|
value: {
|
@@ -907,9 +932,9 @@ const RigidBody = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
907
932
|
hasCollisionEvents: !!(props.onCollisionEnter || props.onCollisionExit),
|
908
933
|
options: props
|
909
934
|
}
|
910
|
-
}, /*#__PURE__*/React.createElement("object3D", {
|
935
|
+
}, /*#__PURE__*/React.createElement("object3D", _extends({
|
911
936
|
ref: object
|
912
|
-
}, children));
|
937
|
+
}, objectProps), children));
|
913
938
|
});
|
914
939
|
|
915
940
|
const MeshCollider = ({
|
@@ -1199,24 +1224,6 @@ const InstancedRigidBodies = /*#__PURE__*/forwardRef((props, ref) => {
|
|
1199
1224
|
}, props.children));
|
1200
1225
|
});
|
1201
1226
|
|
1202
|
-
function _extends() {
|
1203
|
-
_extends = Object.assign || function (target) {
|
1204
|
-
for (var i = 1; i < arguments.length; i++) {
|
1205
|
-
var source = arguments[i];
|
1206
|
-
|
1207
|
-
for (var key in source) {
|
1208
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
1209
|
-
target[key] = source[key];
|
1210
|
-
}
|
1211
|
-
}
|
1212
|
-
}
|
1213
|
-
|
1214
|
-
return target;
|
1215
|
-
};
|
1216
|
-
|
1217
|
-
return _extends.apply(this, arguments);
|
1218
|
-
}
|
1219
|
-
|
1220
1227
|
const _excluded = ["children"];
|
1221
1228
|
|
1222
1229
|
const AnyCollider = _ref => {
|