react-three-rapier-unified 1.0.1 → 1.0.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/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/package.json +1 -1
- package/src/components/Physics.tsx +3 -1
package/dist/index.cjs.js
CHANGED
|
@@ -28,4 +28,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
28
28
|
|
|
29
29
|
Check the render method of \``+u+"`."),d||(r=e(r))&&(d=`
|
|
30
30
|
|
|
31
|
-
Check the top-level render call using <`+r+">."),d}var _=c,ae=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),je=Symbol.for("react.strict_mode"),xe=Symbol.for("react.profiler"),he=Symbol.for("react.consumer"),Re=Symbol.for("react.context"),Pe=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),Se=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),qe=Symbol.for("react.offscreen"),ye=Symbol.iterator,le=Symbol.for("react.client.reference"),Z=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Oe=Object.prototype.hasOwnProperty,ue=Object.assign,H=Symbol.for("react.client.reference"),j=Array.isArray,$=0,be,K,de,f,F,R,b;n.__reactDisabledLog=!0;var S,I,N=!1,q=new(typeof WeakMap=="function"?WeakMap:Map),ce=Symbol.for("react.client.reference"),ee,fe={},te={},me={};Te.Fragment=J,Te.jsx=function(r,d,u,v,A){return M(r,d,u,!1,v,A)},Te.jsxs=function(r,d,u,v,A){return M(r,d,u,!0,v,A)}})()),Te}var it;function Lt(){return it||(it=1,process.env.NODE_ENV==="production"?ze.exports=Ut():ze.exports=$t()),ze.exports}var C=Lt();const Qt=new x.Quaternion;new x.Euler;const Xt=new x.Vector3;new x.Object3D;const pe=new x.Matrix4,z=new x.Vector3,se=new x.Quaternion,Ee=new x.Vector3,Zt=e=>{const[t,o,n]=e;return new x.Vector3(t,o,n)},st=({x:e,y:t,z:o,w:n})=>Qt.set(e,t,o,n),Y=e=>{if(Array.isArray(e))return new G.Vector3(e[0],e[1],e[2]);if(typeof e=="number")return new G.Vector3(e,e,e);{const t=e;return new G.Vector3(t.x,t.y,t.z)}},ct=e=>Array.isArray(e)?new G.Quaternion(e[0],e[1],e[2],e[3]):new G.Quaternion(e.x,e.y,e.z,e.w),Kt={fixed:1,dynamic:0,kinematicPosition:2,kinematicVelocity:3},mt=e=>Kt[e],er=(e,t)=>{const o=Array.from(e);for(let n=0;n<e.length/3;n++)o[n*3]*=t.x,o[n*3+1]*=t.y,o[n*3+2]*=t.z;return o},gt=e=>e?e instanceof x.Quaternion?[e.x,e.y,e.z,e.w]:e instanceof x.Vector3||e instanceof x.Euler?[e.x,e.y,e.z]:Array.isArray(e)?e:[e]:[0];function ie(e){const t=c.useRef(void 0);return t.current===void 0&&(t.current={value:typeof e=="function"?e():e}),t.current.value}const tr=e=>{const t=c.useRef(e),o=c.useRef(0),n=c.useRef(0);c.useEffect(()=>{t.current=e},[e]),c.useEffect(()=>{const i=()=>{const s=performance.now(),a=s-n.current;o.current=requestAnimationFrame(i),t.current(a/1e3),n.current=s};return o.current=requestAnimationFrame(i),()=>cancelAnimationFrame(o.current)},[])},rr=({onStep:e,updatePriority:t})=>(Fe.useFrame((o,n)=>{e(n)},t),null),or=({onStep:e})=>(tr(t=>{e(t)}),null),nr=({onStep:e,type:t,updatePriority:o})=>t==="independent"?C.jsx(or,{onStep:e}):C.jsx(rr,{onStep:e,updatePriority:o}),ir=c.memo(nr),sr=(e,t,o)=>{const n=t.slice();if(e==="heightfield"){const s=n[3];return s.x*=o.x,s.x*=o.y,s.x*=o.z,n}if(e==="trimesh"||e==="convexHull")return n[0]=er(n[0],o),n;const i=[o.x,o.y,o.z,o.x,o.x];return n.map((s,a)=>i[a]*s)},cr=(e,t,o,n)=>{const i=sr(e.shape,e.args,o),s=G.ColliderDesc[e.shape](...i);return t.createCollider(s,n==null?void 0:n())},ar=["shape","args"],at="Please pick ONLY ONE of the `density`, `mass` and `massProperties` options.",lr=(e,t)=>{if(t.density!==void 0){if(t.mass!==void 0||t.massProperties!==void 0)throw new Error(at);e.setDensity(t.density);return}if(t.mass!==void 0){if(t.massProperties!==void 0)throw new Error(at);e.setMass(t.mass);return}t.massProperties!==void 0&&e.setMassProperties(t.massProperties.mass,t.massProperties.centerOfMass,t.massProperties.principalAngularInertia,t.massProperties.angularInertiaLocalFrame)},pt={sensor:(e,t)=>{e.setSensor(t)},collisionGroups:(e,t)=>{e.setCollisionGroups(t)},solverGroups:(e,t)=>{e.setSolverGroups(t)},friction:(e,t)=>{e.setFriction(t)},frictionCombineRule:(e,t)=>{e.setFrictionCombineRule(t)},restitution:(e,t)=>{e.setRestitution(t)},restitutionCombineRule:(e,t)=>{e.setRestitutionCombineRule(t)},activeCollisionTypes:(e,t)=>{e.setActiveCollisionTypes(t)},contactSkin:(e,t)=>{e.setContactSkin(t)},quaternion:()=>{},position:()=>{},rotation:()=>{},scale:()=>{}},yt=Object.keys(pt),ur=(e,t,o)=>{var i;const n=o.get(e.handle);if(n){const s=n.object.parent.getWorldScale(Xt),a=(i=n.worldParent)==null?void 0:i.matrixWorld.clone().invert();n.object.updateWorldMatrix(!0,!1),pe.copy(n.object.matrixWorld),a&&pe.premultiply(a),pe.decompose(z,se,Ee),e.parent()?(e.setTranslationWrtParent({x:z.x*s.x,y:z.y*s.y,z:z.z*s.z}),e.setRotationWrtParent(se)):(e.setTranslation({x:z.x*s.x,y:z.y*s.y,z:z.z*s.z}),e.setRotation(se)),yt.forEach(l=>{if(l in t){const E=t[l];pt[l](e,E,t)}}),lr(e,t)}},dr=(e,t,o)=>{const n=c.useMemo(()=>yt.flatMap(i=>gt(t[i])),[t]);c.useEffect(()=>{const i=e();ur(i,t,o)},[...n,e])},fr=e=>{let t=!1;return e.traverseAncestors(o=>{o.userData.r3RapierType==="MeshCollider"&&(t=!0)}),t},mr=(e,t,o)=>({collider:e,worldParent:o||void 0,object:t}),gr={cuboid:"cuboid",ball:"ball",hull:"convexHull",trimesh:"trimesh"},pr=({object:e,ignoreMeshColliders:t=!0,options:o})=>{const n=[];e.updateWorldMatrix(!0,!1);const i=e.matrixWorld.clone().invert(),s=a=>{if("isMesh"in a){if(t&&fr(a))return;const l=a.getWorldScale(Ee),E=gr[o.colliders||"cuboid"];a.updateWorldMatrix(!0,!1),pe.copy(a.matrixWorld).premultiply(i).decompose(z,se,Ee);const p=new x.Euler().setFromQuaternion(se,"XYZ"),{geometry:m}=a,{args:P,offset:h}=yr(m,o.colliders||"cuboid"),O={...Ct(o),args:P,shape:E,rotation:[p.x,p.y,p.z],position:[z.x+h.x*l.x,z.y+h.y*l.y,z.z+h.z*l.z],scale:[l.x,l.y,l.z]};n.push(O)}};return o.includeInvisible?e.traverse(s):e.traverseVisible(s),n},yr=(e,t)=>{var o;switch(t){case"cuboid":{e.computeBoundingBox();const{boundingBox:n}=e,i=n.getSize(new x.Vector3);return{args:[i.x/2,i.y/2,i.z/2],offset:n.getCenter(new x.Vector3)}}case"ball":{e.computeBoundingSphere();const{boundingSphere:n}=e;return{args:[n.radius],offset:n.center}}case"trimesh":{const n=e.index?e.clone():ft.mergeVertices(e);return{args:[n.attributes.position.array,(o=n.index)==null?void 0:o.array],offset:new x.Vector3}}case"hull":return{args:[e.clone().attributes.position.array],offset:new x.Vector3}}return{args:[],offset:new x.Vector3}},bt=e=>({collision:!!(e!=null&&e.onCollisionEnter||e!=null&&e.onCollisionExit||e!=null&&e.onIntersectionEnter||e!=null&&e.onIntersectionExit),contactForce:!!(e!=null&&e.onContactForce)}),br=(e,t,o,n={})=>{const{onCollisionEnter:i,onCollisionExit:s,onIntersectionEnter:a,onIntersectionExit:l,onContactForce:E}=t;c.useEffect(()=>{const p=e();if(p){const{collision:m,contactForce:P}=bt(t),h=m||n.collision,O=P||n.contactForce;h&&O?p.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS|G.ActiveEvents.CONTACT_FORCE_EVENTS):h?p.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS):O&&p.setActiveEvents(G.ActiveEvents.CONTACT_FORCE_EVENTS),o.set(p.handle,{onCollisionEnter:i,onCollisionExit:s,onIntersectionEnter:a,onIntersectionExit:l,onContactForce:E})}return()=>{p&&o.delete(p.handle)}},[i,s,a,l,E,n])},Ct=(e={})=>{const{mass:t,linearDamping:o,angularDamping:n,type:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p,children:m,canSleep:P,ccd:h,gravityScale:O,softCcdPrediction:M,ref:Q,...y}=e;return y},Je=e=>{const t=c.useRef(e);return c.useEffect(()=>{t.current=e},[e]),t},D=()=>{const e=c.useContext(vt);if(!e)throw new Error("react-three-rapier: useRapier must be used within <Physics />!");return e},Et=e=>{const{beforeStepCallbacks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Cr=e=>{const{afterStepCallbacks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Er=e=>{const{filterContactPairHooks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},vr=e=>{const{filterIntersectionPairHooks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Ge=(e,t,o=!0)=>{const[n,i]=c.useState([]);return c.useEffect(()=>{e.current&&t.colliders!==!1&&i(pr({object:e.current,options:t,ignoreMeshColliders:o}))},[t.colliders]),n},xr=c.memo(()=>{const{world:e}=D(),t=c.useRef(null);return Fe.useFrame(()=>{const o=t.current;if(!o)return;const n=e.debugRender(),i=new x.BufferGeometry;i.setAttribute("position",new x.BufferAttribute(n.vertices,3)),i.setAttribute("color",new x.BufferAttribute(n.colors,4)),o.geometry.dispose(),o.geometry=i}),C.jsx("group",{children:C.jsxs("lineSegments",{ref:t,frustumCulled:!1,children:[C.jsx("lineBasicMaterial",{color:16777215,vertexColors:!0}),C.jsx("bufferGeometry",{})]})})}),hr=e=>{let t;const o={get(a,l){return t||(t=e()),Reflect.get(t,l)},set(a,l,E){return t||(t=e()),Reflect.set(t,l,E)}};return{proxy:new Proxy({},o),reset:()=>{t=void 0},set:a=>{t=a}}},vt=c.createContext(void 0),De=(e,t)=>{var o,n,i,s,a,l;return{target:{rigidBody:e.rigidBody.object,collider:e.collider.object,colliderObject:(o=e.collider.state)==null?void 0:o.object,rigidBodyObject:(n=e.rigidBody.state)==null?void 0:n.object},other:{rigidBody:t.rigidBody.object,collider:t.collider.object,colliderObject:(i=t.collider.state)==null?void 0:i.object,rigidBodyObject:(s=t.rigidBody.state)==null?void 0:s.object},rigidBody:t.rigidBody.object,collider:t.collider.object,colliderObject:(a=t.collider.state)==null?void 0:a.object,rigidBodyObject:(l=t.rigidBody.state)==null?void 0:l.object}},lt=async()=>{let e=await import("@dimforge/rapier3d-compat");return await e.init(),e},Rr=e=>{const{colliders:t="cuboid",children:o,timeStep:n=1/60,paused:i=!1,interpolate:s=!0,updatePriority:a,updateLoop:l="follow",debug:E=!1,gravity:p=[0,-9.81,0],allowedLinearError:m=.001,predictionDistance:P=.002,numSolverIterations:h=4,numInternalPgsIterations:O=1,minIslandSize:M=128,maxCcdSubsteps:Q=1,contactNaturalFrequency:y=30,lengthUnit:V=1}=e,B=Yt.suspend(lt,["@react-thee/rapier",lt]),{invalidate:_}=Fe.useThree(),ae=ie(()=>new Map),k=ie(()=>new Map),J=ie(()=>new Map),je=ie(()=>new Map),xe=ie(()=>new G.EventQueue(!1)),he=ie(()=>new Set),Re=ie(()=>new Set),Pe=ie(()=>({filterContactPair:(...H)=>{for(const j of he){const $=j.current(...H);if($!==null)return $}return null},filterIntersectionPair:(...H)=>{for(const j of Re)if(j.current(...H)===!1)return!1;return!0}})),we=ie(()=>new Set),Se=ie(()=>new Set),{proxy:T,reset:Ae,set:qe}=ie(()=>hr(()=>new B.World(Zt(p))));c.useEffect(()=>()=>{T.free(),Ae()},[]),c.useEffect(()=>{T.gravity=Y(p),T.integrationParameters.numSolverIterations=h,T.integrationParameters.numInternalPgsIterations=O,T.integrationParameters.normalizedAllowedLinearError=m,T.integrationParameters.minIslandSize=M,T.integrationParameters.maxCcdSubsteps=Q,T.integrationParameters.normalizedPredictionDistance=P,T.lengthUnit=V,T.integrationParameters.contact_natural_frequency=y},[T,...p,h,O,m,M,Q,P,V,y]);const ye=c.useCallback(H=>{var b;const j=T.getCollider(H),$=je.get(H),be=k.get(H),K=(b=j==null?void 0:j.parent())==null?void 0:b.handle,de=K!==void 0?T.getRigidBody(K):void 0,f=de&&K!==void 0?J.get(K):void 0,F=K!==void 0?ae.get(K):void 0;return{collider:{object:j,events:$,state:be},rigidBody:{object:de,events:f,state:F}}},[]),[le]=c.useState({previousState:{},accumulator:0}),Z=c.useCallback(H=>{const j=T,$=n==="vary",be=x.MathUtils.clamp(H,0,.5),K=f=>{we.forEach(R=>{R.current(j)}),j.timestep=f;const F=he.size>0||Re.size>0;j.step(xe,F?Pe:void 0),Se.forEach(R=>{R.current(j)})};if($)K(be);else for(le.accumulator+=be;le.accumulator>=n;)s&&(le.previousState={},j.forEachRigidBody(f=>{le.previousState[f.handle]={position:f.translation(),rotation:f.rotation()}})),K(n),le.accumulator-=n;const de=$||!s||i?1:le.accumulator/n;ae.forEach((f,F)=>{var q,ce;const R=j.getRigidBody(F),b=J.get(F);if((b!=null&&b.onSleep||b!=null&&b.onWake)&&(R.isSleeping()&&!f.isSleeping&&((q=b==null?void 0:b.onSleep)==null||q.call(b)),!R.isSleeping()&&f.isSleeping&&((ce=b==null?void 0:b.onWake)==null||ce.call(b)),f.isSleeping=R.isSleeping()),!R||R.isSleeping()&&!("isInstancedMesh"in f.object)||!f.setMatrix)return;let S=R.translation(),I=R.rotation(),N=le.previousState[F];N&&(pe.compose(N.position,st(N.rotation),f.scale).premultiply(f.invertedWorldMatrix).decompose(z,se,Ee),f.meshType=="mesh"&&(f.object.position.copy(z),f.object.quaternion.copy(se))),pe.compose(S,st(I),f.scale).premultiply(f.invertedWorldMatrix).decompose(z,se,Ee),f.meshType=="instancedMesh"?f.setMatrix(pe):(f.object.position.lerp(z,de),f.object.quaternion.slerp(se,de))}),xe.drainCollisionEvents((f,F,R)=>{var q,ce,ee,fe,te,me,r,d,u,v,A,w,g,re,ne,W,oe,ge,X,Ce,L,Qe,Be,Xe;const b=ye(f),S=ye(F);if(!(b!=null&&b.collider.object)||!(S!=null&&S.collider.object))return;const I=De(b,S),N=De(S,b);R?j.contactPair(b.collider.object,S.collider.object,(_e,ke)=>{var Ne,Ze,Ie,Ke,We,et,Ve,tt;(Ze=(Ne=b.rigidBody.events)==null?void 0:Ne.onCollisionEnter)==null||Ze.call(Ne,{...I,manifold:_e,flipped:ke}),(Ke=(Ie=S.rigidBody.events)==null?void 0:Ie.onCollisionEnter)==null||Ke.call(Ie,{...N,manifold:_e,flipped:ke}),(et=(We=b.collider.events)==null?void 0:We.onCollisionEnter)==null||et.call(We,{...I,manifold:_e,flipped:ke}),(tt=(Ve=S.collider.events)==null?void 0:Ve.onCollisionEnter)==null||tt.call(Ve,{...N,manifold:_e,flipped:ke})}):((ce=(q=b.rigidBody.events)==null?void 0:q.onCollisionExit)==null||ce.call(q,I),(fe=(ee=S.rigidBody.events)==null?void 0:ee.onCollisionExit)==null||fe.call(ee,N),(me=(te=b.collider.events)==null?void 0:te.onCollisionExit)==null||me.call(te,I),(d=(r=S.collider.events)==null?void 0:r.onCollisionExit)==null||d.call(r,N)),R?j.intersectionPair(b.collider.object,S.collider.object)&&((v=(u=b.rigidBody.events)==null?void 0:u.onIntersectionEnter)==null||v.call(u,I),(w=(A=S.rigidBody.events)==null?void 0:A.onIntersectionEnter)==null||w.call(A,N),(re=(g=b.collider.events)==null?void 0:g.onIntersectionEnter)==null||re.call(g,I),(W=(ne=S.collider.events)==null?void 0:ne.onIntersectionEnter)==null||W.call(ne,N)):((ge=(oe=b.rigidBody.events)==null?void 0:oe.onIntersectionExit)==null||ge.call(oe,I),(Ce=(X=S.rigidBody.events)==null?void 0:X.onIntersectionExit)==null||Ce.call(X,N),(Qe=(L=b.collider.events)==null?void 0:L.onIntersectionExit)==null||Qe.call(L,I),(Xe=(Be=S.collider.events)==null?void 0:Be.onIntersectionExit)==null||Xe.call(Be,N))}),xe.drainContactForceEvents(f=>{var I,N,q,ce,ee,fe,te,me;const F=ye(f.collider1()),R=ye(f.collider2());if(!(F!=null&&F.collider.object)||!(R!=null&&R.collider.object))return;const b=De(F,R),S=De(R,F);(N=(I=F.rigidBody.events)==null?void 0:I.onContactForce)==null||N.call(I,{...b,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(ce=(q=R.rigidBody.events)==null?void 0:q.onContactForce)==null||ce.call(q,{...S,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(fe=(ee=F.collider.events)==null?void 0:ee.onContactForce)==null||fe.call(ee,{...b,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(me=(te=R.collider.events)==null?void 0:te.onContactForce)==null||me.call(te,{...S,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()})}),j.forEachActiveRigidBody(()=>{_()})},[i,n,s,T]),Oe=c.useMemo(()=>({rapier:B,world:T,setWorld:H=>{qe(H)},physicsOptions:{colliders:t,gravity:p},rigidBodyStates:ae,colliderStates:k,rigidBodyEvents:J,colliderEvents:je,beforeStepCallbacks:we,afterStepCallbacks:Se,isPaused:i,isDebug:E,step:Z,filterContactPairHooks:he,filterIntersectionPairHooks:Re}),[i,Z,E,t,p]),ue=c.useCallback(H=>{i||Z(H)},[i,Z]);return C.jsxs(vt.Provider,{value:Oe,children:[C.jsx(ir,{onStep:ue,type:l,updatePriority:a}),E&&C.jsx(xr,{}),o]})},Ye=(e,t=null)=>{const o=c.useRef(t);return e&&typeof e!="function"?(e.current||(e.current=o.current),e):o},Ue=(e,t,o)=>{const n=c.useRef(void 0),i=c.useCallback(()=>(n.current||(n.current=e()),n.current),o);return c.useEffect(()=>{const s=i(),a=()=>t(s);return()=>{a(),n.current=void 0}},[i]),i},wr=e=>{const t=mt((e==null?void 0:e.type)||"dynamic"),o=new G.RigidBodyDesc(t);return o.canSleep=(e==null?void 0:e.canSleep)??!0,o},Sr=({rigidBody:e,object:t,setMatrix:o,getMatrix:n,worldScale:i,meshType:s="mesh"})=>{t.updateWorldMatrix(!0,!1);const a=t.parent.matrixWorld.clone().invert();return{object:t,rigidBody:e,invertedWorldMatrix:a,setMatrix:o||(l=>{t.matrix.copy(l)}),getMatrix:n||(l=>l.copy(t.matrix)),scale:i||t.getWorldScale(Ee).clone(),isSleeping:!1,meshType:s}},jr=["args","colliders","canSleep"],xt={gravityScale:(e,t)=>{e.setGravityScale(t,!0)},additionalSolverIterations(e,t){e.setAdditionalSolverIterations(t)},linearDamping:(e,t)=>{e.setLinearDamping(t)},angularDamping:(e,t)=>{e.setAngularDamping(t)},dominanceGroup:(e,t)=>{e.setDominanceGroup(t)},enabledRotations:(e,[t,o,n])=>{e.setEnabledRotations(t,o,n,!0)},enabledTranslations:(e,[t,o,n])=>{e.setEnabledTranslations(t,o,n,!0)},lockRotations:(e,t)=>{e.lockRotations(t,!0)},lockTranslations:(e,t)=>{e.lockTranslations(t,!0)},angularVelocity:(e,[t,o,n])=>{e.setAngvel({x:t,y:o,z:n},!0)},linearVelocity:(e,[t,o,n])=>{e.setLinvel({x:t,y:o,z:n},!0)},ccd:(e,t)=>{e.enableCcd(t)},softCcdPrediction:(e,t)=>{e.setSoftCcdPrediction(t)},userData:(e,t)=>{e.userData=t},type(e,t){e.setBodyType(mt(t),!0)},position:()=>{},rotation:()=>{},quaternion:()=>{},scale:()=>{}},ht=Object.keys(xt),Pr=(e,t,o,n=!0)=>{if(!e)return;const i=o.get(e.handle);i&&(n&&(i.object.updateWorldMatrix(!0,!1),pe.copy(i.object.matrixWorld).decompose(z,se,Ee),e.setTranslation(z,!1),e.setRotation(se,!1)),ht.forEach(s=>{s in t&&xt[s](e,t[s])}))},Ar=(e,t,o,n=!0)=>{const i=c.useMemo(()=>ht.flatMap(s=>gt(t[s])),[t]);c.useEffect(()=>{const s=e();Pr(s,t,o,n)},i)},Mr=(e,t,o)=>{const{onWake:n,onSleep:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p}=t,m={onWake:n,onSleep:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p};c.useEffect(()=>{const P=e();return o.set(P.handle,m),()=>{o.delete(P.handle)}},[n,i,s,a,l,E,p])},Rt=({x:e,y:t,z:o}={x:0,y:0,z:0})=>new x.Vector3(e,t,o),Tr=({x:e,y:t,z:o,w:n}={x:0,y:0,z:0,w:1})=>new x.Quaternion(e,t,o,n),Fr=({x:e,y:t,z:o}={x:0,y:0,z:0})=>new x.Euler(e,t,o),U=c.memo(e=>{const{children:t,position:o,rotation:n,quaternion:i,scale:s,name:a}=e,{world:l,colliderEvents:E,colliderStates:p}=D(),m=_t(),P=Ye(e.ref),h=c.useRef(null),O=ar.flatMap(y=>Array.isArray(e[y])?e[y]:[e[y]]),M=Ue(()=>{const y=h.current.getWorldScale(Rt()),V=cr(e,l,y,m==null?void 0:m.getRigidBody);return typeof e.ref=="function"&&e.ref(V),P.current=V,V},y=>{l.getCollider(y.handle)&&l.removeCollider(y,!0)},[...O,m]);c.useEffect(()=>{const y=M();return p.set(y.handle,mr(y,h.current,m==null?void 0:m.ref.current)),()=>{p.delete(y.handle)}},[M]);const Q=c.useMemo(()=>({...Ct(m==null?void 0:m.options),...e}),[e,m==null?void 0:m.options]);return dr(M,Q,p),br(M,Q,E,bt(m==null?void 0:m.options)),C.jsx("object3D",{position:o,rotation:n,quaternion:i,scale:s,ref:h,name:a,children:t})}),wt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cuboid",ref:t}));wt.displayName="CuboidCollider";const St=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCuboid",ref:t}));St.displayName="RoundCuboidCollider";const jt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"ball",ref:t}));jt.displayName="BallCollider";const Pt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"capsule",ref:t}));Pt.displayName="CapsuleCollider";const At=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"heightfield",ref:t}));At.displayName="HeightfieldCollider";const Mt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"trimesh",ref:t}));Mt.displayName="TrimeshCollider";const Tt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cone",ref:t}));Tt.displayName="ConeCollider";const Ft=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCone",ref:t}));Ft.displayName="RoundConeCollider";const $e=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cylinder",ref:t}));$e.displayName="CylinderCollider";const Or=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCylinder",ref:t}));$e.displayName="RoundCylinderCollider";const Ot=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"convexHull",ref:t}));Ot.displayName="ConvexHullCollider";const Bt=c.createContext(void 0),_t=()=>c.useContext(Bt),Le=c.memo(e=>{const{ref:t,children:o,type:n,position:i,rotation:s,scale:a,quaternion:l,transformState:E,...p}=e,m=c.useRef(null),P=Ye(t),{world:h,rigidBodyStates:O,physicsOptions:M,rigidBodyEvents:Q}=D(),y=c.useMemo(()=>({...M,...e,children:void 0}),[M,e]),V=jr.flatMap(k=>Array.isArray(y[k])?[...y[k]]:y[k]),B=Ge(m,y),_=Ue(()=>{const k=wr(y),J=h.createRigidBody(k);return typeof t=="function"&&t(J),P.current=J,J},k=>{h.getRigidBody(k.handle)&&h.removeRigidBody(k)},V);c.useEffect(()=>{const k=_(),J=Sr({rigidBody:k,object:m.current});return O.set(k.handle,e.transformState?e.transformState(J):J),()=>{O.delete(k.handle)}},[_]),Ar(_,y,O),Mr(_,y,Q);const ae=c.useMemo(()=>({ref:m,getRigidBody:_,options:y}),[_]);return C.jsx(Bt.Provider,{value:ae,children:C.jsxs("object3D",{ref:m,...p,position:i,rotation:s,quaternion:l,scale:a,children:[o,B.map((k,J)=>C.jsx(U,{...k},J))]})})});Le.displayName="RigidBody";const kt=c.memo(e=>{const{children:t,type:o}=e,{physicsOptions:n}=D(),i=c.useRef(null),{options:s}=_t(),a=c.useMemo(()=>({...n,...s,children:void 0,colliders:o}),[n,s]),l=Ge(i,a,!1);return C.jsxs("object3D",{ref:i,userData:{r3RapierType:"MeshCollider"},children:[t,l.map((E,p)=>C.jsx(U,{...E},p))]})});kt.displayName="MeshCollider";const Nt=c.memo(({ref:e,...t})=>{const o=Ye(e,[]),n=c.useRef(null),i=c.useRef(null),{children:s,instances:a,colliderNodes:l=[],position:E,rotation:p,quaternion:m,scale:P,...h}=t,O=Ge(n,{...t,children:void 0}),M=()=>{const y=i.current.children[0];if(y&&"isInstancedMesh"in y)return y};c.useEffect(()=>{const y=M();y?y.instanceMatrix.setUsage(x.DynamicDrawUsage):console.warn("InstancedRigidBodies expects exactly one child, which must be an InstancedMesh")},[]);const Q=(y,V)=>{const B=M();return B?{...y,getMatrix:_=>(B.getMatrixAt(V,_),_),setMatrix:_=>{B.setMatrixAt(V,_),B.instanceMatrix.needsUpdate=!0},meshType:"instancedMesh"}:y};return C.jsxs("object3D",{ref:n,...h,position:E,rotation:p,quaternion:m,scale:P,children:[C.jsx("object3D",{ref:i,children:s}),a==null?void 0:a.map((y,V)=>C.jsx(Le,{...h,...y,ref:B=>{o.current[V]=B},transformState:B=>Q(B,V),children:C.jsxs(C.Fragment,{children:[l.map((B,_)=>C.jsx(c.Fragment,{children:B},_)),O.map((B,_)=>C.jsx(U,{...B},_))]})}))]})});Nt.displayName="InstancedRigidBodies";const ve=(e,t,o)=>{const{world:n}=D(),i=c.useRef(void 0);return Ue(()=>{if(e.current&&t.current){const s=n.createImpulseJoint(o,e.current,t.current,!0);return i.current=s,s}},s=>{s&&(i.current=void 0,n.getImpulseJoint(s.handle)&&n.removeImpulseJoint(s,!0))},[]),i},Br=(e,t,[o,n,i,s])=>{const{rapier:a}=D();return ve(e,t,a.JointData.fixed(Y(o),ct(n),Y(i),ct(s)))},_r=(e,t,[o,n])=>{const{rapier:i}=D();return ve(e,t,i.JointData.spherical(Y(o),Y(n)))},kr=(e,t,[o,n,i,s])=>{const{rapier:a}=D(),l=a.JointData.revolute(Y(o),Y(n),Y(i));return s&&(l.limitsEnabled=!0,l.limits=s),ve(e,t,l)},Nr=(e,t,[o,n,i,s])=>{const{rapier:a}=D(),l=a.JointData.prismatic(Y(o),Y(n),Y(i));return s&&(l.limitsEnabled=!0,l.limits=s),ve(e,t,l)},Ir=(e,t,[o,n,i])=>{const{rapier:s}=D(),a=Y(o),l=Y(n),E=s.JointData.rope(i,a,l);return ve(e,t,E)},Wr=(e,t,[o,n,i,s,a])=>{const{rapier:l}=D(),E=Y(o),p=Y(n),m=l.JointData.spring(i,s,a,E,p);return ve(e,t,m)},Vr=(e,t)=>(ut(e)<<16)+(t!==void 0?ut(t):65535),ut=e=>[e].flat().reduce((t,o)=>t|1<<o,0),zr=new x.Vector3,It=e=>{const{scene:t}=Fe.useThree(),o=c.useRef(null),n=c.useRef(null),i=e.strength>0?255:16711680;return c.useEffect(()=>(o.current=new x.Mesh(new x.SphereGeometry(.2,6,6),new x.MeshBasicMaterial({color:i,wireframe:!0})),n.current=new ft.VertexNormalsHelper(o.current,e.range,i),n.current.frustumCulled=!1,t.add(o.current),t.add(n.current),()=>{n.current&&o.current&&(t.remove(n.current),t.remove(o.current))}),[e,i]),Fe.useFrame(()=>{var s;if(o.current&&e.object.current){const a=e.object.current.getWorldPosition(zr);o.current.position.copy(a),(s=n.current)==null||s.update()}}),null},Dr={static:(e,t,o,n,i)=>e,linear:(e,t,o,n,i)=>e*(n/o),newtonian:(e,t,o,n,i)=>i*e*t/Math.pow(n,2)},He=new x.Vector3,dt=new x.Vector3,Wt=(e,{object:t,strength:o,range:n,gravitationalConstant:i,collisionGroups:s,type:a})=>{const l=e.translation();He.set(l.x,l.y,l.z);const E=t.getWorldPosition(new x.Vector3),p=E.distanceTo(He);if(p<n){let m=Dr[a](o,e.mass(),n,p,i);m=m===1/0?o:m;let P=s===void 0;if(s!==void 0)for(let h=0;h<e.numColliders();h++){const M=e.collider(h).collisionGroups();if((s>>16&M)!=0&&(M>>16&s)!=0){P=!0;break}}P&&(dt.set(0,0,0).subVectors(E,He).normalize().multiplyScalar(m),e.applyImpulse(dt,!0))}},Jr=c.memo(e=>{const{position:t=[0,0,0],strength:o=1,range:n=10,type:i="static",gravitationalConstant:s=6673e-14,collisionGroups:a}=e,l=c.useRef(null),{isDebug:E}=D();return Et(p=>{l.current&&p.bodies.forEach(m=>{m.isDynamic()&&Wt(m,{object:l.current,strength:o,range:n,type:i,gravitationalConstant:s,collisionGroups:a})})}),C.jsxs(C.Fragment,{children:[C.jsx("object3D",{ref:l,position:t}),E&&C.jsx(It,{strength:o,gravitationalConstant:s,range:n,type:i,collisionGroups:a,object:l})]})});Object.defineProperty(exports,"CoefficientCombineRule",{enumerable:!0,get:()=>G.CoefficientCombineRule});Object.defineProperty(exports,"RapierCollider",{enumerable:!0,get:()=>G.Collider});Object.defineProperty(exports,"RapierRigidBody",{enumerable:!0,get:()=>G.RigidBody});exports.AnyCollider=U;exports.Attractor=Jr;exports.AttractorDebugHelper=It;exports.BallCollider=jt;exports.CapsuleCollider=Pt;exports.ConeCollider=Tt;exports.ConvexHullCollider=Ot;exports.CuboidCollider=wt;exports.CylinderCollider=$e;exports.HeightfieldCollider=At;exports.InstancedRigidBodies=Nt;exports.MeshCollider=kt;exports.Physics=Rr;exports.RigidBody=Le;exports.RoundConeCollider=Ft;exports.RoundCuboidCollider=St;exports.RoundCylinderCollider=Or;exports.TrimeshCollider=Mt;exports.applyAttractorForceOnRigidBody=Wt;exports.euler=Fr;exports.interactionGroups=Vr;exports.quat=Tr;exports.useAfterPhysicsStep=Cr;exports.useBeforePhysicsStep=Et;exports.useFilterContactPair=Er;exports.useFilterIntersectionPair=vr;exports.useFixedJoint=Br;exports.useImpulseJoint=ve;exports.usePrismaticJoint=Nr;exports.useRapier=D;exports.useRevoluteJoint=kr;exports.useRopeJoint=Ir;exports.useSphericalJoint=_r;exports.useSpringJoint=Wr;exports.vec3=Rt;
|
|
31
|
+
Check the top-level render call using <`+r+">."),d}var _=c,ae=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),J=Symbol.for("react.fragment"),je=Symbol.for("react.strict_mode"),xe=Symbol.for("react.profiler"),he=Symbol.for("react.consumer"),Re=Symbol.for("react.context"),Pe=Symbol.for("react.forward_ref"),we=Symbol.for("react.suspense"),Se=Symbol.for("react.suspense_list"),T=Symbol.for("react.memo"),Ae=Symbol.for("react.lazy"),qe=Symbol.for("react.offscreen"),ye=Symbol.iterator,le=Symbol.for("react.client.reference"),Z=_.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Oe=Object.prototype.hasOwnProperty,ue=Object.assign,H=Symbol.for("react.client.reference"),j=Array.isArray,$=0,be,K,de,f,F,R,b;n.__reactDisabledLog=!0;var S,I,N=!1,q=new(typeof WeakMap=="function"?WeakMap:Map),ce=Symbol.for("react.client.reference"),ee,fe={},te={},me={};Te.Fragment=J,Te.jsx=function(r,d,u,v,A){return M(r,d,u,!1,v,A)},Te.jsxs=function(r,d,u,v,A){return M(r,d,u,!0,v,A)}})()),Te}var it;function Lt(){return it||(it=1,process.env.NODE_ENV==="production"?ze.exports=Ut():ze.exports=$t()),ze.exports}var C=Lt();const Qt=new x.Quaternion;new x.Euler;const Xt=new x.Vector3;new x.Object3D;const pe=new x.Matrix4,z=new x.Vector3,se=new x.Quaternion,Ee=new x.Vector3,Zt=e=>{const[t,o,n]=e;return new x.Vector3(t,o,n)},st=({x:e,y:t,z:o,w:n})=>Qt.set(e,t,o,n),Y=e=>{if(Array.isArray(e))return new G.Vector3(e[0],e[1],e[2]);if(typeof e=="number")return new G.Vector3(e,e,e);{const t=e;return new G.Vector3(t.x,t.y,t.z)}},ct=e=>Array.isArray(e)?new G.Quaternion(e[0],e[1],e[2],e[3]):new G.Quaternion(e.x,e.y,e.z,e.w),Kt={fixed:1,dynamic:0,kinematicPosition:2,kinematicVelocity:3},mt=e=>Kt[e],er=(e,t)=>{const o=Array.from(e);for(let n=0;n<e.length/3;n++)o[n*3]*=t.x,o[n*3+1]*=t.y,o[n*3+2]*=t.z;return o},gt=e=>e?e instanceof x.Quaternion?[e.x,e.y,e.z,e.w]:e instanceof x.Vector3||e instanceof x.Euler?[e.x,e.y,e.z]:Array.isArray(e)?e:[e]:[0];function ie(e){const t=c.useRef(void 0);return t.current===void 0&&(t.current={value:typeof e=="function"?e():e}),t.current.value}const tr=e=>{const t=c.useRef(e),o=c.useRef(0),n=c.useRef(0);c.useEffect(()=>{t.current=e},[e]),c.useEffect(()=>{const i=()=>{const s=performance.now(),a=s-n.current;o.current=requestAnimationFrame(i),t.current(a/1e3),n.current=s};return o.current=requestAnimationFrame(i),()=>cancelAnimationFrame(o.current)},[])},rr=({onStep:e,updatePriority:t})=>(Fe.useFrame((o,n)=>{e(n)},t),null),or=({onStep:e})=>(tr(t=>{e(t)}),null),nr=({onStep:e,type:t,updatePriority:o})=>t==="independent"?C.jsx(or,{onStep:e}):C.jsx(rr,{onStep:e,updatePriority:o}),ir=c.memo(nr),sr=(e,t,o)=>{const n=t.slice();if(e==="heightfield"){const s=n[3];return s.x*=o.x,s.x*=o.y,s.x*=o.z,n}if(e==="trimesh"||e==="convexHull")return n[0]=er(n[0],o),n;const i=[o.x,o.y,o.z,o.x,o.x];return n.map((s,a)=>i[a]*s)},cr=(e,t,o,n)=>{const i=sr(e.shape,e.args,o),s=G.ColliderDesc[e.shape](...i);return t.createCollider(s,n==null?void 0:n())},ar=["shape","args"],at="Please pick ONLY ONE of the `density`, `mass` and `massProperties` options.",lr=(e,t)=>{if(t.density!==void 0){if(t.mass!==void 0||t.massProperties!==void 0)throw new Error(at);e.setDensity(t.density);return}if(t.mass!==void 0){if(t.massProperties!==void 0)throw new Error(at);e.setMass(t.mass);return}t.massProperties!==void 0&&e.setMassProperties(t.massProperties.mass,t.massProperties.centerOfMass,t.massProperties.principalAngularInertia,t.massProperties.angularInertiaLocalFrame)},pt={sensor:(e,t)=>{e.setSensor(t)},collisionGroups:(e,t)=>{e.setCollisionGroups(t)},solverGroups:(e,t)=>{e.setSolverGroups(t)},friction:(e,t)=>{e.setFriction(t)},frictionCombineRule:(e,t)=>{e.setFrictionCombineRule(t)},restitution:(e,t)=>{e.setRestitution(t)},restitutionCombineRule:(e,t)=>{e.setRestitutionCombineRule(t)},activeCollisionTypes:(e,t)=>{e.setActiveCollisionTypes(t)},contactSkin:(e,t)=>{e.setContactSkin(t)},quaternion:()=>{},position:()=>{},rotation:()=>{},scale:()=>{}},yt=Object.keys(pt),ur=(e,t,o)=>{var i;const n=o.get(e.handle);if(n){const s=n.object.parent.getWorldScale(Xt),a=(i=n.worldParent)==null?void 0:i.matrixWorld.clone().invert();n.object.updateWorldMatrix(!0,!1),pe.copy(n.object.matrixWorld),a&&pe.premultiply(a),pe.decompose(z,se,Ee),e.parent()?(e.setTranslationWrtParent({x:z.x*s.x,y:z.y*s.y,z:z.z*s.z}),e.setRotationWrtParent(se)):(e.setTranslation({x:z.x*s.x,y:z.y*s.y,z:z.z*s.z}),e.setRotation(se)),yt.forEach(l=>{if(l in t){const E=t[l];pt[l](e,E,t)}}),lr(e,t)}},dr=(e,t,o)=>{const n=c.useMemo(()=>yt.flatMap(i=>gt(t[i])),[t]);c.useEffect(()=>{const i=e();ur(i,t,o)},[...n,e])},fr=e=>{let t=!1;return e.traverseAncestors(o=>{o.userData.r3RapierType==="MeshCollider"&&(t=!0)}),t},mr=(e,t,o)=>({collider:e,worldParent:o||void 0,object:t}),gr={cuboid:"cuboid",ball:"ball",hull:"convexHull",trimesh:"trimesh"},pr=({object:e,ignoreMeshColliders:t=!0,options:o})=>{const n=[];e.updateWorldMatrix(!0,!1);const i=e.matrixWorld.clone().invert(),s=a=>{if("isMesh"in a){if(t&&fr(a))return;const l=a.getWorldScale(Ee),E=gr[o.colliders||"cuboid"];a.updateWorldMatrix(!0,!1),pe.copy(a.matrixWorld).premultiply(i).decompose(z,se,Ee);const p=new x.Euler().setFromQuaternion(se,"XYZ"),{geometry:m}=a,{args:P,offset:h}=yr(m,o.colliders||"cuboid"),O={...Ct(o),args:P,shape:E,rotation:[p.x,p.y,p.z],position:[z.x+h.x*l.x,z.y+h.y*l.y,z.z+h.z*l.z],scale:[l.x,l.y,l.z]};n.push(O)}};return o.includeInvisible?e.traverse(s):e.traverseVisible(s),n},yr=(e,t)=>{var o;switch(t){case"cuboid":{e.computeBoundingBox();const{boundingBox:n}=e,i=n.getSize(new x.Vector3);return{args:[i.x/2,i.y/2,i.z/2],offset:n.getCenter(new x.Vector3)}}case"ball":{e.computeBoundingSphere();const{boundingSphere:n}=e;return{args:[n.radius],offset:n.center}}case"trimesh":{const n=e.index?e.clone():ft.mergeVertices(e);return{args:[n.attributes.position.array,(o=n.index)==null?void 0:o.array],offset:new x.Vector3}}case"hull":return{args:[e.clone().attributes.position.array],offset:new x.Vector3}}return{args:[],offset:new x.Vector3}},bt=e=>({collision:!!(e!=null&&e.onCollisionEnter||e!=null&&e.onCollisionExit||e!=null&&e.onIntersectionEnter||e!=null&&e.onIntersectionExit),contactForce:!!(e!=null&&e.onContactForce)}),br=(e,t,o,n={})=>{const{onCollisionEnter:i,onCollisionExit:s,onIntersectionEnter:a,onIntersectionExit:l,onContactForce:E}=t;c.useEffect(()=>{const p=e();if(p){const{collision:m,contactForce:P}=bt(t),h=m||n.collision,O=P||n.contactForce;h&&O?p.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS|G.ActiveEvents.CONTACT_FORCE_EVENTS):h?p.setActiveEvents(G.ActiveEvents.COLLISION_EVENTS):O&&p.setActiveEvents(G.ActiveEvents.CONTACT_FORCE_EVENTS),o.set(p.handle,{onCollisionEnter:i,onCollisionExit:s,onIntersectionEnter:a,onIntersectionExit:l,onContactForce:E})}return()=>{p&&o.delete(p.handle)}},[i,s,a,l,E,n])},Ct=(e={})=>{const{mass:t,linearDamping:o,angularDamping:n,type:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p,children:m,canSleep:P,ccd:h,gravityScale:O,softCcdPrediction:M,ref:Q,...y}=e;return y},Je=e=>{const t=c.useRef(e);return c.useEffect(()=>{t.current=e},[e]),t},D=()=>{const e=c.useContext(vt);if(!e)throw new Error("react-three-rapier: useRapier must be used within <Physics />!");return e},Et=e=>{const{beforeStepCallbacks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Cr=e=>{const{afterStepCallbacks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Er=e=>{const{filterContactPairHooks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},vr=e=>{const{filterIntersectionPairHooks:t}=D(),o=Je(e);c.useEffect(()=>(t.add(o),()=>{t.delete(o)}),[])},Ge=(e,t,o=!0)=>{const[n,i]=c.useState([]);return c.useEffect(()=>{e.current&&t.colliders!==!1&&i(pr({object:e.current,options:t,ignoreMeshColliders:o}))},[t.colliders]),n},xr=c.memo(()=>{const{world:e}=D(),t=c.useRef(null);return Fe.useFrame(()=>{const o=t.current;if(!o)return;const n=e.debugRender(),i=new x.BufferGeometry;i.setAttribute("position",new x.BufferAttribute(n.vertices,3)),i.setAttribute("color",new x.BufferAttribute(n.colors,4)),o.geometry.dispose(),o.geometry=i}),C.jsx("group",{children:C.jsxs("lineSegments",{ref:t,frustumCulled:!1,children:[C.jsx("lineBasicMaterial",{color:16777215,vertexColors:!0}),C.jsx("bufferGeometry",{})]})})}),hr=e=>{let t;const o={get(a,l){return t||(t=e()),Reflect.get(t,l)},set(a,l,E){return t||(t=e()),Reflect.set(t,l,E)}};return{proxy:new Proxy({},o),reset:()=>{t=void 0},set:a=>{t=a}}},vt=c.createContext(void 0),De=(e,t)=>{var o,n,i,s,a,l;return{target:{rigidBody:e.rigidBody.object,collider:e.collider.object,colliderObject:(o=e.collider.state)==null?void 0:o.object,rigidBodyObject:(n=e.rigidBody.state)==null?void 0:n.object},other:{rigidBody:t.rigidBody.object,collider:t.collider.object,colliderObject:(i=t.collider.state)==null?void 0:i.object,rigidBodyObject:(s=t.rigidBody.state)==null?void 0:s.object},rigidBody:t.rigidBody.object,collider:t.collider.object,colliderObject:(a=t.collider.state)==null?void 0:a.object,rigidBodyObject:(l=t.rigidBody.state)==null?void 0:l.object}},lt=async()=>{let e=await import("@dimforge/rapier3d-compat");return await e.init({}),e},Rr=e=>{const{colliders:t="cuboid",children:o,timeStep:n=1/60,paused:i=!1,interpolate:s=!0,updatePriority:a,updateLoop:l="follow",debug:E=!1,gravity:p=[0,-9.81,0],allowedLinearError:m=.001,predictionDistance:P=.002,numSolverIterations:h=4,numInternalPgsIterations:O=1,minIslandSize:M=128,maxCcdSubsteps:Q=1,contactNaturalFrequency:y=30,lengthUnit:V=1}=e,B=Yt.suspend(lt,["@react-thee/rapier",lt]),{invalidate:_}=Fe.useThree(),ae=ie(()=>new Map),k=ie(()=>new Map),J=ie(()=>new Map),je=ie(()=>new Map),xe=ie(()=>new G.EventQueue(!1)),he=ie(()=>new Set),Re=ie(()=>new Set),Pe=ie(()=>({filterContactPair:(...H)=>{for(const j of he){const $=j.current(...H);if($!==null)return $}return null},filterIntersectionPair:(...H)=>{for(const j of Re)if(j.current(...H)===!1)return!1;return!0}})),we=ie(()=>new Set),Se=ie(()=>new Set),{proxy:T,reset:Ae,set:qe}=ie(()=>hr(()=>new B.World(Zt(p))));c.useEffect(()=>()=>{T.free(),Ae()},[]),c.useEffect(()=>{T.gravity=Y(p),T.integrationParameters.numSolverIterations=h,T.integrationParameters.numInternalPgsIterations=O,T.integrationParameters.normalizedAllowedLinearError=m,T.integrationParameters.minIslandSize=M,T.integrationParameters.maxCcdSubsteps=Q,T.integrationParameters.normalizedPredictionDistance=P,T.lengthUnit=V,T.integrationParameters.contact_natural_frequency=y},[T,...p,h,O,m,M,Q,P,V,y]);const ye=c.useCallback(H=>{var b;const j=T.getCollider(H),$=je.get(H),be=k.get(H),K=(b=j==null?void 0:j.parent())==null?void 0:b.handle,de=K!==void 0?T.getRigidBody(K):void 0,f=de&&K!==void 0?J.get(K):void 0,F=K!==void 0?ae.get(K):void 0;return{collider:{object:j,events:$,state:be},rigidBody:{object:de,events:f,state:F}}},[]),[le]=c.useState({previousState:{},accumulator:0}),Z=c.useCallback(H=>{const j=T,$=n==="vary",be=x.MathUtils.clamp(H,0,.5),K=f=>{we.forEach(R=>{R.current(j)}),j.timestep=f;const F=he.size>0||Re.size>0;j.step(xe,F?Pe:void 0),Se.forEach(R=>{R.current(j)})};if($)K(be);else for(le.accumulator+=be;le.accumulator>=n;)s&&(le.previousState={},j.forEachRigidBody(f=>{le.previousState[f.handle]={position:f.translation(),rotation:f.rotation()}})),K(n),le.accumulator-=n;const de=$||!s||i?1:le.accumulator/n;ae.forEach((f,F)=>{var q,ce;const R=j.getRigidBody(F),b=J.get(F);if((b!=null&&b.onSleep||b!=null&&b.onWake)&&(R.isSleeping()&&!f.isSleeping&&((q=b==null?void 0:b.onSleep)==null||q.call(b)),!R.isSleeping()&&f.isSleeping&&((ce=b==null?void 0:b.onWake)==null||ce.call(b)),f.isSleeping=R.isSleeping()),!R||R.isSleeping()&&!("isInstancedMesh"in f.object)||!f.setMatrix)return;let S=R.translation(),I=R.rotation(),N=le.previousState[F];N&&(pe.compose(N.position,st(N.rotation),f.scale).premultiply(f.invertedWorldMatrix).decompose(z,se,Ee),f.meshType=="mesh"&&(f.object.position.copy(z),f.object.quaternion.copy(se))),pe.compose(S,st(I),f.scale).premultiply(f.invertedWorldMatrix).decompose(z,se,Ee),f.meshType=="instancedMesh"?f.setMatrix(pe):(f.object.position.lerp(z,de),f.object.quaternion.slerp(se,de))}),xe.drainCollisionEvents((f,F,R)=>{var q,ce,ee,fe,te,me,r,d,u,v,A,w,g,re,ne,W,oe,ge,X,Ce,L,Qe,Be,Xe;const b=ye(f),S=ye(F);if(!(b!=null&&b.collider.object)||!(S!=null&&S.collider.object))return;const I=De(b,S),N=De(S,b);R?j.contactPair(b.collider.object,S.collider.object,(_e,ke)=>{var Ne,Ze,Ie,Ke,We,et,Ve,tt;(Ze=(Ne=b.rigidBody.events)==null?void 0:Ne.onCollisionEnter)==null||Ze.call(Ne,{...I,manifold:_e,flipped:ke}),(Ke=(Ie=S.rigidBody.events)==null?void 0:Ie.onCollisionEnter)==null||Ke.call(Ie,{...N,manifold:_e,flipped:ke}),(et=(We=b.collider.events)==null?void 0:We.onCollisionEnter)==null||et.call(We,{...I,manifold:_e,flipped:ke}),(tt=(Ve=S.collider.events)==null?void 0:Ve.onCollisionEnter)==null||tt.call(Ve,{...N,manifold:_e,flipped:ke})}):((ce=(q=b.rigidBody.events)==null?void 0:q.onCollisionExit)==null||ce.call(q,I),(fe=(ee=S.rigidBody.events)==null?void 0:ee.onCollisionExit)==null||fe.call(ee,N),(me=(te=b.collider.events)==null?void 0:te.onCollisionExit)==null||me.call(te,I),(d=(r=S.collider.events)==null?void 0:r.onCollisionExit)==null||d.call(r,N)),R?j.intersectionPair(b.collider.object,S.collider.object)&&((v=(u=b.rigidBody.events)==null?void 0:u.onIntersectionEnter)==null||v.call(u,I),(w=(A=S.rigidBody.events)==null?void 0:A.onIntersectionEnter)==null||w.call(A,N),(re=(g=b.collider.events)==null?void 0:g.onIntersectionEnter)==null||re.call(g,I),(W=(ne=S.collider.events)==null?void 0:ne.onIntersectionEnter)==null||W.call(ne,N)):((ge=(oe=b.rigidBody.events)==null?void 0:oe.onIntersectionExit)==null||ge.call(oe,I),(Ce=(X=S.rigidBody.events)==null?void 0:X.onIntersectionExit)==null||Ce.call(X,N),(Qe=(L=b.collider.events)==null?void 0:L.onIntersectionExit)==null||Qe.call(L,I),(Xe=(Be=S.collider.events)==null?void 0:Be.onIntersectionExit)==null||Xe.call(Be,N))}),xe.drainContactForceEvents(f=>{var I,N,q,ce,ee,fe,te,me;const F=ye(f.collider1()),R=ye(f.collider2());if(!(F!=null&&F.collider.object)||!(R!=null&&R.collider.object))return;const b=De(F,R),S=De(R,F);(N=(I=F.rigidBody.events)==null?void 0:I.onContactForce)==null||N.call(I,{...b,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(ce=(q=R.rigidBody.events)==null?void 0:q.onContactForce)==null||ce.call(q,{...S,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(fe=(ee=F.collider.events)==null?void 0:ee.onContactForce)==null||fe.call(ee,{...b,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()}),(me=(te=R.collider.events)==null?void 0:te.onContactForce)==null||me.call(te,{...S,totalForce:f.totalForce(),totalForceMagnitude:f.totalForceMagnitude(),maxForceDirection:f.maxForceDirection(),maxForceMagnitude:f.maxForceMagnitude()})}),j.forEachActiveRigidBody(()=>{_()})},[i,n,s,T]),Oe=c.useMemo(()=>({rapier:B,world:T,setWorld:H=>{qe(H)},physicsOptions:{colliders:t,gravity:p},rigidBodyStates:ae,colliderStates:k,rigidBodyEvents:J,colliderEvents:je,beforeStepCallbacks:we,afterStepCallbacks:Se,isPaused:i,isDebug:E,step:Z,filterContactPairHooks:he,filterIntersectionPairHooks:Re}),[i,Z,E,t,p]),ue=c.useCallback(H=>{i||Z(H)},[i,Z]);return C.jsxs(vt.Provider,{value:Oe,children:[C.jsx(ir,{onStep:ue,type:l,updatePriority:a}),E&&C.jsx(xr,{}),o]})},Ye=(e,t=null)=>{const o=c.useRef(t);return e&&typeof e!="function"?(e.current||(e.current=o.current),e):o},Ue=(e,t,o)=>{const n=c.useRef(void 0),i=c.useCallback(()=>(n.current||(n.current=e()),n.current),o);return c.useEffect(()=>{const s=i(),a=()=>t(s);return()=>{a(),n.current=void 0}},[i]),i},wr=e=>{const t=mt((e==null?void 0:e.type)||"dynamic"),o=new G.RigidBodyDesc(t);return o.canSleep=(e==null?void 0:e.canSleep)??!0,o},Sr=({rigidBody:e,object:t,setMatrix:o,getMatrix:n,worldScale:i,meshType:s="mesh"})=>{t.updateWorldMatrix(!0,!1);const a=t.parent.matrixWorld.clone().invert();return{object:t,rigidBody:e,invertedWorldMatrix:a,setMatrix:o||(l=>{t.matrix.copy(l)}),getMatrix:n||(l=>l.copy(t.matrix)),scale:i||t.getWorldScale(Ee).clone(),isSleeping:!1,meshType:s}},jr=["args","colliders","canSleep"],xt={gravityScale:(e,t)=>{e.setGravityScale(t,!0)},additionalSolverIterations(e,t){e.setAdditionalSolverIterations(t)},linearDamping:(e,t)=>{e.setLinearDamping(t)},angularDamping:(e,t)=>{e.setAngularDamping(t)},dominanceGroup:(e,t)=>{e.setDominanceGroup(t)},enabledRotations:(e,[t,o,n])=>{e.setEnabledRotations(t,o,n,!0)},enabledTranslations:(e,[t,o,n])=>{e.setEnabledTranslations(t,o,n,!0)},lockRotations:(e,t)=>{e.lockRotations(t,!0)},lockTranslations:(e,t)=>{e.lockTranslations(t,!0)},angularVelocity:(e,[t,o,n])=>{e.setAngvel({x:t,y:o,z:n},!0)},linearVelocity:(e,[t,o,n])=>{e.setLinvel({x:t,y:o,z:n},!0)},ccd:(e,t)=>{e.enableCcd(t)},softCcdPrediction:(e,t)=>{e.setSoftCcdPrediction(t)},userData:(e,t)=>{e.userData=t},type(e,t){e.setBodyType(mt(t),!0)},position:()=>{},rotation:()=>{},quaternion:()=>{},scale:()=>{}},ht=Object.keys(xt),Pr=(e,t,o,n=!0)=>{if(!e)return;const i=o.get(e.handle);i&&(n&&(i.object.updateWorldMatrix(!0,!1),pe.copy(i.object.matrixWorld).decompose(z,se,Ee),e.setTranslation(z,!1),e.setRotation(se,!1)),ht.forEach(s=>{s in t&&xt[s](e,t[s])}))},Ar=(e,t,o,n=!0)=>{const i=c.useMemo(()=>ht.flatMap(s=>gt(t[s])),[t]);c.useEffect(()=>{const s=e();Pr(s,t,o,n)},i)},Mr=(e,t,o)=>{const{onWake:n,onSleep:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p}=t,m={onWake:n,onSleep:i,onCollisionEnter:s,onCollisionExit:a,onIntersectionEnter:l,onIntersectionExit:E,onContactForce:p};c.useEffect(()=>{const P=e();return o.set(P.handle,m),()=>{o.delete(P.handle)}},[n,i,s,a,l,E,p])},Rt=({x:e,y:t,z:o}={x:0,y:0,z:0})=>new x.Vector3(e,t,o),Tr=({x:e,y:t,z:o,w:n}={x:0,y:0,z:0,w:1})=>new x.Quaternion(e,t,o,n),Fr=({x:e,y:t,z:o}={x:0,y:0,z:0})=>new x.Euler(e,t,o),U=c.memo(e=>{const{children:t,position:o,rotation:n,quaternion:i,scale:s,name:a}=e,{world:l,colliderEvents:E,colliderStates:p}=D(),m=_t(),P=Ye(e.ref),h=c.useRef(null),O=ar.flatMap(y=>Array.isArray(e[y])?e[y]:[e[y]]),M=Ue(()=>{const y=h.current.getWorldScale(Rt()),V=cr(e,l,y,m==null?void 0:m.getRigidBody);return typeof e.ref=="function"&&e.ref(V),P.current=V,V},y=>{l.getCollider(y.handle)&&l.removeCollider(y,!0)},[...O,m]);c.useEffect(()=>{const y=M();return p.set(y.handle,mr(y,h.current,m==null?void 0:m.ref.current)),()=>{p.delete(y.handle)}},[M]);const Q=c.useMemo(()=>({...Ct(m==null?void 0:m.options),...e}),[e,m==null?void 0:m.options]);return dr(M,Q,p),br(M,Q,E,bt(m==null?void 0:m.options)),C.jsx("object3D",{position:o,rotation:n,quaternion:i,scale:s,ref:h,name:a,children:t})}),wt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cuboid",ref:t}));wt.displayName="CuboidCollider";const St=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCuboid",ref:t}));St.displayName="RoundCuboidCollider";const jt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"ball",ref:t}));jt.displayName="BallCollider";const Pt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"capsule",ref:t}));Pt.displayName="CapsuleCollider";const At=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"heightfield",ref:t}));At.displayName="HeightfieldCollider";const Mt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"trimesh",ref:t}));Mt.displayName="TrimeshCollider";const Tt=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cone",ref:t}));Tt.displayName="ConeCollider";const Ft=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCone",ref:t}));Ft.displayName="RoundConeCollider";const $e=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"cylinder",ref:t}));$e.displayName="CylinderCollider";const Or=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"roundCylinder",ref:t}));$e.displayName="RoundCylinderCollider";const Ot=c.forwardRef((e,t)=>C.jsx(U,{...e,shape:"convexHull",ref:t}));Ot.displayName="ConvexHullCollider";const Bt=c.createContext(void 0),_t=()=>c.useContext(Bt),Le=c.memo(e=>{const{ref:t,children:o,type:n,position:i,rotation:s,scale:a,quaternion:l,transformState:E,...p}=e,m=c.useRef(null),P=Ye(t),{world:h,rigidBodyStates:O,physicsOptions:M,rigidBodyEvents:Q}=D(),y=c.useMemo(()=>({...M,...e,children:void 0}),[M,e]),V=jr.flatMap(k=>Array.isArray(y[k])?[...y[k]]:y[k]),B=Ge(m,y),_=Ue(()=>{const k=wr(y),J=h.createRigidBody(k);return typeof t=="function"&&t(J),P.current=J,J},k=>{h.getRigidBody(k.handle)&&h.removeRigidBody(k)},V);c.useEffect(()=>{const k=_(),J=Sr({rigidBody:k,object:m.current});return O.set(k.handle,e.transformState?e.transformState(J):J),()=>{O.delete(k.handle)}},[_]),Ar(_,y,O),Mr(_,y,Q);const ae=c.useMemo(()=>({ref:m,getRigidBody:_,options:y}),[_]);return C.jsx(Bt.Provider,{value:ae,children:C.jsxs("object3D",{ref:m,...p,position:i,rotation:s,quaternion:l,scale:a,children:[o,B.map((k,J)=>C.jsx(U,{...k},J))]})})});Le.displayName="RigidBody";const kt=c.memo(e=>{const{children:t,type:o}=e,{physicsOptions:n}=D(),i=c.useRef(null),{options:s}=_t(),a=c.useMemo(()=>({...n,...s,children:void 0,colliders:o}),[n,s]),l=Ge(i,a,!1);return C.jsxs("object3D",{ref:i,userData:{r3RapierType:"MeshCollider"},children:[t,l.map((E,p)=>C.jsx(U,{...E},p))]})});kt.displayName="MeshCollider";const Nt=c.memo(({ref:e,...t})=>{const o=Ye(e,[]),n=c.useRef(null),i=c.useRef(null),{children:s,instances:a,colliderNodes:l=[],position:E,rotation:p,quaternion:m,scale:P,...h}=t,O=Ge(n,{...t,children:void 0}),M=()=>{const y=i.current.children[0];if(y&&"isInstancedMesh"in y)return y};c.useEffect(()=>{const y=M();y?y.instanceMatrix.setUsage(x.DynamicDrawUsage):console.warn("InstancedRigidBodies expects exactly one child, which must be an InstancedMesh")},[]);const Q=(y,V)=>{const B=M();return B?{...y,getMatrix:_=>(B.getMatrixAt(V,_),_),setMatrix:_=>{B.setMatrixAt(V,_),B.instanceMatrix.needsUpdate=!0},meshType:"instancedMesh"}:y};return C.jsxs("object3D",{ref:n,...h,position:E,rotation:p,quaternion:m,scale:P,children:[C.jsx("object3D",{ref:i,children:s}),a==null?void 0:a.map((y,V)=>C.jsx(Le,{...h,...y,ref:B=>{o.current[V]=B},transformState:B=>Q(B,V),children:C.jsxs(C.Fragment,{children:[l.map((B,_)=>C.jsx(c.Fragment,{children:B},_)),O.map((B,_)=>C.jsx(U,{...B},_))]})}))]})});Nt.displayName="InstancedRigidBodies";const ve=(e,t,o)=>{const{world:n}=D(),i=c.useRef(void 0);return Ue(()=>{if(e.current&&t.current){const s=n.createImpulseJoint(o,e.current,t.current,!0);return i.current=s,s}},s=>{s&&(i.current=void 0,n.getImpulseJoint(s.handle)&&n.removeImpulseJoint(s,!0))},[]),i},Br=(e,t,[o,n,i,s])=>{const{rapier:a}=D();return ve(e,t,a.JointData.fixed(Y(o),ct(n),Y(i),ct(s)))},_r=(e,t,[o,n])=>{const{rapier:i}=D();return ve(e,t,i.JointData.spherical(Y(o),Y(n)))},kr=(e,t,[o,n,i,s])=>{const{rapier:a}=D(),l=a.JointData.revolute(Y(o),Y(n),Y(i));return s&&(l.limitsEnabled=!0,l.limits=s),ve(e,t,l)},Nr=(e,t,[o,n,i,s])=>{const{rapier:a}=D(),l=a.JointData.prismatic(Y(o),Y(n),Y(i));return s&&(l.limitsEnabled=!0,l.limits=s),ve(e,t,l)},Ir=(e,t,[o,n,i])=>{const{rapier:s}=D(),a=Y(o),l=Y(n),E=s.JointData.rope(i,a,l);return ve(e,t,E)},Wr=(e,t,[o,n,i,s,a])=>{const{rapier:l}=D(),E=Y(o),p=Y(n),m=l.JointData.spring(i,s,a,E,p);return ve(e,t,m)},Vr=(e,t)=>(ut(e)<<16)+(t!==void 0?ut(t):65535),ut=e=>[e].flat().reduce((t,o)=>t|1<<o,0),zr=new x.Vector3,It=e=>{const{scene:t}=Fe.useThree(),o=c.useRef(null),n=c.useRef(null),i=e.strength>0?255:16711680;return c.useEffect(()=>(o.current=new x.Mesh(new x.SphereGeometry(.2,6,6),new x.MeshBasicMaterial({color:i,wireframe:!0})),n.current=new ft.VertexNormalsHelper(o.current,e.range,i),n.current.frustumCulled=!1,t.add(o.current),t.add(n.current),()=>{n.current&&o.current&&(t.remove(n.current),t.remove(o.current))}),[e,i]),Fe.useFrame(()=>{var s;if(o.current&&e.object.current){const a=e.object.current.getWorldPosition(zr);o.current.position.copy(a),(s=n.current)==null||s.update()}}),null},Dr={static:(e,t,o,n,i)=>e,linear:(e,t,o,n,i)=>e*(n/o),newtonian:(e,t,o,n,i)=>i*e*t/Math.pow(n,2)},He=new x.Vector3,dt=new x.Vector3,Wt=(e,{object:t,strength:o,range:n,gravitationalConstant:i,collisionGroups:s,type:a})=>{const l=e.translation();He.set(l.x,l.y,l.z);const E=t.getWorldPosition(new x.Vector3),p=E.distanceTo(He);if(p<n){let m=Dr[a](o,e.mass(),n,p,i);m=m===1/0?o:m;let P=s===void 0;if(s!==void 0)for(let h=0;h<e.numColliders();h++){const M=e.collider(h).collisionGroups();if((s>>16&M)!=0&&(M>>16&s)!=0){P=!0;break}}P&&(dt.set(0,0,0).subVectors(E,He).normalize().multiplyScalar(m),e.applyImpulse(dt,!0))}},Jr=c.memo(e=>{const{position:t=[0,0,0],strength:o=1,range:n=10,type:i="static",gravitationalConstant:s=6673e-14,collisionGroups:a}=e,l=c.useRef(null),{isDebug:E}=D();return Et(p=>{l.current&&p.bodies.forEach(m=>{m.isDynamic()&&Wt(m,{object:l.current,strength:o,range:n,type:i,gravitationalConstant:s,collisionGroups:a})})}),C.jsxs(C.Fragment,{children:[C.jsx("object3D",{ref:l,position:t}),E&&C.jsx(It,{strength:o,gravitationalConstant:s,range:n,type:i,collisionGroups:a,object:l})]})});Object.defineProperty(exports,"CoefficientCombineRule",{enumerable:!0,get:()=>G.CoefficientCombineRule});Object.defineProperty(exports,"RapierCollider",{enumerable:!0,get:()=>G.Collider});Object.defineProperty(exports,"RapierRigidBody",{enumerable:!0,get:()=>G.RigidBody});exports.AnyCollider=U;exports.Attractor=Jr;exports.AttractorDebugHelper=It;exports.BallCollider=jt;exports.CapsuleCollider=Pt;exports.ConeCollider=Tt;exports.ConvexHullCollider=Ot;exports.CuboidCollider=wt;exports.CylinderCollider=$e;exports.HeightfieldCollider=At;exports.InstancedRigidBodies=Nt;exports.MeshCollider=kt;exports.Physics=Rr;exports.RigidBody=Le;exports.RoundConeCollider=Ft;exports.RoundCuboidCollider=St;exports.RoundCylinderCollider=Or;exports.TrimeshCollider=Mt;exports.applyAttractorForceOnRigidBody=Wt;exports.euler=Fr;exports.interactionGroups=Vr;exports.quat=Tr;exports.useAfterPhysicsStep=Cr;exports.useBeforePhysicsStep=Et;exports.useFilterContactPair=Er;exports.useFilterIntersectionPair=vr;exports.useFixedJoint=Br;exports.useImpulseJoint=ve;exports.usePrismaticJoint=Nr;exports.useRapier=D;exports.useRevoluteJoint=kr;exports.useRopeJoint=Ir;exports.useSphericalJoint=_r;exports.useSpringJoint=Wr;exports.vec3=Rt;
|
package/dist/index.esm.js
CHANGED
package/package.json
CHANGED
|
@@ -268,7 +268,9 @@ const getCollisionPayloadFromSource = (
|
|
|
268
268
|
|
|
269
269
|
const importRapier = async () => {
|
|
270
270
|
let r = await import("@dimforge/rapier3d-compat");
|
|
271
|
-
|
|
271
|
+
|
|
272
|
+
// @ts-expect-error - Passing empty object to avoid deprecation warning in console
|
|
273
|
+
await r.init({});
|
|
272
274
|
return r;
|
|
273
275
|
};
|
|
274
276
|
|