@threlte/rapier 2.0.0 → 2.0.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.
@@ -1,5 +1,5 @@
1
1
  import { Props, type Events, type Slots } from '@threlte/core'
2
- import { SvelteComponentTyped } from 'svelte'
2
+ import { SvelteComponent } from 'svelte'
3
3
  import type { Group } from 'three'
4
4
  import type { GravityType } from '../../types/types'
5
5
 
@@ -35,7 +35,7 @@ type AttractorEvents = Events<Group>
35
35
 
36
36
  type AttractorSlots = Slots<Group>
37
37
 
38
- export default class Attractor extends SvelteComponentTyped<
38
+ export default class Attractor extends SvelteComponent<
39
39
  AttractorProps,
40
40
  AttractorEvents,
41
41
  AttractorSlots
@@ -57,10 +57,10 @@ export type MassDef = Density | Mass | MassProperties | NoMassProperties
57
57
  type MassProps<TMassDef extends MassDef> = TMassDef extends Density
58
58
  ? Density
59
59
  : TMassDef extends MassProperties
60
- ? MassProperties
61
- : TMassDef extends Mass
62
- ? Mass
63
- : NoMassProperties
60
+ ? MassProperties
61
+ : TMassDef extends Mass
62
+ ? Mass
63
+ : NoMassProperties
64
64
 
65
65
  // ------------------ COLLIDER ------------------
66
66
 
@@ -89,10 +89,10 @@ export type MassDef = Density | Mass | MassProperties | NoMassProperties
89
89
  type MassProps<TMassDef extends MassDef> = TMassDef extends Density
90
90
  ? Density
91
91
  : TMassDef extends MassProperties
92
- ? MassProperties
93
- : TMassDef extends Mass
94
- ? Mass
95
- : NoMassProperties
92
+ ? MassProperties
93
+ : TMassDef extends Mass
94
+ ? Mass
95
+ : NoMassProperties
96
96
 
97
97
  // ------------------ COLLIDER ------------------
98
98
 
