@threlte/rapier 0.3.1 → 0.3.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/CHANGELOG.md +6 -0
- package/dist/hooks/useJoint.d.ts +2 -2
- package/dist/hooks/useJoint.js +7 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
package/dist/CHANGELOG.md
CHANGED
package/dist/hooks/useJoint.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { MultibodyJoint, type ImpulseJoint, type RigidBody } from '@dimforge/rapier3d-compat';
|
|
2
2
|
import type { RapierContext } from '../types/types';
|
|
3
|
-
export declare const useJoint: <T extends ImpulseJoint>(initializeJoint: (rigidBodyA: RigidBody, rigidBodyB: RigidBody, ctx: RapierContext) => T) => {
|
|
3
|
+
export declare const useJoint: <T extends ImpulseJoint | MultibodyJoint>(initializeJoint: (rigidBodyA: RigidBody, rigidBodyB: RigidBody, ctx: RapierContext) => T) => {
|
|
4
4
|
joint: import("svelte/store").Writable<T>;
|
|
5
5
|
rigidBodyA: import("svelte/store").Writable<RigidBody | undefined>;
|
|
6
6
|
rigidBodyB: import("svelte/store").Writable<RigidBody | undefined>;
|
package/dist/hooks/useJoint.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MultibodyJoint } from '@dimforge/rapier3d-compat';
|
|
1
2
|
import { onDestroy } from 'svelte';
|
|
2
3
|
import { derived, get, writable } from 'svelte/store';
|
|
3
4
|
import { useRapier } from './useRapier';
|
|
@@ -21,7 +22,12 @@ export const useJoint = (initializeJoint) => {
|
|
|
21
22
|
const j = get(joint);
|
|
22
23
|
if (!j)
|
|
23
24
|
return;
|
|
24
|
-
|
|
25
|
+
if (j instanceof MultibodyJoint) {
|
|
26
|
+
ctx.world.removeMultibodyJoint(j, true);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
ctx.world.removeImpulseJoint(j, true);
|
|
30
|
+
}
|
|
25
31
|
});
|
|
26
32
|
return {
|
|
27
33
|
joint,
|
package/dist/index.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export { useRevoluteJoint } from './hooks/useRevoluteJoint';
|
|
|
5
5
|
export { usePrismaticJoint } from './hooks/usePrismaticJoint';
|
|
6
6
|
export { useFixedJoint } from './hooks/useFixedJoint';
|
|
7
7
|
export { useSphericalJoint } from './hooks/useSphericalJoint';
|
|
8
|
+
export { useJoint } from './hooks/useJoint';
|
|
8
9
|
export { default as World } from './components/World/World.svelte';
|
|
9
10
|
export { default as RigidBody } from './components/RigidBody/RigidBody.svelte';
|
|
10
11
|
export { default as Debug } from './components/Debug/Debug.svelte';
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { useRevoluteJoint } from './hooks/useRevoluteJoint';
|
|
|
7
7
|
export { usePrismaticJoint } from './hooks/usePrismaticJoint';
|
|
8
8
|
export { useFixedJoint } from './hooks/useFixedJoint';
|
|
9
9
|
export { useSphericalJoint } from './hooks/useSphericalJoint';
|
|
10
|
+
export { useJoint } from './hooks/useJoint';
|
|
10
11
|
// components
|
|
11
12
|
export { default as World } from './components/World/World.svelte';
|
|
12
13
|
export { default as RigidBody } from './components/RigidBody/RigidBody.svelte';
|