@threlte/rapier 3.2.0 → 3.4.0

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.
@@ -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, watch } from '@threlte/core'
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
- watch(parent3DObject, (parent) => {
130
- parent?.add(group)
129
+
130
+ $effect.pre(() => {
131
+ $parent3DObject?.add(group)
131
132
  return () => {
132
- parent?.remove(group)
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, watch } from '@threlte/core'
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'
@@ -168,20 +168,15 @@
168
168
  * If the Collider isAttached (i.e. NOT child of a RigidBody), update the
169
169
  * transforms on every frame.
170
170
  */
171
- const { start, stop } = useTask(
171
+ useTask(
172
172
  () => {
173
173
  refresh()
174
174
  },
175
175
  {
176
- autoStart: !hasRigidBodyParent && type === 'dynamic'
176
+ running: () => !hasRigidBodyParent && type === 'dynamic'
177
177
  }
178
178
  )
179
179
 
180
- $effect.pre(() => {
181
- if (!hasRigidBodyParent && type === 'dynamic') start()
182
- else stop()
183
- })
184
-
185
180
  /**
186
181
  * Cleanup
187
182
  */
@@ -195,10 +190,11 @@
195
190
 
196
191
  const parent3DObject = useParentObject3D()
197
192
  createParentObject3DContext(object)
198
- watch(parent3DObject, (parent) => {
199
- parent?.add(object)
193
+
194
+ $effect.pre(() => {
195
+ $parent3DObject?.add(object)
200
196
  return () => {
201
- parent?.remove(object)
197
+ $parent3DObject?.remove(object)
202
198
  }
203
199
  })
204
200
  </script>
@@ -1,5 +1,5 @@
1
1
  <script lang="ts">
2
- import { createParentObject3DContext, useParentObject3D, watch } from '@threlte/core'
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
- watch(parent3DObject, (parent) => {
182
- parent?.add(object)
181
+
182
+ $effect(() => {
183
+ $parent3DObject?.add(object)
183
184
  return () => {
184
- parent?.remove(object)
185
+ $parent3DObject?.remove(object)
185
186
  }
186
187
  })
187
188
  </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/rapier",
3
- "version": "3.2.0",
3
+ "version": "3.4.0",
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,11 +17,11 @@
17
17
  "eslint": "^9.26.0",
18
18
  "eslint-plugin-svelte": "^3.5.1",
19
19
  "globals": "^16.1.0",
20
- "prettier": "^3.2.5",
21
- "prettier-plugin-svelte": "^3.2.2",
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.26.2",
24
+ "svelte": "5.53.6",
25
25
  "svelte-check": "^4.3.1",
26
26
  "svelte2tsx": "^0.7.6",
27
27
  "three": "^0.175.0",
@@ -30,7 +30,7 @@
30
30
  "typescript": "5.9.2",
31
31
  "typescript-eslint": "^8.32.0",
32
32
  "vite": "^7.1.4",
33
- "@threlte/core": "8.3.0"
33
+ "@threlte/core": "8.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@dimforge/rapier3d-compat": ">=0.16",
@@ -50,7 +50,7 @@
50
50
  "homepage": "https://threlte.xyz",
51
51
  "repository": {
52
52
  "type": "git",
53
- "url": "https://github.com/threlte/threlte.git",
53
+ "url": "https://github.com/threlte/threlte",
54
54
  "directory": "packages/rapier"
55
55
  },
56
56
  "bugs": {