@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.
- package/dist/components/Attractor/Attractor.svelte.d.ts +2 -2
- package/dist/components/Colliders/AutoColliders.svelte.d.ts +4 -4
- package/dist/components/Colliders/Collider.svelte.d.ts +4 -4
- package/dist/components/RigidBody/RigidBody.svelte.d.ts +1 -1
- package/dist/components/World/InnerWorld.svelte.d.ts +4 -19
- package/dist/components/World/World.svelte +5 -5
- package/dist/hooks/useFrameHandler.js +1 -1
- package/dist/lib/createCollidersFromChildren.js +2 -2
- package/dist/lib/getWorldTransforms.js +1 -1
- package/dist/recipes/BasicPlayerController.svelte +8 -2
- package/dist/recipes/BasicPlayerController.svelte.d.ts +2 -2
- package/dist/types/types.d.ts +1 -0
- package/package.json +48 -26
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Props, type Events, type Slots } from '@threlte/core'
|
|
2
|
-
import {
|
|
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
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
? MassProperties
|
|
93
|
+
: TMassDef extends Mass
|
|
94
|
+
? Mass
|
|
95
|
+
: NoMassProperties
|
|
96
96
|
|
|
97
97
|
// ------------------ COLLIDER ------------------
|
|
98
98
|
|
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import {
|
|
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
|
|
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
|
-
|
|
66
|
+
{stage}
|
|
67
67
|
>
|
|
68
68
|
<slot />
|
|
69
69
|
</InnerWorld>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActiveEvents,
|
|
2
|
-
import {
|
|
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();
|
|
@@ -103,7 +103,10 @@ const onKeyUp = (e) => {
|
|
|
103
103
|
};
|
|
104
104
|
</script>
|
|
105
105
|
|
|
106
|
-
<svelte:window
|
|
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
|
|
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 {
|
|
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
|
|
24
|
+
export default class BasicPlayerController extends SvelteComponent<BasicPlayerControllerProps, BasicPlayerControllerEvents, BasicPlayerControllerSlots> {
|
|
25
25
|
}
|
|
26
26
|
export {};
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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.
|
|
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": "^
|
|
9
|
-
"@sveltejs/kit": "^
|
|
10
|
-
"@sveltejs/package": "^2.
|
|
11
|
-
"@
|
|
12
|
-
"@types/
|
|
13
|
-
"@
|
|
14
|
-
"@typescript-eslint/
|
|
15
|
-
"@
|
|
16
|
-
"
|
|
17
|
-
"eslint
|
|
18
|
-
"eslint-
|
|
19
|
-
"
|
|
20
|
-
"prettier
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"svelte
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
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.
|
|
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",
|