@threlte/rapier 3.3.0 → 3.4.1
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/Colliders/AutoColliders/AutoColliders.svelte +5 -4
- package/dist/components/Colliders/Collider/Collider.svelte +5 -4
- package/dist/components/RigidBody/RigidBody.svelte +5 -4
- package/dist/lib/getWorldTransforms.d.ts +1 -11
- package/dist/lib/getWorldTransforms.js +1 -17
- package/dist/lib/scaleColliderArgs.d.ts +0 -1
- package/dist/lib/scaleColliderArgs.js +1 -1
- package/package.json +6 -7
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
generics="TMassDef extends MassDef"
|
|
4
4
|
>
|
|
5
5
|
import { ActiveCollisionTypes, CoefficientCombineRule } from '@dimforge/rapier3d-compat'
|
|
6
|
-
import { createParentObject3DContext, useParentObject3D
|
|
6
|
+
import { createParentObject3DContext, useParentObject3D } from '@threlte/core'
|
|
7
7
|
import { onDestroy, onMount } from 'svelte'
|
|
8
8
|
import { Group } from 'three'
|
|
9
9
|
import { useCollisionGroups } from '../../../hooks/useCollisionGroups.js'
|
|
@@ -126,10 +126,11 @@
|
|
|
126
126
|
|
|
127
127
|
const parent3DObject = useParentObject3D()
|
|
128
128
|
createParentObject3DContext(group)
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
|
|
130
|
+
$effect.pre(() => {
|
|
131
|
+
$parent3DObject?.add(group)
|
|
131
132
|
return () => {
|
|
132
|
-
|
|
133
|
+
$parent3DObject?.remove(group)
|
|
133
134
|
}
|
|
134
135
|
})
|
|
135
136
|
</script>
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
CoefficientCombineRule,
|
|
8
8
|
ColliderDesc
|
|
9
9
|
} from '@dimforge/rapier3d-compat'
|
|
10
|
-
import { createParentObject3DContext, useParentObject3D, useTask
|
|
10
|
+
import { createParentObject3DContext, useParentObject3D, useTask } from '@threlte/core'
|
|
11
11
|
import { onDestroy, onMount, tick } from 'svelte'
|
|
12
12
|
import { Object3D, Quaternion, Vector3 } from 'three'
|
|
13
13
|
import { useCollisionGroups } from '../../../hooks/useCollisionGroups.js'
|
|
@@ -190,10 +190,11 @@
|
|
|
190
190
|
|
|
191
191
|
const parent3DObject = useParentObject3D()
|
|
192
192
|
createParentObject3DContext(object)
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
|
|
194
|
+
$effect.pre(() => {
|
|
195
|
+
$parent3DObject?.add(object)
|
|
195
196
|
return () => {
|
|
196
|
-
|
|
197
|
+
$parent3DObject?.remove(object)
|
|
197
198
|
}
|
|
198
199
|
})
|
|
199
200
|
</script>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import { createParentObject3DContext, useParentObject3D
|
|
2
|
+
import { createParentObject3DContext, useParentObject3D } from '@threlte/core'
|
|
3
3
|
import { onDestroy, setContext, tick } from 'svelte'
|
|
4
4
|
import { Object3D, Vector3 } from 'three'
|
|
5
5
|
import { useRapier } from '../../hooks/useRapier.js'
|
|
@@ -178,10 +178,11 @@
|
|
|
178
178
|
|
|
179
179
|
const parent3DObject = useParentObject3D()
|
|
180
180
|
createParentObject3DContext(object)
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
|
|
182
|
+
$effect(() => {
|
|
183
|
+
$parent3DObject?.add(object)
|
|
183
184
|
return () => {
|
|
184
|
-
|
|
185
|
+
$parent3DObject?.remove(object)
|
|
185
186
|
}
|
|
186
187
|
})
|
|
187
188
|
</script>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Object3D, Quaternion, Vector3 } from 'three';
|
|
2
2
|
/**
|
|
3
3
|
* Get the world position of an object.
|
|
4
4
|
* If no target is provided, a globally used
|
|
@@ -19,16 +19,6 @@ export declare const getWorldPosition: (object: Object3D, target?: Vector3) => V
|
|
|
19
19
|
* @returns
|
|
20
20
|
*/
|
|
21
21
|
export declare const getWorldQuaternion: (object: Object3D, target?: Quaternion) => Quaternion;
|
|
22
|
-
/**
|
|
23
|
-
* Get the world rotation of an object.
|
|
24
|
-
* If no target is provided, a globally used
|
|
25
|
-
* temporary Euler is used.
|
|
26
|
-
*
|
|
27
|
-
* @param object
|
|
28
|
-
* @param target
|
|
29
|
-
* @returns
|
|
30
|
-
*/
|
|
31
|
-
export declare const getWorldRotation: (object: Object3D, target?: Euler) => Euler;
|
|
32
22
|
/**
|
|
33
23
|
* Get the world scale of an object.
|
|
34
24
|
* If no target is provided, a globally used
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Object3D, Quaternion, Vector3 } from 'three';
|
|
2
2
|
const tempPosition = new Vector3();
|
|
3
3
|
const tempQuaternion = new Quaternion();
|
|
4
|
-
const tempRotation = new Euler();
|
|
5
4
|
const tempScale = new Vector3();
|
|
6
5
|
/**
|
|
7
6
|
* Get the world position of an object.
|
|
@@ -27,21 +26,6 @@ export const getWorldPosition = (object, target) => {
|
|
|
27
26
|
export const getWorldQuaternion = (object, target) => {
|
|
28
27
|
return object.getWorldQuaternion(target ?? tempQuaternion);
|
|
29
28
|
};
|
|
30
|
-
/**
|
|
31
|
-
* Get the world rotation of an object.
|
|
32
|
-
* If no target is provided, a globally used
|
|
33
|
-
* temporary Euler is used.
|
|
34
|
-
*
|
|
35
|
-
* @param object
|
|
36
|
-
* @param target
|
|
37
|
-
* @returns
|
|
38
|
-
*/
|
|
39
|
-
export const getWorldRotation = (object, target) => {
|
|
40
|
-
object.getWorldQuaternion(tempQuaternion);
|
|
41
|
-
return target
|
|
42
|
-
? target.setFromQuaternion(tempQuaternion)
|
|
43
|
-
: tempRotation.setFromQuaternion(tempQuaternion);
|
|
44
|
-
};
|
|
45
29
|
/**
|
|
46
30
|
* Get the world scale of an object.
|
|
47
31
|
* If no target is provided, a globally used
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { ColliderDesc } from '@dimforge/rapier3d-compat';
|
|
2
2
|
import type { Vector3 } from 'three';
|
|
3
3
|
import type { ColliderShapes } from '../types/types.js';
|
|
4
|
-
export declare const scaleVertices: (vertices: ArrayLike<number>, scale: Vector3) => number[];
|
|
5
4
|
export declare const scaleColliderArgs: <Shape extends ColliderShapes>(shape: Shape, args: Parameters<(typeof ColliderDesc)[Shape]>, scale: Vector3) => Parameters<(typeof ColliderDesc)[Shape]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/rapier",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.1",
|
|
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",
|
|
@@ -17,20 +17,19 @@
|
|
|
17
17
|
"eslint": "^9.26.0",
|
|
18
18
|
"eslint-plugin-svelte": "^3.5.1",
|
|
19
19
|
"globals": "^16.1.0",
|
|
20
|
-
"prettier": "^3.
|
|
21
|
-
"prettier-plugin-svelte": "^3.
|
|
20
|
+
"prettier": "^3.8.1",
|
|
21
|
+
"prettier-plugin-svelte": "^3.5.1",
|
|
22
22
|
"publint": "^0.2.7",
|
|
23
23
|
"rimraf": "^6.0.1",
|
|
24
|
-
"svelte": "5.
|
|
24
|
+
"svelte": "5.53.6",
|
|
25
25
|
"svelte-check": "^4.3.1",
|
|
26
|
-
"svelte2tsx": "^0.7.6",
|
|
27
26
|
"three": "^0.175.0",
|
|
28
27
|
"tslib": "^2.6.2",
|
|
29
28
|
"type-fest": "^4.15.0",
|
|
30
29
|
"typescript": "5.9.2",
|
|
31
30
|
"typescript-eslint": "^8.32.0",
|
|
32
31
|
"vite": "^7.1.4",
|
|
33
|
-
"@threlte/core": "8.
|
|
32
|
+
"@threlte/core": "8.5.1"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
35
|
"@dimforge/rapier3d-compat": ">=0.16",
|
|
@@ -50,7 +49,7 @@
|
|
|
50
49
|
"homepage": "https://threlte.xyz",
|
|
51
50
|
"repository": {
|
|
52
51
|
"type": "git",
|
|
53
|
-
"url": "https://github.com/threlte/threlte
|
|
52
|
+
"url": "https://github.com/threlte/threlte",
|
|
54
53
|
"directory": "packages/rapier"
|
|
55
54
|
},
|
|
56
55
|
"bugs": {
|