@threlte/rapier 3.1.0 → 3.1.3
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/components/Attractor/Attractor.svelte +3 -3
- package/dist/components/Colliders/Collider/Collider.svelte +1 -1
- package/dist/components/World/World.svelte +1 -1
- package/dist/hooks/useCollisionGroups.js +2 -4
- package/dist/hooks/useFixedJoint.js +0 -1
- package/dist/hooks/useJoint.js +1 -1
- package/dist/hooks/usePrismaticJoint.js +0 -1
- package/dist/hooks/useRevoluteJoint.js +0 -1
- package/dist/hooks/useSphericalJoint.js +0 -1
- package/package.json +14 -14
|
@@ -6,9 +6,9 @@ const { world, debug } = useRapier();
|
|
|
6
6
|
const gravitySource = new Vector3();
|
|
7
7
|
const group = new Group();
|
|
8
8
|
const calcForceByType = {
|
|
9
|
-
static: (s,
|
|
10
|
-
linear: (s,
|
|
11
|
-
newtonian: (s, m2,
|
|
9
|
+
static: (s, _m2, _r, _d, _G) => s,
|
|
10
|
+
linear: (s, _m2, r, d, _G) => s * (d / r),
|
|
11
|
+
newtonian: (s, m2, _r, d, G) => (G * s * m2) / Math.pow(d, 2)
|
|
12
12
|
};
|
|
13
13
|
const impulseVector = new Vector3();
|
|
14
14
|
const bodyV3 = new Vector3();
|
|
@@ -38,7 +38,7 @@ onMount(async () => {
|
|
|
38
38
|
await tick();
|
|
39
39
|
const scale = object.getWorldScale(new Vector3());
|
|
40
40
|
const scaledArgs = scaleColliderArgs(shape, args, scale);
|
|
41
|
-
// @ts-
|
|
41
|
+
// @ts-expect-error
|
|
42
42
|
const colliderDesc = ColliderDesc[shape](...scaledArgs);
|
|
43
43
|
collider = world.createCollider(colliderDesc, rigidBody);
|
|
44
44
|
collider.setActiveCollisionTypes(ActiveCollisionTypes.ALL);
|
|
@@ -12,10 +12,8 @@ export const useCollisionGroups = () => {
|
|
|
12
12
|
const bitMaskStore = getContext('threlte-rapier-collision-group');
|
|
13
13
|
if (!bitMaskStore)
|
|
14
14
|
return {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
18
|
-
removeColliders: (colliders) => { }
|
|
15
|
+
registerColliders: () => { },
|
|
16
|
+
removeColliders: () => { }
|
|
19
17
|
};
|
|
20
18
|
let bitMask = get(bitMaskStore);
|
|
21
19
|
const unsubscribe = bitMaskStore.subscribe((newBitMask) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Euler, Quaternion, Vector3 } from 'three';
|
|
2
2
|
import { useJoint } from './useJoint';
|
|
3
3
|
import { isEuler, isVector3 } from './utils';
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
4
|
export const useFixedJoint = (anchorA, frameA, anchorB, frameB) => {
|
|
6
5
|
const jaA = isVector3(anchorA) ? anchorA : new Vector3(...anchorA);
|
|
7
6
|
const jfA = new Quaternion().setFromEuler(isEuler(frameA) ? frameA : new Euler(...frameA));
|
package/dist/hooks/useJoint.js
CHANGED
|
@@ -2,7 +2,6 @@ import { MultibodyJoint } from '@dimforge/rapier3d-compat';
|
|
|
2
2
|
import { onDestroy } from 'svelte';
|
|
3
3
|
import { derived, get, writable } from 'svelte/store';
|
|
4
4
|
import { useRapier } from './useRapier';
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
6
5
|
export const useJoint = (initializeJoint) => {
|
|
7
6
|
const rigidBodyA = writable(undefined);
|
|
8
7
|
const rigidBodyB = writable(undefined);
|
|
@@ -11,6 +10,7 @@ export const useJoint = (initializeJoint) => {
|
|
|
11
10
|
if (!!rbA && !!rbB) {
|
|
12
11
|
return [rbA, rbB];
|
|
13
12
|
}
|
|
13
|
+
return undefined;
|
|
14
14
|
});
|
|
15
15
|
const joint = writable(undefined);
|
|
16
16
|
const unsubscribeBodies = bodies.subscribe((bodies) => {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from 'three';
|
|
2
2
|
import { useJoint } from './useJoint';
|
|
3
3
|
import { isVector3 } from './utils';
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
4
|
export const usePrismaticJoint = (anchorA, anchorB, axis, limits) => {
|
|
6
5
|
return useJoint((rbA, rbB, { world, rapier }) => {
|
|
7
6
|
const jaA = isVector3(anchorA) ? anchorA : new Vector3(...anchorA);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from 'three';
|
|
2
2
|
import { useJoint } from './useJoint';
|
|
3
3
|
import { isVector3 } from './utils';
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
4
|
export const useRevoluteJoint = (anchorA, anchorB, axis, limits) => {
|
|
6
5
|
return useJoint((rbA, rbB, { world, rapier }) => {
|
|
7
6
|
const jaA = isVector3(anchorA) ? anchorA : new Vector3(...anchorA);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from 'three';
|
|
2
2
|
import { useJoint } from './useJoint';
|
|
3
3
|
import { isVector3 } from './utils';
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
5
4
|
export const useSphericalJoint = (anchorA, anchorB) => {
|
|
6
5
|
return useJoint((rbA, rbB, { world, rapier }) => {
|
|
7
6
|
const jaA = isVector3(anchorA) ? anchorA : new Vector3(...anchorA);
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/rapier",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.3",
|
|
4
4
|
"author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Components and hooks to use the Rapier physics engine in Threlte",
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@dimforge/rapier3d-compat": "^0.
|
|
8
|
+
"@dimforge/rapier3d-compat": "^0.16.2",
|
|
9
|
+
"@eslint/js": "^9.26.0",
|
|
9
10
|
"@sveltejs/adapter-auto": "^3.3.1",
|
|
10
11
|
"@sveltejs/kit": "^2.7.7",
|
|
11
12
|
"@sveltejs/package": "^2.3.7",
|
|
12
13
|
"@sveltejs/vite-plugin-svelte": "^4.0.0",
|
|
13
14
|
"@types/node": "^20.12.7",
|
|
14
|
-
"@types/three": "^0.
|
|
15
|
-
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
16
|
-
"@typescript-eslint/parser": "^7.6.0",
|
|
15
|
+
"@types/three": "^0.175.0",
|
|
17
16
|
"@yushijinhun/three-minifier-rollup": "^0.4.0",
|
|
18
|
-
"eslint": "^
|
|
19
|
-
"eslint-
|
|
20
|
-
"
|
|
17
|
+
"eslint": "^9.26.0",
|
|
18
|
+
"eslint-plugin-svelte": "^3.5.1",
|
|
19
|
+
"globals": "^16.1.0",
|
|
21
20
|
"prettier": "^3.2.5",
|
|
22
21
|
"prettier-plugin-svelte": "^3.2.2",
|
|
23
22
|
"publint": "^0.2.7",
|
|
24
23
|
"rimraf": "^5.0.5",
|
|
25
|
-
"svelte": "^5.
|
|
26
|
-
"svelte-check": "^
|
|
24
|
+
"svelte": "^5.26.2",
|
|
25
|
+
"svelte-check": "^4.1.7",
|
|
27
26
|
"svelte-preprocess": "^5.1.3",
|
|
28
27
|
"svelte2tsx": "^0.7.6",
|
|
29
|
-
"three": "^0.
|
|
28
|
+
"three": "^0.175.0",
|
|
30
29
|
"tslib": "^2.6.2",
|
|
31
30
|
"type-fest": "^4.15.0",
|
|
32
31
|
"typescript": "^5.6.3",
|
|
32
|
+
"typescript-eslint": "^8.32.0",
|
|
33
33
|
"vite": "^5.2.8",
|
|
34
|
-
"@threlte/core": "8.0.
|
|
34
|
+
"@threlte/core": "8.0.4"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
|
-
"@dimforge/rapier3d-compat": ">=0.
|
|
37
|
+
"@dimforge/rapier3d-compat": ">=0.16",
|
|
38
38
|
"svelte": ">=5",
|
|
39
39
|
"three": ">=0.152"
|
|
40
40
|
},
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"package": "svelte-kit sync && svelte-package && node ./scripts/cleanupPackage.js && publint",
|
|
74
74
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
75
75
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
76
|
-
"lint": "prettier --check .",
|
|
76
|
+
"lint": "prettier --check . && eslint .",
|
|
77
77
|
"format": "prettier --write .",
|
|
78
78
|
"cleanup": "rimraf node_modules .svelte-kit dist"
|
|
79
79
|
}
|