@@ -58,7 +58,7 @@ export type RigidBodyProps = {
58
58
  enabledRotations?: Boolean3Array
59
59
 
60
60
  /**
61
- * Allow rotation of this rigid-body only along specific axes.
61
+ * Allow translations of this rigid-body only along specific axes.
62
62
  */
63
63
  enabledTranslations?: Boolean3Array
64
64
 
@@ -1,22 +1,7 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
+ import type { WorldProps } from './World.svelte';
2
3
  declare const __propDef: {
3
- props: {
4
- gravity?: [x: number, y: number, z: number] | undefined;
5
- rawIntegrationParameters?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawIntegrationParameters | undefined;
6
- rawIslands?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawIslandManager | undefined;
7
- rawBroadPhase?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawBroadPhase | undefined;
8
- rawNarrowPhase?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawNarrowPhase | undefined;
9
- rawBodies?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawRigidBodySet | undefined;
10
- rawColliders?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawColliderSet | undefined;
11
- rawImpulseJoints?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawImpulseJointSet | undefined;
12
- rawMultibodyJoints?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawMultibodyJointSet | undefined;
13
- rawCCDSolver?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawCCDSolver | undefined;
14
- rawQueryPipeline?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawQueryPipeline | undefined;
15
- rawPhysicsPipeline?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawPhysicsPipeline | undefined;
16
- rawSerializationPipeline?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawSerializationPipeline | undefined;
17
- rawDebugRenderPipeline?: import("@dimforge/rapier3d-compat/rapier_wasm3d").RawDebugRenderPipeline | undefined;
18
- stage?: import("@threlte/core").Key | import("@threlte/core").Stage | undefined;
19
- };
4
+ props: WorldProps;
20
5
  events: {
21
6
  [evt: string]: CustomEvent<any>;
22
7
  };
@@ -27,6 +12,6 @@ declare const __propDef: {
27
12
  export type InnerWorldProps = typeof __propDef.props;
28
13
  export type InnerWorldEvents = typeof __propDef.events;
29
14
  export type InnerWorldSlots = typeof __propDef.slots;
30
- export default class InnerWorld extends SvelteComponentTyped<InnerWorldProps, InnerWorldEvents, InnerWorldSlots> {
15
+ export default class InnerWorld extends SvelteComponent<InnerWorldProps, InnerWorldEvents, InnerWorldSlots> {
31
16
  }
32
17
  export {};
@@ -27,10 +27,10 @@ export let rawPhysicsPipeline = undefined;
27
27
  export let rawSerializationPipeline = undefined;
28
28
  export let rawDebugRenderPipeline = undefined;
29
29
  /**
30
- * This is passed to the useTask handler.
31
- * Use this to control when the rapier physics engine is updating the scene.
32
- * @default undefined
33
- */
30
+ * This is passed to the useTask handler.
31
+ * Use this to control when the rapier physics engine is updating the scene.
32
+ * @default undefined
33
+ */
34
34
  export let stage = undefined;
35
35
  let error = false;
36
36
  const init = async () => {
@@ -63,7 +63,7 @@ onMount(init);
63
63
  {rawPhysicsPipeline}
64
64
  {rawSerializationPipeline}
65
65
  {rawDebugRenderPipeline}
66
- {stage}
66
+ {stage}
67
67
  >
68
68
  <slot />
69
69
  </InnerWorld>
@@ -1,4 +1,4 @@
1
- import { Collider, EventQueue } from '@dimforge/rapier3d-compat';
1
+ import { EventQueue } from '@dimforge/rapier3d-compat';
2
2
  import { useTask } from '@threlte/core';
3
3
  import { derived } from 'svelte/store';
4
4
  import { Object3D, Quaternion, Vector3 } from 'three';
@@ -1,5 +1,5 @@
1
- import { ActiveEvents, Collider, ColliderDesc, World, RigidBody } from '@dimforge/rapier3d-compat';
2
- import { Mesh, Quaternion, Vector3 } from 'three';
1
+ import { ActiveEvents, ColliderDesc } from '@dimforge/rapier3d-compat';
2
+ import { Quaternion, Vector3 } from 'three';
3
3
  const offset = new Vector3();
4
4
  const worldPosition = new Vector3();
5
5
  const worldQuaternion = new Quaternion();
@@ -1,4 +1,4 @@
1
- import { Euler, Object3D, Quaternion, Vector3 } from 'three';
1
+ import { Euler, Quaternion, Vector3 } from 'three';
2
2
  const tempPosition = new Vector3();
3
3
  const tempQuaternion = new Quaternion();
4
4
  const tempRotation = new Euler();
@@ -103,7 +103,10 @@ const onKeyUp = (e) => {
103
103
  };
104
104
  </script>
105
105
 
106
- <svelte:window on:keydown|preventDefault={onKeyDown} on:keyup|preventDefault={onKeyUp} />
106
+ <svelte:window
107
+ on:keydown|preventDefault={onKeyDown}
108
+ on:keyup|preventDefault={onKeyUp}
109
+ />
107
110
 
108
111
  <T.Group {position}>
109
112
  <RigidBody
@@ -113,7 +116,10 @@ const onKeyUp = (e) => {
113
116
  type={'dynamic'}
114
117
  >
115
118
  <CollisionGroups groups={playerCollisionGroups}>
116
- <Collider shape={'capsule'} args={[height / 2 - radius, radius]} />
119
+ <Collider
120
+ shape={'capsule'}
121
+ args={[height / 2 - radius, radius]}
122
+ />
117
123
  </CollisionGroups>
118
124
 
119
125
  <CollisionGroups groups={groundCollisionGroups}>
@@ -1,4 +1,4 @@
1
- import { SvelteComponentTyped } from "svelte";
1
+ import { SvelteComponent } from "svelte";
2
2
  import { Vector3 } from 'three';
3
3
  import type { CollisionGroupsBitMask } from '../types/types';
4
4
  declare const __propDef: {
@@ -21,6 +21,6 @@ declare const __propDef: {
21
21
  export type BasicPlayerControllerProps = typeof __propDef.props;
22
22
  export type BasicPlayerControllerEvents = typeof __propDef.events;
23
23
  export type BasicPlayerControllerSlots = typeof __propDef.slots;
24
- export default class BasicPlayerController extends SvelteComponentTyped<BasicPlayerControllerProps, BasicPlayerControllerEvents, BasicPlayerControllerSlots> {
24
+ export default class BasicPlayerController extends SvelteComponent<BasicPlayerControllerProps, BasicPlayerControllerEvents, BasicPlayerControllerSlots> {
25
25
  }
26
26
  export {};
@@ -1,3 +1,4 @@
1
+ /// <reference types="svelte" />
1
2
  import type { Collider, ColliderHandle, RigidBody, RigidBodyHandle, TempContactManifold, Vector } from '@dimforge/rapier3d-compat';
2
3
  import type { createRawEventDispatcher } from '@threlte/core';
3
4
  import type { Writable } from 'svelte/store';
package/package.json CHANGED
@@ -1,40 +1,62 @@
1
1
  {
2
2
  "name": "@threlte/rapier",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
+ "description": "Components and hooks to use the Rapier physics engine in Threlte",
6
7
  "devDependencies": {
7
8
  "@dimforge/rapier3d-compat": "^0.11.2",
8
- "@sveltejs/adapter-auto": "^2.0.0",
9
- "@sveltejs/kit": "^1.20.4",
10
- "@sveltejs/package": "^2.1.0",
11
- "@types/node": "^18.0.3",
12
- "@types/three": "^0.158.3",
13
- "@typescript-eslint/eslint-plugin": "^5.45.0",
14
- "@typescript-eslint/parser": "^5.45.0",
15
- "@yushijinhun/three-minifier-rollup": "^0.3.1",
16
- "eslint": "^8.28.0",
17
- "eslint-config-prettier": "^8.5.0",
18
- "eslint-plugin-svelte": "^2.30.0",
19
- "prettier": "^2.8.8",
20
- "prettier-plugin-svelte": "^2.10.1",
21
- "publint": "^0.1.12",
22
- "rimraf": "^5.0.1",
23
- "svelte-check": "^3.4.3",
24
- "svelte-preprocess": "^5.0.4",
25
- "svelte2tsx": "^0.6.19",
26
- "tslib": "^2.4.1",
27
- "type-fest": "^2.13.0",
28
- "typescript": "^5.0.0",
29
- "vite": "^4.3.6",
30
- "@threlte/core": "7.0.12"
9
+ "@sveltejs/adapter-auto": "^3.1.1",
10
+ "@sveltejs/kit": "^2.4.3",
11
+ "@sveltejs/package": "^2.2.6",
12
+ "@sveltejs/vite-plugin-svelte": "^3.0.0",
13
+ "@types/node": "^20.11.6",
14
+ "@types/three": "^0.160.0",
15
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
16
+ "@typescript-eslint/parser": "^6.19.1",
17
+ "@yushijinhun/three-minifier-rollup": "^0.4.0",
18
+ "eslint": "^8.56.0",
19
+ "eslint-config-prettier": "^9.1.0",
20
+ "eslint-plugin-svelte": "^2.35.1",
21
+ "prettier": "^3.2.4",
22
+ "prettier-plugin-svelte": "^3.1.2",
23
+ "publint": "^0.2.7",
24
+ "rimraf": "^5.0.5",
25
+ "svelte": "^4.2.9",
26
+ "svelte-check": "^3.6.3",
27
+ "svelte-preprocess": "^5.1.3",
28
+ "svelte2tsx": "^0.7.0",
29
+ "three": "^0.160.1",
30
+ "tslib": "^2.6.2",
31
+ "type-fest": "^4.10.1",
32
+ "typescript": "^5.3.3",
33
+ "vite": "^5.0.12",
34
+ "@threlte/core": "7.3.1"
31
35
  },
32
36
  "peerDependencies": {
37
+ "@dimforge/rapier3d-compat": ">=0.11",
33
38
  "svelte": ">=4",
34
- "three": ">=0.133",
35
- "@dimforge/rapier3d-compat": ">=0.11"
39
+ "three": ">=0.152"
36
40
  },
37
41
  "type": "module",
42
+ "keywords": [
43
+ "threlte",
44
+ "rapier",
45
+ "svelte",
46
+ "three",
47
+ "three.js",
48
+ "3d",
49
+ "physics"
50
+ ],
51
+ "homepage": "https://threlte.xyz",
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "https://github.com/threlte/threlte.git",
55
+ "directory": "packages/rapier"
56
+ },
57
+ "bugs": {
58
+ "url": "https://github.com/threlte/threlte/issues"
59
+ },
38
60
  "exports": {
39
61
  ".": {
40
62
  "types": "./dist/index.d.ts",