@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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @threlte/extras
2
2
 
3
+ ## 0.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - c7e226f: useJoint is now exported and its types are fixed
8
+
3
9
  ## 0.3.1
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
- import type { ImpulseJoint, RigidBody } from '@dimforge/rapier3d-compat';
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>;
@@ -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
- ctx.world.removeImpulseJoint(j, true);
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';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/rapier",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
6
  "devDependencies": {