@threlte/rapier 3.0.0-next.14 → 3.0.0-next.15
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 +4 -34
- package/dist/components/Attractor/types.d.ts +30 -0
- package/dist/components/Attractor/types.js +1 -0
- package/dist/components/Colliders/{AutoColliders.svelte → AutoColliders/AutoColliders.svelte} +17 -10
- package/dist/components/Colliders/AutoColliders/AutoColliders.svelte.d.ts +23 -0
- package/dist/components/Colliders/AutoColliders/types.d.ts +74 -0
- package/dist/components/Colliders/AutoColliders/types.js +1 -0
- package/dist/components/Colliders/{Collider.svelte → Collider/Collider.svelte} +20 -16
- package/dist/components/Colliders/Collider/Collider.svelte.d.ts +21 -0
- package/dist/components/Colliders/Collider/types.d.ts +83 -0
- package/dist/components/Colliders/Collider/types.js +1 -0
- package/dist/components/CollisionGroups/CollisionGroups.svelte +4 -1
- package/dist/components/CollisionGroups/CollisionGroups.svelte.d.ts +17 -33
- package/dist/components/CollisionGroups/types.d.ts +19 -0
- package/dist/components/CollisionGroups/types.js +1 -0
- package/dist/components/Debug/Debug.svelte +5 -5
- package/dist/components/Debug/Debug.svelte.d.ts +4 -7
- package/dist/components/Debug/types.d.ts +3 -0
- package/dist/components/Debug/types.js +1 -0
- package/dist/components/RigidBody/RigidBody.svelte.d.ts +4 -102
- package/dist/components/RigidBody/types.d.ts +85 -0
- package/dist/components/RigidBody/types.js +1 -0
- package/dist/components/World/InnerWorld.svelte.d.ts +1 -1
- package/dist/components/World/World.svelte.d.ts +4 -49
- package/dist/components/World/types.d.ts +32 -0
- package/dist/components/World/types.js +1 -0
- package/dist/index.d.ts +3 -4
- package/dist/index.js +2 -4
- package/dist/lib/useCreateEvent.d.ts +2 -2
- package/dist/lib/useCreateEvent.js +3 -5
- package/dist/types/types.d.ts +3 -4
- package/package.json +1 -1
- package/dist/components/Colliders/AutoColliders.svelte.d.ts +0 -84
- package/dist/components/Colliders/Collider.svelte.d.ts +0 -109
- package/dist/recipes/BasicPlayerController.svelte +0 -142
- package/dist/recipes/BasicPlayerController.svelte.d.ts +0 -40
|
@@ -1,34 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type AttractorProps = Props<Group> & {
|
|
7
|
-
/**
|
|
8
|
-
* The strength factor applied to the impulse affecting rigid-bodies within range. For newtonian
|
|
9
|
-
* calculations, strength is treated as m1 mass.
|
|
10
|
-
* Default: 1.0
|
|
11
|
-
*/
|
|
12
|
-
strength?: number
|
|
13
|
-
/**
|
|
14
|
-
* The radius for the Attractor's sphere of influence within which rigid-bodies will be affected.
|
|
15
|
-
* Default: 10.0
|
|
16
|
-
*/
|
|
17
|
-
range?: number
|
|
18
|
-
/**
|
|
19
|
-
* The method of calculating gravity on rigid bodies within range.
|
|
20
|
-
* 'static' = the same force (strength) is applied on bodies within range, regardless of distance
|
|
21
|
-
* 'linear' = force is calculated as strength * distance / range (force decreases the farther a body is from the attractor position)
|
|
22
|
-
* 'newtonian' = force is calculated as gravitationalConstant * mass1 * mass2 / Math.pow(distance, 2)
|
|
23
|
-
* Default: 'static'
|
|
24
|
-
*/
|
|
25
|
-
gravityType?: GravityType
|
|
26
|
-
/**
|
|
27
|
-
* The gravitational constant used to calculate force in newtonian calculations. Most people probably won't use this,
|
|
28
|
-
* but it provides an option for more realistic physics simulations.
|
|
29
|
-
* Default: 6.673e-11
|
|
30
|
-
*/
|
|
31
|
-
gravitationalConstant?: number
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default class Attractor extends SvelteComponent<AttractorProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { AttractorProps } from './types';
|
|
3
|
+
declare const Attractor: import("svelte").Component<AttractorProps, {}, "ref">;
|
|
4
|
+
export default Attractor;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Props } from '@threlte/core';
|
|
2
|
+
import type { Group } from 'three';
|
|
3
|
+
import type { GravityType } from '../../types/types';
|
|
4
|
+
export type AttractorProps = Props<Group> & {
|
|
5
|
+
/**
|
|
6
|
+
* The strength factor applied to the impulse affecting rigid-bodies within range. For newtonian
|
|
7
|
+
* calculations, strength is treated as m1 mass.
|
|
8
|
+
* Default: 1.0
|
|
9
|
+
*/
|
|
10
|
+
strength?: number;
|
|
11
|
+
/**
|
|
12
|
+
* The radius for the Attractor's sphere of influence within which rigid-bodies will be affected.
|
|
13
|
+
* Default: 10.0
|
|
14
|
+
*/
|
|
15
|
+
range?: number;
|
|
16
|
+
/**
|
|
17
|
+
* The method of calculating gravity on rigid bodies within range.
|
|
18
|
+
* 'static' = the same force (strength) is applied on bodies within range, regardless of distance
|
|
19
|
+
* 'linear' = force is calculated as strength * distance / range (force decreases the farther a body is from the attractor position)
|
|
20
|
+
* 'newtonian' = force is calculated as gravitationalConstant * mass1 * mass2 / Math.pow(distance, 2)
|
|
21
|
+
* Default: 'static'
|
|
22
|
+
*/
|
|
23
|
+
gravityType?: GravityType;
|
|
24
|
+
/**
|
|
25
|
+
* The gravitational constant used to calculate force in newtonian calculations. Most people probably won't use this,
|
|
26
|
+
* but it provides an option for more realistic physics simulations.
|
|
27
|
+
* Default: 6.673e-11
|
|
28
|
+
*/
|
|
29
|
+
gravitationalConstant?: number;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/components/Colliders/{AutoColliders.svelte → AutoColliders/AutoColliders.svelte}
RENAMED
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="TMassDef extends MassDef"
|
|
4
|
+
>import { ActiveCollisionTypes, CoefficientCombineRule } from '@dimforge/rapier3d-compat';
|
|
2
5
|
import { createParentObject3DContext, useParentObject3D, watch } from '@threlte/core';
|
|
3
6
|
import { onDestroy, onMount } from 'svelte';
|
|
4
7
|
import { Group } from 'three';
|
|
5
|
-
import { useCollisionGroups } from '
|
|
6
|
-
import { useRapier } from '
|
|
7
|
-
import { useRigidBody } from '
|
|
8
|
-
import { applyColliderActiveEvents } from '
|
|
9
|
-
import { createCollidersFromChildren } from '
|
|
10
|
-
import { eulerToQuaternion } from '
|
|
11
|
-
import { useParentRigidbodyObject } from '
|
|
12
|
-
import { useCreateEvent } from '
|
|
13
|
-
let { shape = 'convexHull', restitution, restitutionCombineRule, friction, frictionCombineRule, sensor, contactForceEventThreshold, density, mass, centerOfMass, principalAngularInertia, angularInertiaLocalFrame,
|
|
8
|
+
import { useCollisionGroups } from '../../../hooks/useCollisionGroups';
|
|
9
|
+
import { useRapier } from '../../../hooks/useRapier';
|
|
10
|
+
import { useRigidBody } from '../../../hooks/useRigidBody';
|
|
11
|
+
import { applyColliderActiveEvents } from '../../../lib/applyColliderActiveEvents';
|
|
12
|
+
import { createCollidersFromChildren } from '../../../lib/createCollidersFromChildren';
|
|
13
|
+
import { eulerToQuaternion } from '../../../lib/eulerToQuaternion';
|
|
14
|
+
import { useParentRigidbodyObject } from '../../../lib/rigidBodyObjectContext';
|
|
15
|
+
import { useCreateEvent } from '../../../lib/useCreateEvent';
|
|
16
|
+
let { shape = 'convexHull', restitution, restitutionCombineRule, friction, frictionCombineRule, sensor, contactForceEventThreshold, density, mass, centerOfMass, principalAngularInertia, angularInertiaLocalFrame, colliders = $bindable(), oncreate, oncollisionenter, oncollisionexit, oncontact, onsensorenter, onsensorexit, children } = $props();
|
|
14
17
|
const group = new Group();
|
|
15
18
|
const { updateRef } = useCreateEvent(oncreate);
|
|
16
19
|
const rigidBody = useRigidBody();
|
|
@@ -63,6 +66,10 @@ const create = () => {
|
|
|
63
66
|
});
|
|
64
67
|
updateRef(colliders);
|
|
65
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Refresh the colliders.
|
|
71
|
+
*/
|
|
72
|
+
export const refresh = () => create();
|
|
66
73
|
onMount(() => {
|
|
67
74
|
create();
|
|
68
75
|
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { AutoCollidersProps, MassDef } from './types';
|
|
3
|
+
declare class __sveltets_Render<TMassDef extends MassDef> {
|
|
4
|
+
props(): AutoCollidersProps<TMassDef>;
|
|
5
|
+
events(): {};
|
|
6
|
+
slots(): {};
|
|
7
|
+
bindings(): "colliders";
|
|
8
|
+
exports(): {
|
|
9
|
+
/**
|
|
10
|
+
* Refresh the colliders.
|
|
11
|
+
*/ refresh: () => void;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
interface $$IsomorphicComponent {
|
|
15
|
+
new <TMassDef extends MassDef>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TMassDef>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TMassDef>['props']>, ReturnType<__sveltets_Render<TMassDef>['events']>, ReturnType<__sveltets_Render<TMassDef>['slots']>> & {
|
|
16
|
+
$$bindings?: ReturnType<__sveltets_Render<TMassDef>['bindings']>;
|
|
17
|
+
} & ReturnType<__sveltets_Render<TMassDef>['exports']>;
|
|
18
|
+
<TMassDef extends MassDef>(internal: unknown, props: ReturnType<__sveltets_Render<TMassDef>['props']> & {}): ReturnType<__sveltets_Render<TMassDef>['exports']>;
|
|
19
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
20
|
+
}
|
|
21
|
+
declare const AutoColliders: $$IsomorphicComponent;
|
|
22
|
+
type AutoColliders<TMassDef extends MassDef> = InstanceType<typeof AutoColliders<TMassDef>>;
|
|
23
|
+
export default AutoColliders;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { CoefficientCombineRule, Collider } from '@dimforge/rapier3d-compat';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
import type { Euler, Vector3 } from 'three';
|
|
4
|
+
import type { AutoCollidersShapes, ColliderEvents, CreateEvent } from '../../../types/types';
|
|
5
|
+
type BaseProps = {
|
|
6
|
+
/**
|
|
7
|
+
* The shape of the collider.
|
|
8
|
+
*/
|
|
9
|
+
shape?: AutoCollidersShapes;
|
|
10
|
+
/** The restitution coefficient of this collider. */
|
|
11
|
+
restitution?: number;
|
|
12
|
+
/** he rule used to combine the restitution coefficients of two colliders involved in a contact. */
|
|
13
|
+
restitutionCombineRule?: CoefficientCombineRule;
|
|
14
|
+
/** The friction coefficient of this collider. */
|
|
15
|
+
friction?: number;
|
|
16
|
+
/** The rule used to combine the friction coefficients of two colliders involved in a contact. */
|
|
17
|
+
frictionCombineRule?: CoefficientCombineRule;
|
|
18
|
+
/** Whether this collider is a sensor. A sensor collider does not generate
|
|
19
|
+
* contacts. They only generate intersection events when one sensor collider
|
|
20
|
+
* and another collider start/stop touching. Sensor colliders are generally
|
|
21
|
+
* used to detect when something enters an area. Note that, for symmetry with
|
|
22
|
+
* non-sensor colliders, sensors do contribute to the mass of a rigid-body
|
|
23
|
+
* they are attached to.
|
|
24
|
+
*/
|
|
25
|
+
sensor?: boolean;
|
|
26
|
+
colliders?: Collider[];
|
|
27
|
+
/** The total force magnitude beyond which a contact force event can be emitted. */
|
|
28
|
+
contactForceEventThreshold?: number;
|
|
29
|
+
};
|
|
30
|
+
type Density = {
|
|
31
|
+
/** The density of this collider. */
|
|
32
|
+
density: number;
|
|
33
|
+
mass?: never;
|
|
34
|
+
centerOfMass?: never;
|
|
35
|
+
principalAngularInertia?: never;
|
|
36
|
+
angularInertiaLocalFrame?: never;
|
|
37
|
+
};
|
|
38
|
+
type Mass = {
|
|
39
|
+
/** The mass of this collider. */
|
|
40
|
+
mass: number;
|
|
41
|
+
density?: never;
|
|
42
|
+
centerOfMass?: never;
|
|
43
|
+
principalAngularInertia?: never;
|
|
44
|
+
angularInertiaLocalFrame?: never;
|
|
45
|
+
};
|
|
46
|
+
type MassProperties = {
|
|
47
|
+
/** The mass of this collider. */
|
|
48
|
+
mass: number;
|
|
49
|
+
/** The center of mass of this collider. */
|
|
50
|
+
centerOfMass: Parameters<Vector3['set']>;
|
|
51
|
+
/** The principal angular inertia of this collider. */
|
|
52
|
+
principalAngularInertia: Parameters<Vector3['set']>;
|
|
53
|
+
/** The angular inertia local frame of this collider. */
|
|
54
|
+
angularInertiaLocalFrame: Parameters<Euler['set']>;
|
|
55
|
+
density?: never;
|
|
56
|
+
};
|
|
57
|
+
type NoMassProperties = {
|
|
58
|
+
density?: never;
|
|
59
|
+
mass?: never;
|
|
60
|
+
centerOfMass?: never;
|
|
61
|
+
principalAngularInertia?: never;
|
|
62
|
+
angularInertiaLocalFrame?: never;
|
|
63
|
+
};
|
|
64
|
+
export type MassDef = Density | Mass | MassProperties | NoMassProperties;
|
|
65
|
+
type MassProps<TMassDef extends MassDef> = TMassDef extends Density ? Density : TMassDef extends MassProperties ? MassProperties : TMassDef extends Mass ? Mass : NoMassProperties;
|
|
66
|
+
export type AutoCollidersProps<TMassDef extends MassDef> = CreateEvent<Collider[]> & ColliderEvents & BaseProps & MassProps<TMassDef> & {
|
|
67
|
+
children?: Snippet<[
|
|
68
|
+
{
|
|
69
|
+
colliders: Collider[];
|
|
70
|
+
refresh: () => void;
|
|
71
|
+
}
|
|
72
|
+
]>;
|
|
73
|
+
};
|
|
74
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,22 +1,20 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="TShape extends Shape, TMassDef extends MassDef"
|
|
4
|
+
>import { ActiveCollisionTypes, CoefficientCombineRule, ColliderDesc } from '@dimforge/rapier3d-compat';
|
|
2
5
|
import { createParentObject3DContext, useParentObject3D, useTask, watch } from '@threlte/core';
|
|
3
6
|
import { onDestroy, onMount, tick } from 'svelte';
|
|
4
7
|
import { Object3D, Quaternion, Vector3 } from 'three';
|
|
5
|
-
import { useCollisionGroups } from '
|
|
6
|
-
import { useRapier } from '
|
|
7
|
-
import { useRigidBody } from '
|
|
8
|
-
import { applyColliderActiveEvents } from '
|
|
9
|
-
import { eulerToQuaternion } from '
|
|
10
|
-
import { getWorldPosition, getWorldQuaternion } from '
|
|
11
|
-
import { useParentRigidbodyObject } from '
|
|
12
|
-
import { scaleColliderArgs } from '
|
|
13
|
-
import { useCreateEvent } from '
|
|
14
|
-
let { shape, args, type, restitution, restitutionCombineRule, friction, frictionCombineRule, sensor, contactForceEventThreshold, density, mass, centerOfMass, principalAngularInertia, angularInertiaLocalFrame, collider = $bindable(),
|
|
15
|
-
if (!collider)
|
|
16
|
-
return;
|
|
17
|
-
collider.setTranslation(getWorldPosition(object));
|
|
18
|
-
collider.setRotation(getWorldQuaternion(object));
|
|
19
|
-
}), oncreate, oncollisionenter, oncollisionexit, oncontact, onsensorenter, onsensorexit, children } = $props();
|
|
8
|
+
import { useCollisionGroups } from '../../../hooks/useCollisionGroups';
|
|
9
|
+
import { useRapier } from '../../../hooks/useRapier';
|
|
10
|
+
import { useRigidBody } from '../../../hooks/useRigidBody';
|
|
11
|
+
import { applyColliderActiveEvents } from '../../../lib/applyColliderActiveEvents';
|
|
12
|
+
import { eulerToQuaternion } from '../../../lib/eulerToQuaternion';
|
|
13
|
+
import { getWorldPosition, getWorldQuaternion } from '../../../lib/getWorldTransforms';
|
|
14
|
+
import { useParentRigidbodyObject } from '../../../lib/rigidBodyObjectContext';
|
|
15
|
+
import { scaleColliderArgs } from '../../../lib/scaleColliderArgs';
|
|
16
|
+
import { useCreateEvent } from '../../../lib/useCreateEvent';
|
|
17
|
+
let { shape, args, type, restitution, restitutionCombineRule, friction, frictionCombineRule, sensor, contactForceEventThreshold, density, mass, centerOfMass, principalAngularInertia, angularInertiaLocalFrame, collider = $bindable(), oncreate, oncollisionenter, oncollisionexit, oncontact, onsensorenter, onsensorexit, children } = $props();
|
|
20
18
|
const object = new Object3D();
|
|
21
19
|
const { updateRef } = useCreateEvent(oncreate);
|
|
22
20
|
const rigidBody = useRigidBody();
|
|
@@ -108,6 +106,12 @@ $effect.pre(() => {
|
|
|
108
106
|
applyColliderActiveEvents(collider, events, rigidBody?.userData?.events);
|
|
109
107
|
}
|
|
110
108
|
});
|
|
109
|
+
export const refresh = () => {
|
|
110
|
+
if (!collider)
|
|
111
|
+
return;
|
|
112
|
+
collider.setTranslation(getWorldPosition(object));
|
|
113
|
+
collider.setRotation(getWorldQuaternion(object));
|
|
114
|
+
};
|
|
111
115
|
/**
|
|
112
116
|
* If the Collider isAttached (i.e. NOT child of a RigidBody), update the
|
|
113
117
|
* transforms on every frame.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { ColliderProps, MassDef, Shape } from './types';
|
|
3
|
+
declare class __sveltets_Render<TShape extends Shape, TMassDef extends MassDef> {
|
|
4
|
+
props(): ColliderProps<TShape, TMassDef>;
|
|
5
|
+
events(): {};
|
|
6
|
+
slots(): {};
|
|
7
|
+
bindings(): "collider";
|
|
8
|
+
exports(): {
|
|
9
|
+
refresh: () => void;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface $$IsomorphicComponent {
|
|
13
|
+
new <TShape extends Shape, TMassDef extends MassDef>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TShape, TMassDef>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TShape, TMassDef>['props']>, ReturnType<__sveltets_Render<TShape, TMassDef>['events']>, ReturnType<__sveltets_Render<TShape, TMassDef>['slots']>> & {
|
|
14
|
+
$$bindings?: ReturnType<__sveltets_Render<TShape, TMassDef>['bindings']>;
|
|
15
|
+
} & ReturnType<__sveltets_Render<TShape, TMassDef>['exports']>;
|
|
16
|
+
<TShape extends Shape, TMassDef extends MassDef>(internal: unknown, props: ReturnType<__sveltets_Render<TShape, TMassDef>['props']> & {}): ReturnType<__sveltets_Render<TShape, TMassDef>['exports']>;
|
|
17
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any, any>['bindings']>;
|
|
18
|
+
}
|
|
19
|
+
declare const Collider: $$IsomorphicComponent;
|
|
20
|
+
type Collider<TShape extends Shape, TMassDef extends MassDef> = InstanceType<typeof Collider<TShape, TMassDef>>;
|
|
21
|
+
export default Collider;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { CoefficientCombineRule, Collider, ColliderDesc, Collider as RapierCollider } from '@dimforge/rapier3d-compat';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
import type { Euler, Vector3 } from 'three';
|
|
4
|
+
import type { ColliderEvents, CreateEvent } from '../../../types/types';
|
|
5
|
+
type Type = 'static' | 'dynamic';
|
|
6
|
+
type BaseProps = {
|
|
7
|
+
/**
|
|
8
|
+
* If a collider is *not* attached to a RigidBody and its type is `static`,
|
|
9
|
+
* its transform is only applied once on initialization. If the transform
|
|
10
|
+
* should be updated every frame, set the type to `dynamic`.
|
|
11
|
+
*/
|
|
12
|
+
type?: Type;
|
|
13
|
+
/** The restitution coefficient of this collider. */
|
|
14
|
+
restitution?: number;
|
|
15
|
+
/** he rule used to combine the restitution coefficients of two colliders involved in a contact. */
|
|
16
|
+
restitutionCombineRule?: CoefficientCombineRule;
|
|
17
|
+
/** The friction coefficient of this collider. */
|
|
18
|
+
friction?: number;
|
|
19
|
+
/** The rule used to combine the friction coefficients of two colliders involved in a contact. */
|
|
20
|
+
frictionCombineRule?: CoefficientCombineRule;
|
|
21
|
+
/** Whether this collider is a sensor. A sensor collider does not generate
|
|
22
|
+
* contacts. They only generate intersection events when one sensor collider
|
|
23
|
+
* and another collider start/stop touching. Sensor colliders are generally
|
|
24
|
+
* used to detect when something enters an area. Note that, for symmetry with
|
|
25
|
+
* non-sensor colliders, sensors do contribute to the mass of a rigid-body
|
|
26
|
+
* they are attached to.
|
|
27
|
+
*/
|
|
28
|
+
sensor?: boolean;
|
|
29
|
+
collider?: RapierCollider;
|
|
30
|
+
/** The total force magnitude beyond which a contact force event can be emitted. */
|
|
31
|
+
contactForceEventThreshold?: number;
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* The shape of the collider.
|
|
35
|
+
*/
|
|
36
|
+
export type Shape = 'ball' | 'capsule' | 'segment' | 'triangle' | 'roundTriangle' | 'polyline' | 'trimesh' | 'cuboid' | 'roundCuboid' | 'heightfield' | 'cylinder' | 'roundCylinder' | 'cone' | 'roundCone' | 'convexHull' | 'convexMesh' | 'roundConvexHull' | 'roundConvexMesh';
|
|
37
|
+
type Args<TShape extends Shape> = Parameters<(typeof ColliderDesc)[TShape]>;
|
|
38
|
+
type ShapeProps<TShape extends Shape> = {
|
|
39
|
+
shape: TShape;
|
|
40
|
+
args: Args<TShape>;
|
|
41
|
+
};
|
|
42
|
+
type Density = {
|
|
43
|
+
/** The density of this collider. */
|
|
44
|
+
density: number;
|
|
45
|
+
mass?: never;
|
|
46
|
+
centerOfMass?: never;
|
|
47
|
+
principalAngularInertia?: never;
|
|
48
|
+
angularInertiaLocalFrame?: never;
|
|
49
|
+
};
|
|
50
|
+
type Mass = {
|
|
51
|
+
/** The mass of this collider. */
|
|
52
|
+
mass: number;
|
|
53
|
+
density?: never;
|
|
54
|
+
centerOfMass?: never;
|
|
55
|
+
principalAngularInertia?: never;
|
|
56
|
+
angularInertiaLocalFrame?: never;
|
|
57
|
+
};
|
|
58
|
+
type MassProperties = {
|
|
59
|
+
/** The mass of this collider. */
|
|
60
|
+
mass: number;
|
|
61
|
+
/** The center of mass of this collider. */
|
|
62
|
+
centerOfMass: Parameters<Vector3['set']>;
|
|
63
|
+
/** The principal angular inertia of this collider. */
|
|
64
|
+
principalAngularInertia: Parameters<Vector3['set']>;
|
|
65
|
+
/** The angular inertia local frame of this collider. */
|
|
66
|
+
angularInertiaLocalFrame: Parameters<Euler['set']>;
|
|
67
|
+
density?: never;
|
|
68
|
+
};
|
|
69
|
+
type NoMassProperties = {
|
|
70
|
+
density?: never;
|
|
71
|
+
mass?: never;
|
|
72
|
+
centerOfMass?: never;
|
|
73
|
+
principalAngularInertia?: never;
|
|
74
|
+
angularInertiaLocalFrame?: never;
|
|
75
|
+
};
|
|
76
|
+
export type MassDef = Density | Mass | MassProperties | NoMassProperties;
|
|
77
|
+
type MassProps<TMassDef extends MassDef> = TMassDef extends Density ? Density : TMassDef extends MassProperties ? MassProperties : TMassDef extends Mass ? Mass : NoMassProperties;
|
|
78
|
+
export type ColliderProps<TShape extends Shape, TMassDef extends MassDef> = CreateEvent<Collider> & ColliderEvents & BaseProps & ShapeProps<TShape> & MassProps<TMassDef> & {
|
|
79
|
+
children?: Snippet<[{
|
|
80
|
+
collider?: RapierCollider;
|
|
81
|
+
}]>;
|
|
82
|
+
};
|
|
83
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
<script
|
|
1
|
+
<script
|
|
2
|
+
lang="ts"
|
|
3
|
+
generics="TGroupsDef extends GroupsDef"
|
|
4
|
+
>import { setContext } from 'svelte';
|
|
2
5
|
import { writable } from 'svelte/store';
|
|
3
6
|
import { computeBitMask } from '../../lib/computeBitMask';
|
|
4
7
|
let { groups, filter, memberships, children } = $props();
|
|
@@ -1,35 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type GroupsProps = {
|
|
10
|
-
groups: N[]
|
|
11
|
-
|
|
12
|
-
filter?: never
|
|
13
|
-
memberships?: never
|
|
14
|
-
|
|
15
|
-
children?: Snippet
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { CollisionGroupsProps, GroupsDef } from './types';
|
|
3
|
+
declare class __sveltets_Render<TGroupsDef extends GroupsDef> {
|
|
4
|
+
props(): CollisionGroupsProps<TGroupsDef>;
|
|
5
|
+
events(): {};
|
|
6
|
+
slots(): {};
|
|
7
|
+
bindings(): "";
|
|
8
|
+
exports(): {};
|
|
16
9
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
children?: Snippet
|
|
10
|
+
interface $$IsomorphicComponent {
|
|
11
|
+
new <TGroupsDef extends GroupsDef>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<TGroupsDef>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<TGroupsDef>['props']>, ReturnType<__sveltets_Render<TGroupsDef>['events']>, ReturnType<__sveltets_Render<TGroupsDef>['slots']>> & {
|
|
12
|
+
$$bindings?: ReturnType<__sveltets_Render<TGroupsDef>['bindings']>;
|
|
13
|
+
} & ReturnType<__sveltets_Render<TGroupsDef>['exports']>;
|
|
14
|
+
<TGroupsDef extends GroupsDef>(internal: unknown, props: ReturnType<__sveltets_Render<TGroupsDef>['props']> & {}): ReturnType<__sveltets_Render<TGroupsDef>['exports']>;
|
|
15
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
25
16
|
}
|
|
26
|
-
|
|
27
|
-
type GroupsDef =
|
|
28
|
-
|
|
29
|
-
export type CollisionGroupsProps<TGroupsDef extends GroupsDef> = TGroupsDef extends GroupsProps
|
|
30
|
-
? GroupsProps
|
|
31
|
-
: MembershipsAndFilterProps
|
|
32
|
-
|
|
33
|
-
export default class CollisionGroups<TGroupsDef extends GroupsDef> extends SvelteComponent<
|
|
34
|
-
CollisionGroupsProps<TGroupsDef>
|
|
35
|
-
> {}
|
|
17
|
+
declare const CollisionGroups: $$IsomorphicComponent;
|
|
18
|
+
type CollisionGroups<TGroupsDef extends GroupsDef> = InstanceType<typeof CollisionGroups<TGroupsDef>>;
|
|
19
|
+
export default CollisionGroups;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type Snippet } from 'svelte';
|
|
2
|
+
type N = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15;
|
|
3
|
+
export type Groups = N[];
|
|
4
|
+
export type MembershipsAndFilter = N[];
|
|
5
|
+
type GroupsProps = {
|
|
6
|
+
groups: N[];
|
|
7
|
+
filter?: never;
|
|
8
|
+
memberships?: never;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
};
|
|
11
|
+
type MembershipsAndFilterProps = {
|
|
12
|
+
filter: N[];
|
|
13
|
+
memberships: N[];
|
|
14
|
+
groups?: never;
|
|
15
|
+
children?: Snippet;
|
|
16
|
+
};
|
|
17
|
+
export type GroupsDef = GroupsProps | MembershipsAndFilterProps;
|
|
18
|
+
export type CollisionGroupsProps<TGroupsDef extends GroupsDef> = TGroupsDef extends GroupsProps ? GroupsProps : MembershipsAndFilterProps;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<script lang="ts">import { T, useTask } from '@threlte/core';
|
|
2
2
|
import { onDestroy } from 'svelte';
|
|
3
|
-
import { BufferAttribute, BufferGeometry } from 'three';
|
|
3
|
+
import { BufferAttribute, BufferGeometry, LineSegments } from 'three';
|
|
4
4
|
import { useRapier } from '../../hooks/useRapier';
|
|
5
|
-
let { ref = $bindable(), ...props } = $props();
|
|
5
|
+
let { ref = $bindable(new LineSegments()), ...props } = $props();
|
|
6
6
|
const { world, debug } = useRapier();
|
|
7
7
|
const geometry = new BufferGeometry();
|
|
8
8
|
debug.set(true);
|
|
@@ -18,12 +18,12 @@ onDestroy(() => {
|
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
21
|
-
<T
|
|
22
|
-
|
|
21
|
+
<T
|
|
22
|
+
is={ref}
|
|
23
23
|
frustumCulled={false}
|
|
24
24
|
renderOrder={Infinity}
|
|
25
25
|
{...props}
|
|
26
26
|
>
|
|
27
27
|
<T is={geometry} />
|
|
28
28
|
<T.LineBasicMaterial vertexColors />
|
|
29
|
-
</T
|
|
29
|
+
</T>
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type DebugProps = Props<LineSegments>
|
|
6
|
-
|
|
7
|
-
export default class Debug extends SvelteComponent<DebugProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { DebugProps } from './types';
|
|
3
|
+
declare const Debug: import("svelte").Component<DebugProps, {}, "ref">;
|
|
4
|
+
export default Debug;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,102 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import type { RigidBodyEvents } from '../../types/types'
|
|
6
|
-
|
|
7
|
-
export type Boolean3Array = [x: boolean, y: boolean, z: boolean]
|
|
8
|
-
|
|
9
|
-
export type RigidBodyProps = {
|
|
10
|
-
rigidBody?: RapierRigidBody | undefined
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Specify the type of this rigid body
|
|
14
|
-
*/
|
|
15
|
-
type?: RigidBodyTypeString
|
|
16
|
-
|
|
17
|
-
/** Whether or not this body can sleep.
|
|
18
|
-
* default: true
|
|
19
|
-
*/
|
|
20
|
-
canSleep?: boolean
|
|
21
|
-
|
|
22
|
-
/** The linear velocity of this body.
|
|
23
|
-
* default: zero velocity
|
|
24
|
-
*/
|
|
25
|
-
linearVelocity?: Parameters<Vector3['set']>
|
|
26
|
-
|
|
27
|
-
/** The angular velocity of this body.
|
|
28
|
-
* Default: zero velocity.
|
|
29
|
-
*/
|
|
30
|
-
angularVelocity?: Parameters<Euler['set']>
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The scaling factor applied to the gravity affecting the rigid-body.
|
|
34
|
-
* Default: 1.0
|
|
35
|
-
*/
|
|
36
|
-
gravityScale?: number
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Whether or not Continous Collision Detection is enabled for this rigid-body.
|
|
40
|
-
* https://rapier.rs/docs/user_guides/javascript/rigid_bodies#continuous-collision-detection
|
|
41
|
-
* @default false
|
|
42
|
-
*/
|
|
43
|
-
ccd?: boolean
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Locks all rotations that would have resulted from forces on the created rigid-body.
|
|
47
|
-
*/
|
|
48
|
-
lockRotations?: boolean
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Locks all translations that would have resulted from forces on the created rigid-body.
|
|
52
|
-
*/
|
|
53
|
-
lockTranslations?: boolean
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Allow rotation of this rigid-body only along specific axes.
|
|
57
|
-
*/
|
|
58
|
-
enabledRotations?: Boolean3Array
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Allow translations of this rigid-body only along specific axes.
|
|
62
|
-
*/
|
|
63
|
-
enabledTranslations?: Boolean3Array
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Dominance is a non-realistic, but sometimes useful, feature.
|
|
67
|
-
* It can be used to make one rigid-body immune to forces
|
|
68
|
-
* originating from contacts with some other bodies.
|
|
69
|
-
*
|
|
70
|
-
* Number in the range -127 to 127, default is 0
|
|
71
|
-
*/
|
|
72
|
-
dominance?: number
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Damping lets you slow down a rigid-body automatically. This can be used to
|
|
76
|
-
* achieve a wide variety of effects like fake air friction. Larger values of
|
|
77
|
-
* damping coefficients lead to a stronger slow-downs. Their default
|
|
78
|
-
* values are 0.0 (no damping at all).
|
|
79
|
-
*/
|
|
80
|
-
linearDamping?: number
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Damping lets you slow down a rigid-body automatically. This can be used to
|
|
84
|
-
* achieve a wide variety of effects like fake air friction. Larger values of
|
|
85
|
-
* damping coefficients lead to a stronger slow-downs. Their default
|
|
86
|
-
* values are 0.0 (no damping at all).
|
|
87
|
-
*/
|
|
88
|
-
angularDamping?: number
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Set the rigidBody as enabled or disabled.
|
|
92
|
-
*/
|
|
93
|
-
enabled?: boolean
|
|
94
|
-
/**
|
|
95
|
-
* An arbitrary user-defined object associated with this rigid-body.
|
|
96
|
-
*/
|
|
97
|
-
userData?: Record<string, any>
|
|
98
|
-
|
|
99
|
-
children?: Snippet<[{ rigidBody: RapierRigidBody }]>
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export default class RigidBody extends SvelteComponent<RigidBodyProps & RigidBodyEvents> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { RigidBodyProps } from './types';
|
|
3
|
+
declare const RigidBody: import("svelte").Component<RigidBodyProps, {}, "rigidBody">;
|
|
4
|
+
export default RigidBody;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { RigidBody as RapierRigidBody } from '@dimforge/rapier3d-compat';
|
|
2
|
+
import { type Snippet } from 'svelte';
|
|
3
|
+
import type { Euler, Vector3 } from 'three';
|
|
4
|
+
import type { RigidBodyTypeString } from '../../lib/parseRigidBodyType';
|
|
5
|
+
import type { CreateEvent, RigidBodyEvents } from '../../types/types';
|
|
6
|
+
export type Boolean3Array = [x: boolean, y: boolean, z: boolean];
|
|
7
|
+
export type RigidBodyProps = CreateEvent<RapierRigidBody> & RigidBodyEvents & {
|
|
8
|
+
rigidBody?: RapierRigidBody | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Specify the type of this rigid body
|
|
11
|
+
*/
|
|
12
|
+
type?: RigidBodyTypeString;
|
|
13
|
+
/** Whether or not this body can sleep.
|
|
14
|
+
* default: true
|
|
15
|
+
*/
|
|
16
|
+
canSleep?: boolean;
|
|
17
|
+
/** The linear velocity of this body.
|
|
18
|
+
* default: zero velocity
|
|
19
|
+
*/
|
|
20
|
+
linearVelocity?: Parameters<Vector3['set']>;
|
|
21
|
+
/** The angular velocity of this body.
|
|
22
|
+
* Default: zero velocity.
|
|
23
|
+
*/
|
|
24
|
+
angularVelocity?: Parameters<Euler['set']>;
|
|
25
|
+
/**
|
|
26
|
+
* The scaling factor applied to the gravity affecting the rigid-body.
|
|
27
|
+
* Default: 1.0
|
|
28
|
+
*/
|
|
29
|
+
gravityScale?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Whether or not Continous Collision Detection is enabled for this rigid-body.
|
|
32
|
+
* https://rapier.rs/docs/user_guides/javascript/rigid_bodies#continuous-collision-detection
|
|
33
|
+
* @default false
|
|
34
|
+
*/
|
|
35
|
+
ccd?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Locks all rotations that would have resulted from forces on the created rigid-body.
|
|
38
|
+
*/
|
|
39
|
+
lockRotations?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Locks all translations that would have resulted from forces on the created rigid-body.
|
|
42
|
+
*/
|
|
43
|
+
lockTranslations?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Allow rotation of this rigid-body only along specific axes.
|
|
46
|
+
*/
|
|
47
|
+
enabledRotations?: Boolean3Array;
|
|
48
|
+
/**
|
|
49
|
+
* Allow translations of this rigid-body only along specific axes.
|
|
50
|
+
*/
|
|
51
|
+
enabledTranslations?: Boolean3Array;
|
|
52
|
+
/**
|
|
53
|
+
* Dominance is a non-realistic, but sometimes useful, feature.
|
|
54
|
+
* It can be used to make one rigid-body immune to forces
|
|
55
|
+
* originating from contacts with some other bodies.
|
|
56
|
+
*
|
|
57
|
+
* Number in the range -127 to 127, default is 0
|
|
58
|
+
*/
|
|
59
|
+
dominance?: number;
|
|
60
|
+
/**
|
|
61
|
+
* Damping lets you slow down a rigid-body automatically. This can be used to
|
|
62
|
+
* achieve a wide variety of effects like fake air friction. Larger values of
|
|
63
|
+
* damping coefficients lead to a stronger slow-downs. Their default
|
|
64
|
+
* values are 0.0 (no damping at all).
|
|
65
|
+
*/
|
|
66
|
+
linearDamping?: number;
|
|
67
|
+
/**
|
|
68
|
+
* Damping lets you slow down a rigid-body automatically. This can be used to
|
|
69
|
+
* achieve a wide variety of effects like fake air friction. Larger values of
|
|
70
|
+
* damping coefficients lead to a stronger slow-downs. Their default
|
|
71
|
+
* values are 0.0 (no damping at all).
|
|
72
|
+
*/
|
|
73
|
+
angularDamping?: number;
|
|
74
|
+
/**
|
|
75
|
+
* Set the rigidBody as enabled or disabled.
|
|
76
|
+
*/
|
|
77
|
+
enabled?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* An arbitrary user-defined object associated with this rigid-body.
|
|
80
|
+
*/
|
|
81
|
+
userData?: Record<string, any>;
|
|
82
|
+
children?: Snippet<[{
|
|
83
|
+
rigidBody: RapierRigidBody;
|
|
84
|
+
}]>;
|
|
85
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,49 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
RawDebugRenderPipeline,
|
|
6
|
-
RawImpulseJointSet,
|
|
7
|
-
RawIntegrationParameters,
|
|
8
|
-
RawIslandManager,
|
|
9
|
-
RawMultibodyJointSet,
|
|
10
|
-
RawNarrowPhase,
|
|
11
|
-
RawPhysicsPipeline,
|
|
12
|
-
RawQueryPipeline,
|
|
13
|
-
RawRigidBodySet,
|
|
14
|
-
RawSerializationPipeline
|
|
15
|
-
} from '@dimforge/rapier3d-compat/raw'
|
|
16
|
-
import { SvelteComponent, type Snippet } from 'svelte'
|
|
17
|
-
import type { Vector3 } from 'three'
|
|
18
|
-
import type { Key, Stage } from '@threlte/core'
|
|
19
|
-
|
|
20
|
-
export type WorldProps = {
|
|
21
|
-
framerate?: number | 'varying'
|
|
22
|
-
autoStart?: boolean
|
|
23
|
-
gravity?: Parameters<Vector3['set']>
|
|
24
|
-
rawIntegrationParameters?: RawIntegrationParameters
|
|
25
|
-
rawIslands?: RawIslandManager
|
|
26
|
-
rawBroadPhase?: RawBroadPhase
|
|
27
|
-
rawNarrowPhase?: RawNarrowPhase
|
|
28
|
-
rawBodies?: RawRigidBodySet
|
|
29
|
-
rawColliders?: RawColliderSet
|
|
30
|
-
rawImpulseJoints?: RawImpulseJointSet
|
|
31
|
-
rawMultibodyJoints?: RawMultibodyJointSet
|
|
32
|
-
rawCCDSolver?: RawCCDSolver
|
|
33
|
-
rawQueryPipeline?: RawQueryPipeline
|
|
34
|
-
rawPhysicsPipeline?: RawPhysicsPipeline
|
|
35
|
-
rawSerializationPipeline?: RawSerializationPipeline
|
|
36
|
-
rawDebugRenderPipeline?: RawDebugRenderPipeline
|
|
37
|
-
simulationStageOptions?: {
|
|
38
|
-
before?: (Key | Stage) | (Key | Stage)[]
|
|
39
|
-
after?: (Key | Stage) | (Key | Stage)[]
|
|
40
|
-
}
|
|
41
|
-
synchronizationStageOptions?: {
|
|
42
|
-
before?: (Key | Stage) | (Key | Stage)[]
|
|
43
|
-
after?: (Key | Stage) | (Key | Stage)[]
|
|
44
|
-
}
|
|
45
|
-
children?: Snippet
|
|
46
|
-
fallback?: Snippet<[error: any]>
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export default class World extends SvelteComponent<WorldProps> {}
|
|
1
|
+
/// <reference types="svelte" />
|
|
2
|
+
import type { WorldProps } from './types';
|
|
3
|
+
declare const World: import("svelte").Component<WorldProps, {}, "">;
|
|
4
|
+
export default World;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { RawBroadPhase, RawCCDSolver, RawColliderSet, RawDebugRenderPipeline, RawImpulseJointSet, RawIntegrationParameters, RawIslandManager, RawMultibodyJointSet, RawNarrowPhase, RawPhysicsPipeline, RawQueryPipeline, RawRigidBodySet, RawSerializationPipeline } from '@dimforge/rapier3d-compat/raw';
|
|
2
|
+
import type { Key, Stage } from '@threlte/core';
|
|
3
|
+
import { type Snippet } from 'svelte';
|
|
4
|
+
import type { Vector3 } from 'three';
|
|
5
|
+
export type WorldProps = {
|
|
6
|
+
framerate?: number | 'varying';
|
|
7
|
+
autoStart?: boolean;
|
|
8
|
+
gravity?: Parameters<Vector3['set']>;
|
|
9
|
+
rawIntegrationParameters?: RawIntegrationParameters;
|
|
10
|
+
rawIslands?: RawIslandManager;
|
|
11
|
+
rawBroadPhase?: RawBroadPhase;
|
|
12
|
+
rawNarrowPhase?: RawNarrowPhase;
|
|
13
|
+
rawBodies?: RawRigidBodySet;
|
|
14
|
+
rawColliders?: RawColliderSet;
|
|
15
|
+
rawImpulseJoints?: RawImpulseJointSet;
|
|
16
|
+
rawMultibodyJoints?: RawMultibodyJointSet;
|
|
17
|
+
rawCCDSolver?: RawCCDSolver;
|
|
18
|
+
rawQueryPipeline?: RawQueryPipeline;
|
|
19
|
+
rawPhysicsPipeline?: RawPhysicsPipeline;
|
|
20
|
+
rawSerializationPipeline?: RawSerializationPipeline;
|
|
21
|
+
rawDebugRenderPipeline?: RawDebugRenderPipeline;
|
|
22
|
+
simulationStageOptions?: {
|
|
23
|
+
before?: (Key | Stage) | (Key | Stage)[];
|
|
24
|
+
after?: (Key | Stage) | (Key | Stage)[];
|
|
25
|
+
};
|
|
26
|
+
synchronizationStageOptions?: {
|
|
27
|
+
before?: (Key | Stage) | (Key | Stage)[];
|
|
28
|
+
after?: (Key | Stage) | (Key | Stage)[];
|
|
29
|
+
};
|
|
30
|
+
children?: Snippet;
|
|
31
|
+
fallback?: Snippet<[error: any]>;
|
|
32
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -9,10 +9,9 @@ export { useJoint } from './hooks/useJoint';
|
|
|
9
9
|
export { default as World } from './components/World/World.svelte';
|
|
10
10
|
export { default as RigidBody } from './components/RigidBody/RigidBody.svelte';
|
|
11
11
|
export { default as Debug } from './components/Debug/Debug.svelte';
|
|
12
|
-
export { default as Collider } from './components/Colliders/Collider.svelte';
|
|
13
|
-
export { default as AutoColliders } from './components/Colliders/AutoColliders.svelte';
|
|
12
|
+
export { default as Collider } from './components/Colliders/Collider/Collider.svelte';
|
|
13
|
+
export { default as AutoColliders } from './components/Colliders/AutoColliders/AutoColliders.svelte';
|
|
14
14
|
export { default as CollisionGroups } from './components/CollisionGroups/CollisionGroups.svelte';
|
|
15
15
|
export { default as Attractor } from './components/Attractor/Attractor.svelte';
|
|
16
16
|
export { computeBitMask } from './lib/computeBitMask';
|
|
17
|
-
export {
|
|
18
|
-
export type { CollisionGroupsBitMask, AutoCollidersShapes, ColliderEventDispatcher, ColliderShapes, RapierContext, RigidBodyEventDispatcher, CollisionEnterEvent, CollisionExitEvent, SensorEnterEvent, SensorExitEvent, ContactEvent, GravityType } from './types/types';
|
|
17
|
+
export type { CollisionGroupsBitMask, AutoCollidersShapes, ColliderShapes, RapierContext, CollisionEnterEvent, CollisionExitEvent, SensorEnterEvent, SensorExitEvent, ContactEvent, GravityType, CreateEvent, Framerate } from './types/types';
|
package/dist/index.js
CHANGED
|
@@ -12,11 +12,9 @@ export { useJoint } from './hooks/useJoint';
|
|
|
12
12
|
export { default as World } from './components/World/World.svelte';
|
|
13
13
|
export { default as RigidBody } from './components/RigidBody/RigidBody.svelte';
|
|
14
14
|
export { default as Debug } from './components/Debug/Debug.svelte';
|
|
15
|
-
export { default as Collider } from './components/Colliders/Collider.svelte';
|
|
16
|
-
export { default as AutoColliders } from './components/Colliders/AutoColliders.svelte';
|
|
15
|
+
export { default as Collider } from './components/Colliders/Collider/Collider.svelte';
|
|
16
|
+
export { default as AutoColliders } from './components/Colliders/AutoColliders/AutoColliders.svelte';
|
|
17
17
|
export { default as CollisionGroups } from './components/CollisionGroups/CollisionGroups.svelte';
|
|
18
18
|
export { default as Attractor } from './components/Attractor/Attractor.svelte';
|
|
19
19
|
// lib
|
|
20
20
|
export { computeBitMask } from './lib/computeBitMask';
|
|
21
|
-
// recipes
|
|
22
|
-
export { default as BasicPlayerController } from './recipes/BasicPlayerController.svelte';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const useCreateEvent: <T>(oncreate?:
|
|
1
|
+
import type { CreateEvent } from '../types/types';
|
|
2
|
+
export declare const useCreateEvent: <T>(oncreate?: CreateEvent<T>['oncreate']) => {
|
|
3
3
|
updateRef: (newRef: T) => void;
|
|
4
4
|
};
|
|
@@ -7,13 +7,11 @@ export const useCreateEvent = (oncreate) => {
|
|
|
7
7
|
cleanupFunctions.forEach((cleanup) => cleanup());
|
|
8
8
|
// clear the cleanup functions array
|
|
9
9
|
cleanupFunctions.length = 0;
|
|
10
|
-
const cleanup = (callback) => {
|
|
11
|
-
// add cleanup function to array
|
|
12
|
-
cleanupFunctions.push(callback);
|
|
13
|
-
};
|
|
14
10
|
if (ref === undefined)
|
|
15
11
|
return;
|
|
16
|
-
oncreate?.(
|
|
12
|
+
const cleanup = oncreate?.(ref);
|
|
13
|
+
if (cleanup)
|
|
14
|
+
cleanupFunctions.push(cleanup);
|
|
17
15
|
};
|
|
18
16
|
const updateRef = (newRef) => {
|
|
19
17
|
ref = newRef;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -6,11 +6,10 @@ import type { Readable, Writable } from 'svelte/store';
|
|
|
6
6
|
import type { Object3D } from 'three';
|
|
7
7
|
export type ColliderShapes = 'ball' | 'capsule' | 'segment' | 'triangle' | 'roundTriangle' | 'polyline' | 'trimesh' | 'cuboid' | 'roundCuboid' | 'heightfield' | 'cylinder' | 'roundCylinder' | 'cone' | 'roundCone' | 'convexHull' | 'convexMesh' | 'roundConvexHull' | 'roundConvexMesh';
|
|
8
8
|
export type AutoCollidersShapes = 'cuboid' | 'ball' | 'trimesh' | 'convexHull' | 'capsule';
|
|
9
|
+
export type CreateEvent<T> = {
|
|
10
|
+
oncreate?: (ref: T) => void | (() => void);
|
|
11
|
+
};
|
|
9
12
|
export type ColliderEvents = {
|
|
10
|
-
oncreate?: (event: {
|
|
11
|
-
ref: Collider;
|
|
12
|
-
cleanup: (callback: () => void) => void;
|
|
13
|
-
}) => void;
|
|
14
13
|
oncollisionenter?: (event: {
|
|
15
14
|
targetCollider: Collider;
|
|
16
15
|
targetRigidBody: RigidBody | null;
|
package/package.json
CHANGED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { CoefficientCombineRule, Collider } from '@dimforge/rapier3d-compat'
|
|
2
|
-
import { SvelteComponent, type Snippet } from 'svelte'
|
|
3
|
-
import type { Euler, Vector3 } from 'three'
|
|
4
|
-
import type { AutoCollidersShapes, ColliderEvents } from '../../types/types'
|
|
5
|
-
|
|
6
|
-
// ------------------ BASE ------------------
|
|
7
|
-
|
|
8
|
-
type BaseProps = {
|
|
9
|
-
shape?: AutoCollidersShapes
|
|
10
|
-
restitution?: number
|
|
11
|
-
restitutionCombineRule?: CoefficientCombineRule
|
|
12
|
-
friction?: number
|
|
13
|
-
frictionCombineRule?: CoefficientCombineRule
|
|
14
|
-
sensor?: boolean
|
|
15
|
-
colliders?: Collider[]
|
|
16
|
-
contactForceEventThreshold?: number
|
|
17
|
-
|
|
18
|
-
refresh?: () => void
|
|
19
|
-
|
|
20
|
-
oncreate?: () => void
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// ------------------ MASS ------------------
|
|
24
|
-
|
|
25
|
-
type Density = {
|
|
26
|
-
density: number
|
|
27
|
-
|
|
28
|
-
mass?: never
|
|
29
|
-
centerOfMass?: never
|
|
30
|
-
principalAngularInertia?: never
|
|
31
|
-
angularInertiaLocalFrame?: never
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
type Mass = {
|
|
35
|
-
mass: number
|
|
36
|
-
density?: never
|
|
37
|
-
centerOfMass?: never
|
|
38
|
-
principalAngularInertia?: never
|
|
39
|
-
angularInertiaLocalFrame?: never
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
type MassProperties = {
|
|
43
|
-
mass: number
|
|
44
|
-
centerOfMass: Parameters<Vector3['set']>
|
|
45
|
-
principalAngularInertia: Parameters<Vector3['set']>
|
|
46
|
-
angularInertiaLocalFrame: Parameters<Euler['set']>
|
|
47
|
-
density?: never
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
type NoMassProperties = {
|
|
51
|
-
density?: never
|
|
52
|
-
mass?: never
|
|
53
|
-
centerOfMass?: never
|
|
54
|
-
principalAngularInertia?: never
|
|
55
|
-
angularInertiaLocalFrame?: never
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export type MassDef = Density | Mass | MassProperties | NoMassProperties
|
|
59
|
-
|
|
60
|
-
type MassProps<TMassDef extends MassDef> = TMassDef extends Density
|
|
61
|
-
? Density
|
|
62
|
-
: TMassDef extends MassProperties
|
|
63
|
-
? MassProperties
|
|
64
|
-
: TMassDef extends Mass
|
|
65
|
-
? Mass
|
|
66
|
-
: NoMassProperties
|
|
67
|
-
|
|
68
|
-
// ------------------ COLLIDER ------------------
|
|
69
|
-
|
|
70
|
-
export type AutoCollidersProps<TMassDef extends MassDef> = BaseProps &
|
|
71
|
-
MassProps<TMassDef> & {
|
|
72
|
-
children?: Snippet<
|
|
73
|
-
[
|
|
74
|
-
{
|
|
75
|
-
colliders: Collider[]
|
|
76
|
-
refresh: () => void
|
|
77
|
-
}
|
|
78
|
-
]
|
|
79
|
-
>
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export default class AutoColliders<TMassDef extends MassDef> extends SvelteComponent<
|
|
83
|
-
AutoCollidersProps<TMassDef>
|
|
84
|
-
> {}
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CoefficientCombineRule,
|
|
3
|
-
Collider as RapierCollider,
|
|
4
|
-
ColliderDesc
|
|
5
|
-
} from '@dimforge/rapier3d-compat'
|
|
6
|
-
import { SvelteComponent, type Snippet } from 'svelte'
|
|
7
|
-
import type { Euler, Vector3 } from 'three'
|
|
8
|
-
import type { ColliderEvents } from '../../types/types'
|
|
9
|
-
|
|
10
|
-
// ------------------ BASE ------------------
|
|
11
|
-
|
|
12
|
-
type Type = 'static' | 'dynamic'
|
|
13
|
-
|
|
14
|
-
type BaseProps = {
|
|
15
|
-
type?: Type
|
|
16
|
-
restitution?: number
|
|
17
|
-
restitutionCombineRule?: CoefficientCombineRule
|
|
18
|
-
friction?: number
|
|
19
|
-
frictionCombineRule?: CoefficientCombineRule
|
|
20
|
-
sensor?: boolean
|
|
21
|
-
collider?: RapierCollider
|
|
22
|
-
contactForceEventThreshold?: number
|
|
23
|
-
refresh?: () => void
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// ------------------ SHAPE ------------------
|
|
27
|
-
|
|
28
|
-
export type Shape =
|
|
29
|
-
| 'ball'
|
|
30
|
-
| 'capsule'
|
|
31
|
-
| 'segment'
|
|
32
|
-
| 'triangle'
|
|
33
|
-
| 'roundTriangle'
|
|
34
|
-
| 'polyline'
|
|
35
|
-
| 'trimesh'
|
|
36
|
-
| 'cuboid'
|
|
37
|
-
| 'roundCuboid'
|
|
38
|
-
| 'heightfield'
|
|
39
|
-
| 'cylinder'
|
|
40
|
-
| 'roundCylinder'
|
|
41
|
-
| 'cone'
|
|
42
|
-
| 'roundCone'
|
|
43
|
-
| 'convexHull'
|
|
44
|
-
| 'convexMesh'
|
|
45
|
-
| 'roundConvexHull'
|
|
46
|
-
| 'roundConvexMesh'
|
|
47
|
-
|
|
48
|
-
type Args<TShape extends Shape> = Parameters<(typeof ColliderDesc)[TShape]>
|
|
49
|
-
|
|
50
|
-
type ShapeProps<TShape extends Shape> = {
|
|
51
|
-
shape: TShape
|
|
52
|
-
args: Args<TShape>
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
// ------------------ MASS ------------------
|
|
56
|
-
|
|
57
|
-
type Density = {
|
|
58
|
-
density: number
|
|
59
|
-
mass?: never
|
|
60
|
-
centerOfMass?: never
|
|
61
|
-
principalAngularInertia?: never
|
|
62
|
-
angularInertiaLocalFrame?: never
|
|
63
|
-
}
|
|
64
|
-
type Mass = {
|
|
65
|
-
mass: number
|
|
66
|
-
density?: never
|
|
67
|
-
centerOfMass?: never
|
|
68
|
-
principalAngularInertia?: never
|
|
69
|
-
angularInertiaLocalFrame?: never
|
|
70
|
-
}
|
|
71
|
-
type MassProperties = {
|
|
72
|
-
mass: number
|
|
73
|
-
centerOfMass: Parameters<Vector3['set']>
|
|
74
|
-
principalAngularInertia: Parameters<Vector3['set']>
|
|
75
|
-
angularInertiaLocalFrame: Parameters<Euler['set']>
|
|
76
|
-
density?: never
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
type NoMassProperties = {
|
|
80
|
-
density?: never
|
|
81
|
-
mass?: never
|
|
82
|
-
centerOfMass?: never
|
|
83
|
-
principalAngularInertia?: never
|
|
84
|
-
angularInertiaLocalFrame?: never
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export type MassDef = Density | Mass | MassProperties | NoMassProperties
|
|
88
|
-
|
|
89
|
-
type MassProps<TMassDef extends MassDef> = TMassDef extends Density
|
|
90
|
-
? Density
|
|
91
|
-
: TMassDef extends MassProperties
|
|
92
|
-
? MassProperties
|
|
93
|
-
: TMassDef extends Mass
|
|
94
|
-
? Mass
|
|
95
|
-
: NoMassProperties
|
|
96
|
-
|
|
97
|
-
// ------------------ COLLIDER ------------------
|
|
98
|
-
|
|
99
|
-
export type ColliderProps<TShape extends Shape, TMassDef extends MassDef> = BaseProps &
|
|
100
|
-
ColliderEvents &
|
|
101
|
-
ShapeProps<TShape> &
|
|
102
|
-
MassProps<TMassDef> & {
|
|
103
|
-
children?: Snippet<[{ collider?: RapierCollider }]>
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
export default class Collider<
|
|
107
|
-
TShape extends Shape,
|
|
108
|
-
TMassDef extends MassDef
|
|
109
|
-
> extends SvelteComponent<ColliderProps<TShape, TMassDef>> {}
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
<script lang="ts">import { T, useTask } from '@threlte/core';
|
|
2
|
-
import { Vector2, Vector3 } from 'three';
|
|
3
|
-
import Collider from '../components/Colliders/Collider.svelte';
|
|
4
|
-
import CollisionGroups from '../components/CollisionGroups/CollisionGroups.svelte';
|
|
5
|
-
import RigidBody from '../components/RigidBody/RigidBody.svelte';
|
|
6
|
-
export let position = undefined;
|
|
7
|
-
export let height = 1.7;
|
|
8
|
-
export let radius = 0.3;
|
|
9
|
-
export let speed = 1;
|
|
10
|
-
export let jumpStrength = 3;
|
|
11
|
-
export let playerCollisionGroups = [0];
|
|
12
|
-
export let groundCollisionGroups = [15];
|
|
13
|
-
export let ongroundenter = undefined;
|
|
14
|
-
export let ongroundexit = undefined;
|
|
15
|
-
let rigidBody;
|
|
16
|
-
const keys = {
|
|
17
|
-
up: false,
|
|
18
|
-
down: false,
|
|
19
|
-
left: false,
|
|
20
|
-
right: false
|
|
21
|
-
};
|
|
22
|
-
const t = new Vector3();
|
|
23
|
-
const t2 = new Vector2();
|
|
24
|
-
let grounded = false;
|
|
25
|
-
let groundsSensored = 0;
|
|
26
|
-
$: {
|
|
27
|
-
if (groundsSensored === 0)
|
|
28
|
-
grounded = false;
|
|
29
|
-
else
|
|
30
|
-
grounded = true;
|
|
31
|
-
}
|
|
32
|
-
$: grounded ? ongroundenter?.() : ongroundexit?.();
|
|
33
|
-
const { start } = useTask(() => {
|
|
34
|
-
t.set(0, 0, 0);
|
|
35
|
-
if (keys.down)
|
|
36
|
-
t.x += 1;
|
|
37
|
-
if (keys.up)
|
|
38
|
-
t.x -= 1;
|
|
39
|
-
if (keys.left)
|
|
40
|
-
t.z += 1;
|
|
41
|
-
if (keys.right)
|
|
42
|
-
t.z -= 1;
|
|
43
|
-
const l = t.length();
|
|
44
|
-
const xzLength = t2.set(t.x, t.z).length();
|
|
45
|
-
if (l > 0)
|
|
46
|
-
t.divideScalar(l).multiplyScalar(speed);
|
|
47
|
-
if (xzLength > 0) {
|
|
48
|
-
rigidBody.resetForces(true);
|
|
49
|
-
rigidBody.resetTorques(true);
|
|
50
|
-
}
|
|
51
|
-
const linVel = rigidBody.linvel();
|
|
52
|
-
t.y = linVel.y;
|
|
53
|
-
rigidBody.setLinvel(t, true);
|
|
54
|
-
});
|
|
55
|
-
$: if (rigidBody)
|
|
56
|
-
start();
|
|
57
|
-
const onKeyDown = (e) => {
|
|
58
|
-
switch (e.key.toLowerCase()) {
|
|
59
|
-
case 's':
|
|
60
|
-
case 'arrowdown':
|
|
61
|
-
keys.down = true;
|
|
62
|
-
break;
|
|
63
|
-
case 'w':
|
|
64
|
-
case 'arrowup':
|
|
65
|
-
keys.up = true;
|
|
66
|
-
break;
|
|
67
|
-
case 'a':
|
|
68
|
-
case 'arrowleft':
|
|
69
|
-
keys.left = true;
|
|
70
|
-
break;
|
|
71
|
-
case 'd':
|
|
72
|
-
case 'arrowright':
|
|
73
|
-
keys.right = true;
|
|
74
|
-
break;
|
|
75
|
-
case ' ':
|
|
76
|
-
if (!rigidBody || !grounded)
|
|
77
|
-
break;
|
|
78
|
-
rigidBody.applyImpulse({ x: 0, y: jumpStrength, z: 0 }, true);
|
|
79
|
-
default:
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
const onKeyUp = (e) => {
|
|
84
|
-
switch (e.key.toLowerCase()) {
|
|
85
|
-
case 's':
|
|
86
|
-
case 'arrowdown':
|
|
87
|
-
keys.down = false;
|
|
88
|
-
break;
|
|
89
|
-
case 'w':
|
|
90
|
-
case 'arrowup':
|
|
91
|
-
keys.up = false;
|
|
92
|
-
break;
|
|
93
|
-
case 'a':
|
|
94
|
-
case 'arrowleft':
|
|
95
|
-
keys.left = false;
|
|
96
|
-
break;
|
|
97
|
-
case 'd':
|
|
98
|
-
case 'arrowright':
|
|
99
|
-
keys.right = false;
|
|
100
|
-
break;
|
|
101
|
-
default:
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
</script>
|
|
106
|
-
|
|
107
|
-
<svelte:window
|
|
108
|
-
on:keydown|preventDefault={onKeyDown}
|
|
109
|
-
on:keyup|preventDefault={onKeyUp}
|
|
110
|
-
/>
|
|
111
|
-
|
|
112
|
-
<T.Group {position}>
|
|
113
|
-
<RigidBody
|
|
114
|
-
dominance={127}
|
|
115
|
-
enabledRotations={[false, false, false]}
|
|
116
|
-
bind:rigidBody
|
|
117
|
-
type={'dynamic'}
|
|
118
|
-
>
|
|
119
|
-
<CollisionGroups groups={playerCollisionGroups}>
|
|
120
|
-
<Collider
|
|
121
|
-
shape={'capsule'}
|
|
122
|
-
args={[height / 2 - radius, radius]}
|
|
123
|
-
/>
|
|
124
|
-
</CollisionGroups>
|
|
125
|
-
|
|
126
|
-
<CollisionGroups groups={groundCollisionGroups}>
|
|
127
|
-
<T.Group position={[0, -height / 2 + radius, 0]}>
|
|
128
|
-
<Collider
|
|
129
|
-
sensor
|
|
130
|
-
onsensorenter={() => (groundsSensored += 1)}
|
|
131
|
-
onsensorexit={() => (groundsSensored -= 1)}
|
|
132
|
-
shape={'ball'}
|
|
133
|
-
args={[radius * 1.2]}
|
|
134
|
-
/>
|
|
135
|
-
</T.Group>
|
|
136
|
-
</CollisionGroups>
|
|
137
|
-
|
|
138
|
-
<T.Group position.y={-height / 2}>
|
|
139
|
-
<slot />
|
|
140
|
-
</T.Group>
|
|
141
|
-
</RigidBody>
|
|
142
|
-
</T.Group>
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/// <reference types="svelte" />
|
|
2
|
-
import { Vector3 } from 'three';
|
|
3
|
-
import type { CollisionGroupsBitMask } from '../types/types';
|
|
4
|
-
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
5
|
-
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
6
|
-
$$bindings?: Bindings;
|
|
7
|
-
} & Exports;
|
|
8
|
-
(internal: unknown, props: Props & {
|
|
9
|
-
$$events?: Events;
|
|
10
|
-
$$slots?: Slots;
|
|
11
|
-
}): Exports & {
|
|
12
|
-
$set?: any;
|
|
13
|
-
$on?: any;
|
|
14
|
-
};
|
|
15
|
-
z_$$bindings?: Bindings;
|
|
16
|
-
}
|
|
17
|
-
type $$__sveltets_2_PropsWithChildren<Props, Slots> = Props & (Slots extends {
|
|
18
|
-
default: any;
|
|
19
|
-
} ? Props extends Record<string, never> ? any : {
|
|
20
|
-
children?: any;
|
|
21
|
-
} : {});
|
|
22
|
-
declare const BasicPlayerController: $$__sveltets_2_IsomorphicComponent<$$__sveltets_2_PropsWithChildren<{
|
|
23
|
-
position?: Parameters<Vector3['set']> | undefined;
|
|
24
|
-
height?: number | undefined;
|
|
25
|
-
radius?: number | undefined;
|
|
26
|
-
speed?: number | undefined;
|
|
27
|
-
jumpStrength?: number | undefined;
|
|
28
|
-
playerCollisionGroups?: CollisionGroupsBitMask | undefined;
|
|
29
|
-
groundCollisionGroups?: CollisionGroupsBitMask | undefined;
|
|
30
|
-
ongroundenter?: (() => void) | undefined;
|
|
31
|
-
ongroundexit?: (() => void) | undefined;
|
|
32
|
-
}, {
|
|
33
|
-
default: {};
|
|
34
|
-
}>, {
|
|
35
|
-
[evt: string]: CustomEvent<any>;
|
|
36
|
-
}, {
|
|
37
|
-
default: {};
|
|
38
|
-
}, {}, string>;
|
|
39
|
-
type BasicPlayerController = InstanceType<typeof BasicPlayerController>;
|
|
40
|
-
export default BasicPlayerController;
|