@threlte/rapier 3.0.0-next.0 → 3.0.0-next.10
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 +7 -10
- package/dist/components/Attractor/Attractor.svelte.d.ts +2 -10
- package/dist/components/Colliders/AutoColliders.svelte +23 -13
- package/dist/components/Colliders/AutoColliders.svelte.d.ts +16 -12
- package/dist/components/Colliders/Collider.svelte +23 -10
- package/dist/components/Colliders/Collider.svelte.d.ts +6 -9
- package/dist/components/CollisionGroups/CollisionGroups.svelte +3 -5
- package/dist/components/CollisionGroups/CollisionGroups.svelte.d.ts +5 -1
- package/dist/components/Debug/Debug.svelte +4 -4
- package/dist/components/Debug/Debug.svelte.d.ts +3 -2
- package/dist/components/RigidBody/RigidBody.svelte +39 -9
- package/dist/components/RigidBody/RigidBody.svelte.d.ts +5 -15
- package/dist/components/RigidBody/overrideTeleportMethods.d.ts +14 -0
- package/dist/components/RigidBody/overrideTeleportMethods.js +31 -0
- package/dist/components/World/InnerWorld.svelte +33 -28
- package/dist/components/World/InnerWorld.svelte.d.ts +1 -3
- package/dist/components/World/World.svelte +9 -71
- package/dist/components/World/World.svelte.d.ts +13 -2
- package/dist/lib/applyColliderActiveEvents.d.ts +2 -1
- package/dist/lib/applyColliderActiveEvents.js +9 -9
- package/dist/lib/createPhysicsStages.d.ts +15 -0
- package/dist/lib/createPhysicsStages.js +43 -0
- package/dist/lib/createPhysicsTasks.d.ts +19 -0
- package/dist/{hooks/useFrameHandler.js → lib/createPhysicsTasks.js} +132 -65
- package/dist/lib/createRapierContext.d.ts +14 -20
- package/dist/lib/createRapierContext.js +37 -13
- package/dist/lib/initRapier.svelte.d.ts +1 -0
- package/dist/lib/initRapier.svelte.js +16 -0
- package/dist/lib/keys.d.ts +2 -0
- package/dist/lib/keys.js +2 -0
- package/dist/lib/rigidBodyObjectContext.d.ts +3 -2
- package/dist/lib/useCreateEvent.d.ts +2 -1
- package/dist/lib/useCreateEvent.js +3 -3
- package/dist/recipes/BasicPlayerController.svelte +6 -5
- package/dist/recipes/BasicPlayerController.svelte.d.ts +3 -3
- package/dist/types/types.d.ts +55 -28
- package/package.json +35 -16
- package/dist/hooks/useFixedJoint.d.ts +0 -8
- package/dist/hooks/useFrameHandler.d.ts +0 -3
- package/dist/hooks/useHasEventListener.d.ts +0 -3
- package/dist/hooks/useHasEventListener.js +0 -11
- package/dist/hooks/useJoint.d.ts +0 -8
- package/dist/hooks/usePrismaticJoint.d.ts +0 -8
- package/dist/hooks/useRevoluteJoint.d.ts +0 -8
- package/dist/hooks/useSphericalJoint.d.ts +0 -8
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { currentWritable } from '@threlte/core';
|
|
3
|
+
import { derived, writable } from 'svelte/store';
|
|
4
|
+
import { createPhysicsStages } from './createPhysicsStages';
|
|
5
|
+
import { createPhysicsTasks } from './createPhysicsTasks';
|
|
6
|
+
export const createRapierContext = (worldArgs, options) => {
|
|
7
|
+
const world = new RAPIER.World(...worldArgs);
|
|
5
8
|
const colliderObjects = new Map();
|
|
6
9
|
const rigidBodyObjects = new Map();
|
|
7
10
|
const rigidBodyEventDispatchers = new Map();
|
|
@@ -12,9 +15,9 @@ export const createRapierContext = (...args) => {
|
|
|
12
15
|
* @param object
|
|
13
16
|
* @param eventDispatcher
|
|
14
17
|
*/
|
|
15
|
-
const addColliderToContext = (collider, object,
|
|
18
|
+
const addColliderToContext = (collider, object, props) => {
|
|
16
19
|
colliderObjects.set(collider.handle, object);
|
|
17
|
-
colliderEventDispatchers.set(collider.handle,
|
|
20
|
+
colliderEventDispatchers.set(collider.handle, props);
|
|
18
21
|
};
|
|
19
22
|
/**
|
|
20
23
|
* Removes the collider from the context
|
|
@@ -42,11 +45,17 @@ export const createRapierContext = (...args) => {
|
|
|
42
45
|
rigidBodyObjects.delete(rigidBody.handle);
|
|
43
46
|
rigidBodyEventDispatchers.delete(rigidBody.handle);
|
|
44
47
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
const
|
|
48
|
+
const framerate = currentWritable(options.framerate ?? 'varying');
|
|
49
|
+
const simulationOffset = currentWritable(1);
|
|
50
|
+
const updateRigidBodySimulationData = currentWritable(framerate.current === 'varying');
|
|
51
|
+
const { simulationStage, synchronizationStage } = createPhysicsStages(framerate, simulationOffset, updateRigidBodySimulationData, options);
|
|
52
|
+
const autostart = options.autoStart ?? true;
|
|
53
|
+
const paused = writable(!autostart);
|
|
54
|
+
if (!autostart) {
|
|
55
|
+
simulationStage.stop();
|
|
56
|
+
synchronizationStage.stop();
|
|
57
|
+
}
|
|
58
|
+
const { simulationTask, synchronizationTask } = createPhysicsTasks(world, framerate, simulationOffset, rigidBodyObjects, updateRigidBodySimulationData, colliderEventDispatchers, rigidBodyEventDispatchers, simulationStage, synchronizationStage);
|
|
50
59
|
return {
|
|
51
60
|
rapier: RAPIER,
|
|
52
61
|
world,
|
|
@@ -59,8 +68,23 @@ export const createRapierContext = (...args) => {
|
|
|
59
68
|
addRigidBodyToContext,
|
|
60
69
|
removeRigidBodyFromContext,
|
|
61
70
|
debug: writable(false),
|
|
62
|
-
pause
|
|
63
|
-
|
|
64
|
-
|
|
71
|
+
pause: () => {
|
|
72
|
+
paused.set(true);
|
|
73
|
+
simulationStage.stop();
|
|
74
|
+
synchronizationStage.stop();
|
|
75
|
+
},
|
|
76
|
+
resume: () => {
|
|
77
|
+
paused.set(false);
|
|
78
|
+
simulationStage.start();
|
|
79
|
+
synchronizationStage.start();
|
|
80
|
+
},
|
|
81
|
+
paused: derived(paused, (a) => a),
|
|
82
|
+
framerate,
|
|
83
|
+
simulationOffset,
|
|
84
|
+
simulationStage,
|
|
85
|
+
synchronizationStage,
|
|
86
|
+
updateRigidBodySimulationData,
|
|
87
|
+
simulationTask,
|
|
88
|
+
synchronizationTask
|
|
65
89
|
};
|
|
66
90
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const initRapier: () => true | Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import RAPIER from '@dimforge/rapier3d-compat';
|
|
2
|
+
let initialized = false;
|
|
3
|
+
let promise;
|
|
4
|
+
export const initRapier = () => {
|
|
5
|
+
if (initialized)
|
|
6
|
+
return true;
|
|
7
|
+
if (!promise) {
|
|
8
|
+
promise = new Promise((resolve) => {
|
|
9
|
+
RAPIER.init().then(() => {
|
|
10
|
+
initialized = true;
|
|
11
|
+
resolve();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
return promise;
|
|
16
|
+
};
|
package/dist/lib/keys.js
ADDED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const
|
|
1
|
+
import type { Object3D } from 'three';
|
|
2
|
+
export declare const useParentRigidbodyObject: () => Object3D | undefined;
|
|
3
|
+
export declare const setParentRigidbodyObject: (object3d: Object3D) => void;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ColliderEvents } from '../types/types';
|
|
2
|
+
export declare const useCreateEvent: <T>(oncreate?: ColliderEvents['oncreate']) => {
|
|
2
3
|
updateRef: (newRef: T) => void;
|
|
3
4
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { onDestroy } from 'svelte';
|
|
2
|
-
export const useCreateEvent = (
|
|
2
|
+
export const useCreateEvent = (oncreate) => {
|
|
3
3
|
const cleanupFunctions = [];
|
|
4
|
-
let ref
|
|
4
|
+
let ref;
|
|
5
5
|
const dispatchCreateEvent = () => {
|
|
6
6
|
// call every cleanup function
|
|
7
7
|
cleanupFunctions.forEach((cleanup) => cleanup());
|
|
@@ -13,7 +13,7 @@ export const useCreateEvent = (events) => {
|
|
|
13
13
|
};
|
|
14
14
|
if (ref === undefined)
|
|
15
15
|
return;
|
|
16
|
-
|
|
16
|
+
oncreate?.({ ref, cleanup });
|
|
17
17
|
};
|
|
18
18
|
const updateRef = (newRef) => {
|
|
19
19
|
ref = newRef;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script lang="ts">import {
|
|
1
|
+
<script lang="ts">import { T, useTask } from '@threlte/core';
|
|
2
2
|
import { Vector2, Vector3 } from 'three';
|
|
3
3
|
import Collider from '../components/Colliders/Collider.svelte';
|
|
4
4
|
import CollisionGroups from '../components/CollisionGroups/CollisionGroups.svelte';
|
|
@@ -10,6 +10,8 @@ export let speed = 1;
|
|
|
10
10
|
export let jumpStrength = 3;
|
|
11
11
|
export let playerCollisionGroups = [0];
|
|
12
12
|
export let groundCollisionGroups = [15];
|
|
13
|
+
export let ongroundenter = undefined;
|
|
14
|
+
export let ongroundexit = undefined;
|
|
13
15
|
let rigidBody;
|
|
14
16
|
const keys = {
|
|
15
17
|
up: false,
|
|
@@ -19,7 +21,6 @@ const keys = {
|
|
|
19
21
|
};
|
|
20
22
|
const t = new Vector3();
|
|
21
23
|
const t2 = new Vector2();
|
|
22
|
-
const dispatch = createRawEventDispatcher();
|
|
23
24
|
let grounded = false;
|
|
24
25
|
let groundsSensored = 0;
|
|
25
26
|
$: {
|
|
@@ -28,7 +29,7 @@ $: {
|
|
|
28
29
|
else
|
|
29
30
|
grounded = true;
|
|
30
31
|
}
|
|
31
|
-
$: grounded ?
|
|
32
|
+
$: grounded ? ongroundenter?.() : ongroundexit?.();
|
|
32
33
|
const { start } = useTask(() => {
|
|
33
34
|
t.set(0, 0, 0);
|
|
34
35
|
if (keys.down)
|
|
@@ -126,8 +127,8 @@ const onKeyUp = (e) => {
|
|
|
126
127
|
<T.Group position={[0, -height / 2 + radius, 0]}>
|
|
127
128
|
<Collider
|
|
128
129
|
sensor
|
|
129
|
-
|
|
130
|
-
|
|
130
|
+
onsensorenter={() => (groundsSensored += 1)}
|
|
131
|
+
onsensorexit={() => (groundsSensored -= 1)}
|
|
131
132
|
shape={'ball'}
|
|
132
133
|
args={[radius * 1.2]}
|
|
133
134
|
/>
|
|
@@ -10,9 +10,9 @@ declare const __propDef: {
|
|
|
10
10
|
jumpStrength?: number | undefined;
|
|
11
11
|
playerCollisionGroups?: CollisionGroupsBitMask | undefined;
|
|
12
12
|
groundCollisionGroups?: CollisionGroupsBitMask | undefined;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ongroundenter?: (() => void) | undefined;
|
|
14
|
+
ongroundexit?: (() => void) | undefined;
|
|
15
|
+
children?: import("svelte").Snippet<[]> | undefined;
|
|
16
16
|
};
|
|
17
17
|
events: {
|
|
18
18
|
[evt: string]: CustomEvent<any>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,56 +1,55 @@
|
|
|
1
1
|
/// <reference types="svelte" />
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import type {
|
|
2
|
+
import { World, type Collider, type RigidBody, type TempContactManifold, type Vector } from '@dimforge/rapier3d-compat';
|
|
3
|
+
import RAPIER from '@dimforge/rapier3d-compat';
|
|
4
|
+
import type { CurrentWritable, Stage, Task } from '@threlte/core';
|
|
5
|
+
import type { Readable, Writable } from 'svelte/store';
|
|
6
|
+
import type { Object3D } from 'three';
|
|
5
7
|
export type ColliderShapes = 'ball' | 'capsule' | 'segment' | 'triangle' | 'roundTriangle' | 'polyline' | 'trimesh' | 'cuboid' | 'roundCuboid' | 'heightfield' | 'cylinder' | 'roundCylinder' | 'cone' | 'roundCone' | 'convexHull' | 'convexMesh' | 'roundConvexHull' | 'roundConvexMesh';
|
|
6
8
|
export type AutoCollidersShapes = 'cuboid' | 'ball' | 'trimesh' | 'convexHull' | 'capsule';
|
|
7
|
-
export type
|
|
8
|
-
|
|
9
|
+
export type ColliderEvents = {
|
|
10
|
+
oncreate?: (event: {
|
|
9
11
|
ref: Collider;
|
|
10
12
|
cleanup: (callback: () => void) => void;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
+
}) => void;
|
|
14
|
+
oncollisionenter?: (event: {
|
|
13
15
|
targetCollider: Collider;
|
|
14
16
|
targetRigidBody: RigidBody | null;
|
|
15
17
|
manifold: TempContactManifold;
|
|
16
18
|
flipped: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
+
}) => void;
|
|
20
|
+
oncollisionexit?: (event: {
|
|
19
21
|
targetCollider: Collider;
|
|
20
22
|
targetRigidBody: RigidBody | null;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
+
}) => void;
|
|
24
|
+
onsensorenter?: (event: {
|
|
23
25
|
targetCollider: Collider;
|
|
24
26
|
targetRigidBody: RigidBody | null;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
+
}) => void;
|
|
28
|
+
onsensorexit?: (event: {
|
|
27
29
|
targetCollider: Collider;
|
|
28
30
|
targetRigidBody: RigidBody | null;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
+
}) => void;
|
|
32
|
+
oncontact?: (event: {
|
|
31
33
|
targetCollider: Collider;
|
|
32
34
|
targetRigidBody: RigidBody | null;
|
|
33
35
|
maxForceDirection: Vector;
|
|
34
36
|
maxForceMagnitude: number;
|
|
35
37
|
totalForce: Vector;
|
|
36
38
|
totalForceMagnitude: number;
|
|
37
|
-
};
|
|
39
|
+
}) => void;
|
|
38
40
|
};
|
|
39
|
-
export type CollisionEnterEvent =
|
|
40
|
-
export type CollisionExitEvent =
|
|
41
|
-
export type SensorEnterEvent =
|
|
42
|
-
export type SensorExitEvent =
|
|
43
|
-
export type ContactEvent =
|
|
44
|
-
export type
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
export type CollisionEnterEvent = ColliderEvents['oncollisionenter'];
|
|
42
|
+
export type CollisionExitEvent = ColliderEvents['oncollisionexit'];
|
|
43
|
+
export type SensorEnterEvent = ColliderEvents['onsensorenter'];
|
|
44
|
+
export type SensorExitEvent = ColliderEvents['onsensorexit'];
|
|
45
|
+
export type ContactEvent = ColliderEvents['oncontact'];
|
|
46
|
+
export type RigidBodyEvents = ColliderEvents & {
|
|
47
|
+
onsleep?: () => void;
|
|
48
|
+
onwake?: () => void;
|
|
47
49
|
};
|
|
48
|
-
export type RigidBodyEventDispatchers = Map<RigidBodyHandle, Record<string, (arg: unknown) => void>>;
|
|
49
|
-
export type ColliderEventDispatchers = Map<ColliderHandle, Record<string, (arg: unknown) => void>>;
|
|
50
|
-
export type RapierContext = ReturnType<typeof createRapierContext>;
|
|
51
50
|
export type CollisionGroupsContext = Writable<number> | undefined;
|
|
52
51
|
export type RigidBodyUserData = {
|
|
53
|
-
events?:
|
|
52
|
+
events?: RigidBodyEvents;
|
|
54
53
|
};
|
|
55
54
|
export type ThrelteRigidBody = RigidBody & {
|
|
56
55
|
userData?: RigidBodyUserData;
|
|
@@ -61,3 +60,31 @@ export type CollisionGroupsBitMask = (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
|
|
|
61
60
|
* Used in the <Attractor> component
|
|
62
61
|
*/
|
|
63
62
|
export type GravityType = 'static' | 'linear' | 'newtonian';
|
|
63
|
+
export type Framerate = number | 'varying';
|
|
64
|
+
export type RapierContext = {
|
|
65
|
+
rapier: typeof RAPIER;
|
|
66
|
+
world: World;
|
|
67
|
+
colliderObjects: Map<number, Object3D>;
|
|
68
|
+
rigidBodyObjects: Map<number, Object3D>;
|
|
69
|
+
rigidBodyEventDispatchers: Map<number, RigidBodyEvents>;
|
|
70
|
+
colliderEventDispatchers: Map<number, ColliderEvents>;
|
|
71
|
+
addColliderToContext: (collider: Collider, object: Object3D, props: ColliderEvents) => void;
|
|
72
|
+
removeColliderFromContext: (collider: Collider) => void;
|
|
73
|
+
addRigidBodyToContext: (rigidBody: RigidBody, object: Object3D, events: RigidBodyEvents) => void;
|
|
74
|
+
removeRigidBodyFromContext: (rigidBody: RigidBody) => void;
|
|
75
|
+
debug: Writable<boolean>;
|
|
76
|
+
pause: () => void;
|
|
77
|
+
resume: () => void;
|
|
78
|
+
paused: Readable<boolean>;
|
|
79
|
+
framerate: CurrentWritable<Framerate>;
|
|
80
|
+
simulationStage: Stage;
|
|
81
|
+
simulationTask: Task;
|
|
82
|
+
synchronizationStage: Stage;
|
|
83
|
+
synchronizationTask: Task;
|
|
84
|
+
/**
|
|
85
|
+
* This number tells us how far we're off in the simulation stage as opposed
|
|
86
|
+
* to the render stage
|
|
87
|
+
*/
|
|
88
|
+
simulationOffset: CurrentWritable<number>;
|
|
89
|
+
updateRigidBodySimulationData: CurrentWritable<boolean>;
|
|
90
|
+
};
|
package/package.json
CHANGED
|
@@ -1,43 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@threlte/rapier",
|
|
3
|
-
"version": "3.0.0-next.
|
|
3
|
+
"version": "3.0.0-next.10",
|
|
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
|
-
"@dimforge/rapier3d-compat": "^0.
|
|
8
|
+
"@dimforge/rapier3d-compat": "^0.14.0",
|
|
8
9
|
"@sveltejs/adapter-auto": "^3.2.0",
|
|
9
10
|
"@sveltejs/kit": "^2.5.5",
|
|
10
11
|
"@sveltejs/package": "^2.3.1",
|
|
11
|
-
"@sveltejs/vite-plugin-svelte": "^3.0
|
|
12
|
-
"@types/node": "^20.12.
|
|
13
|
-
"@types/three": "^0.
|
|
14
|
-
"@typescript-eslint/eslint-plugin": "^7.
|
|
15
|
-
"@typescript-eslint/parser": "^7.
|
|
12
|
+
"@sveltejs/vite-plugin-svelte": "^3.1.0",
|
|
13
|
+
"@types/node": "^20.12.7",
|
|
14
|
+
"@types/three": "^0.166.0",
|
|
15
|
+
"@typescript-eslint/eslint-plugin": "^7.6.0",
|
|
16
|
+
"@typescript-eslint/parser": "^7.6.0",
|
|
16
17
|
"@yushijinhun/three-minifier-rollup": "^0.4.0",
|
|
17
18
|
"eslint": "^8.57.0",
|
|
18
19
|
"eslint-config-prettier": "^9.1.0",
|
|
19
|
-
"eslint-plugin-svelte": "^2.
|
|
20
|
+
"eslint-plugin-svelte": "^2.36.0",
|
|
20
21
|
"prettier": "^3.2.5",
|
|
21
22
|
"prettier-plugin-svelte": "^3.2.2",
|
|
22
23
|
"publint": "^0.2.7",
|
|
23
24
|
"rimraf": "^5.0.5",
|
|
24
|
-
"svelte": "5.0.0-next.
|
|
25
|
+
"svelte": "5.0.0-next.181",
|
|
25
26
|
"svelte-check": "^3.6.9",
|
|
26
27
|
"svelte-preprocess": "^5.1.3",
|
|
27
28
|
"svelte2tsx": "^0.7.6",
|
|
28
|
-
"three": "^0.
|
|
29
|
+
"three": "^0.166.1",
|
|
29
30
|
"tslib": "^2.6.2",
|
|
30
31
|
"type-fest": "^4.15.0",
|
|
31
|
-
"typescript": "^5.4.
|
|
32
|
+
"typescript": "^5.4.5",
|
|
32
33
|
"vite": "^5.2.8",
|
|
33
|
-
"@threlte/core": "8.0.0-next.
|
|
34
|
+
"@threlte/core": "8.0.0-next.17"
|
|
34
35
|
},
|
|
35
36
|
"peerDependencies": {
|
|
36
|
-
"@dimforge/rapier3d-compat": ">=0.
|
|
37
|
-
"svelte": ">=
|
|
37
|
+
"@dimforge/rapier3d-compat": ">=0.14",
|
|
38
|
+
"svelte": ">=5",
|
|
38
39
|
"three": ">=0.152"
|
|
39
40
|
},
|
|
40
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
|
+
},
|
|
41
60
|
"exports": {
|
|
42
61
|
".": {
|
|
43
62
|
"types": "./dist/index.d.ts",
|
|
@@ -54,8 +73,8 @@
|
|
|
54
73
|
"package": "svelte-kit sync && svelte-package && node ./scripts/cleanupPackage.js && publint",
|
|
55
74
|
"check": "svelte-check --tsconfig ./tsconfig.json",
|
|
56
75
|
"check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
|
|
57
|
-
"lint": "prettier --check
|
|
58
|
-
"format": "prettier --write
|
|
76
|
+
"lint": "prettier --check .",
|
|
77
|
+
"format": "prettier --write .",
|
|
59
78
|
"cleanup": "rimraf node_modules .svelte-kit dist"
|
|
60
79
|
}
|
|
61
80
|
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { FixedImpulseJoint } from '@dimforge/rapier3d-compat';
|
|
3
|
-
import { Euler } from 'three';
|
|
4
|
-
export declare const useFixedJoint: (anchorA: [x: number, y: number, z: number], frameA: Parameters<Euler['set']> | Euler, anchorB: [x: number, y: number, z: number], frameB: Parameters<Euler['set']> | Euler) => {
|
|
5
|
-
joint: import("svelte/store").Writable<FixedImpulseJoint>;
|
|
6
|
-
rigidBodyA: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
7
|
-
rigidBodyB: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
8
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const useHasEventListeners = () => {
|
|
2
|
-
// const component = get_current_component()
|
|
3
|
-
const hasEventListeners = (type) => {
|
|
4
|
-
// const callbacks = component.$$.callbacks
|
|
5
|
-
return true;
|
|
6
|
-
// return type in callbacks && (callbacks[type] as any[]).length > 0
|
|
7
|
-
};
|
|
8
|
-
return {
|
|
9
|
-
hasEventListeners
|
|
10
|
-
};
|
|
11
|
-
};
|
package/dist/hooks/useJoint.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import { MultibodyJoint, type ImpulseJoint, type RigidBody } from '@dimforge/rapier3d-compat';
|
|
3
|
-
import type { RapierContext } from '../types/types';
|
|
4
|
-
export declare const useJoint: <T extends ImpulseJoint | MultibodyJoint>(initializeJoint: (rigidBodyA: RigidBody, rigidBodyB: RigidBody, ctx: RapierContext) => T) => {
|
|
5
|
-
joint: import("svelte/store").Writable<T>;
|
|
6
|
-
rigidBodyA: import("svelte/store").Writable<RigidBody | undefined>;
|
|
7
|
-
rigidBodyB: import("svelte/store").Writable<RigidBody | undefined>;
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { PrismaticImpulseJoint } from '@dimforge/rapier3d-compat';
|
|
3
|
-
import { Vector3 } from 'three';
|
|
4
|
-
export declare const usePrismaticJoint: (anchorA: Parameters<Vector3['set']> | Vector3, anchorB: Parameters<Vector3['set']> | Vector3, axis: Parameters<Vector3['set']> | Vector3, limits?: [min: number, max: number]) => {
|
|
5
|
-
joint: import("svelte/store").Writable<PrismaticImpulseJoint>;
|
|
6
|
-
rigidBodyA: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
7
|
-
rigidBodyB: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { RevoluteImpulseJoint } from '@dimforge/rapier3d-compat';
|
|
3
|
-
import { Vector3 } from 'three';
|
|
4
|
-
export declare const useRevoluteJoint: (anchorA: Parameters<Vector3['set']> | Vector3, anchorB: Parameters<Vector3['set']> | Vector3, axis: Parameters<Vector3['set']> | Vector3, limits?: [min: number, max: number]) => {
|
|
5
|
-
joint: import("svelte/store").Writable<RevoluteImpulseJoint>;
|
|
6
|
-
rigidBodyA: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
7
|
-
rigidBodyB: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
8
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import type { SphericalImpulseJoint } from '@dimforge/rapier3d-compat';
|
|
3
|
-
import { Vector3 } from 'three';
|
|
4
|
-
export declare const useSphericalJoint: (anchorA: Parameters<Vector3['set']> | Vector3, anchorB: Parameters<Vector3['set']> | Vector3) => {
|
|
5
|
-
joint: import("svelte/store").Writable<SphericalImpulseJoint>;
|
|
6
|
-
rigidBodyA: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
7
|
-
rigidBodyB: import("svelte/store").Writable<import("@dimforge/rapier3d-compat").RigidBody | undefined>;
|
|
8
|
-
};
|