@threlte/rapier 1.0.0-next.1 → 1.0.0-next.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @threlte/extras
2
2
 
3
+ ## 1.0.0-next.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 3868395: Updated prettier
8
+
9
+ ## 1.0.0-next.2
10
+
11
+ ### Patch Changes
12
+
13
+ - eb0dc69f: Removed the component TransformableObject, removed stale types from rapier package
14
+
3
15
  ## 1.0.0-next.1
4
16
 
5
17
  ### Major Changes
@@ -1,13 +1,34 @@
1
- import { SvelteComponentTyped } from 'svelte'
2
- import type { AttractorProperties } from '../../types/components'
3
1
  import { Props, type Events, type Slots } from '@threlte/core'
2
+ import { SvelteComponentTyped } from 'svelte'
4
3
  import type { Group } from 'three'
4
+ import type { GravityType } from '../../types/types'
5
5
 
6
6
  type AttractorProps = Props<Group> & {
7
- strength?: NonNullable<AttractorProperties['strength']>
8
- range?: NonNullable<AttractorProperties['range']>
9
- gravityType?: NonNullable<AttractorProperties['gravityType']>
10
- gravitationalConstant?: NonNullable<AttractorProperties['gravitationalConstant']>
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
11
32
  }
12
33
 
13
34
  type AttractorEvents = Events<Group>
package/dist/index.d.ts CHANGED
@@ -15,5 +15,4 @@ export { default as CollisionGroups } from './components/CollisionGroups/Collisi
15
15
  export { default as Attractor } from './components/Attractor/Attractor.svelte';
16
16
  export { computeBitMask } from './lib/computeBitMask';
17
17
  export { default as BasicPlayerController } from './recipes/BasicPlayerController.svelte';
18
- export type { AutoCollidersProperties, AttractorProperties } from './types/components';
19
- export type { CollisionGroupsBitMask, AutoCollidersShapes, ColliderEventDispatcher, ColliderShapes, RapierContext, RigidBodyEventDispatcher, CollisionEnterEvent, CollisionExitEvent, SensorEnterEvent, SensorExitEvent, ContactEvent } from './types/types';
18
+ export type { CollisionGroupsBitMask, AutoCollidersShapes, ColliderEventDispatcher, ColliderShapes, RapierContext, RigidBodyEventDispatcher, CollisionEnterEvent, CollisionExitEvent, SensorEnterEvent, SensorExitEvent, ContactEvent, GravityType } from './types/types';
@@ -56,3 +56,7 @@ export declare type ThrelteRigidBody = RigidBody & {
56
56
  };
57
57
  export declare type RigidBodyContext = ThrelteRigidBody;
58
58
  export declare type CollisionGroupsBitMask = (0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15)[];
59
+ /**
60
+ * Used in the <Attractor> component
61
+ */
62
+ export declare type GravityType = 'static' | 'linear' | 'newtonian';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threlte/rapier",
3
- "version": "1.0.0-next.1",
3
+ "version": "1.0.0-next.3",
4
4
  "author": "Grischa Erbe <hello@legrisch.com> (https://legrisch.com)",
5
5
  "license": "MIT",
6
6
  "devDependencies": {
@@ -8,7 +8,6 @@
8
8
  "@sveltejs/adapter-auto": "1.0.0-next.61",
9
9
  "@sveltejs/adapter-static": "1.0.0-next.35",
10
10
  "@sveltejs/kit": "1.0.0-next.377",
11
- "@threlte/core": "6.0.0-next.2",
12
11
  "@types/node": "^18.0.3",
13
12
  "@types/three": "^0.144.0",
14
13
  "@typescript-eslint/eslint-plugin": "^4.31.1",
@@ -17,7 +16,7 @@
17
16
  "eslint": "^7.32.0",
18
17
  "eslint-config-prettier": "^8.3.0",
19
18
  "eslint-plugin-svelte3": "^3.2.1",
20
- "prettier": "^2.6.2",
19
+ "prettier": "^2.8.8",
21
20
  "prettier-plugin-svelte": "^2.4.0",
22
21
  "svelte": "^3.47.0",
23
22
  "svelte-check": "^2.7.0",
@@ -28,7 +27,8 @@
28
27
  "tsafe": "^0.9.0",
29
28
  "tslib": "^2.3.1",
30
29
  "type-fest": "^2.13.0",
31
- "typescript": "^4.6.3"
30
+ "typescript": "^4.6.3",
31
+ "@threlte/core": "6.0.0-next.11"
32
32
  },
33
33
  "type": "module",
34
34
  "exports": {
@@ -1,87 +0,0 @@
1
- import type { CoefficientCombineRule, ColliderDesc } from '@dimforge/rapier3d-compat';
2
- import type { Position, TransformableObjectProperties } from '@threlte/core';
3
- import type { AutoCollidersShapes, ColliderShapes, CollisionGroupsBitMask } from './types';
4
- export declare type Vector3Array = [x: number, y: number, z: number];
5
- export declare type GravityType = 'static' | 'linear' | 'newtonian';
6
- export declare type ColliderProperties<Shape extends ColliderShapes> = Omit<TransformableObjectProperties, 'object'> & {
7
- shape: Shape;
8
- /**
9
- * Arguments to pass to the collider specific to shape
10
- */
11
- args: Parameters<typeof ColliderDesc[Shape]>;
12
- /**
13
- * The mass of this rigid body.
14
- * The mass and density is automatically calculated based on the shape of the collider.
15
- * Generally, it's not recommended to adjust the mass properties as it could lead to
16
- * unexpected behaviors.
17
- * More info https://rapier.rs/docs/user_guides/javascript/colliders#mass-properties
18
- */
19
- mass?: number;
20
- density?: number;
21
- /**
22
- * The center of mass of this rigid body
23
- */
24
- centerOfMass?: Position;
25
- /**
26
- * Principal angular inertia of this rigid body
27
- */
28
- principalAngularInertia?: Position;
29
- /**
30
- * Restitution controls how elastic (aka. bouncy) a contact is. Le elasticity of a contact is controlled by the restitution coefficient
31
- */
32
- restitution?: number;
33
- /**
34
- * What happens when two bodies meet. See https://rapier.rs/docs/user_guides/javascript/colliders#friction.
35
- */
36
- restitutionCombineRule?: CoefficientCombineRule;
37
- /**
38
- * Friction is a force that opposes the relative tangential motion between two rigid-bodies with colliders in contact.
39
- * A friction coefficient of 0 implies no friction at all (completely sliding contact) and a coefficient
40
- * greater or equal to 1 implies a very strong friction. Values greater than 1 are allowed.
41
- */
42
- friction?: number;
43
- /**
44
- * What happens when two bodies meet. See https://rapier.rs/docs/user_guides/javascript/colliders#friction.
45
- */
46
- frictionCombineRule?: CoefficientCombineRule;
47
- /**
48
- * A sensor does not participate in physics simulation and is
49
- * used as a trigger e.g. to check whether another RigidBody
50
- * entered an area.
51
- */
52
- sensor?: boolean;
53
- };
54
- export declare type AutoCollidersProperties = Omit<ColliderProperties<AutoCollidersShapes>, 'args'>;
55
- export declare type CollisionGroupsProperties = {
56
- groups: CollisionGroupsBitMask;
57
- } | {
58
- filter: CollisionGroupsBitMask;
59
- memberships: CollisionGroupsBitMask;
60
- };
61
- export declare type AttractorProperties = Omit<TransformableObjectProperties, 'object'> & {
62
- /**
63
- * The radius for the Attractor's sphere of influence within which rigid-bodies will be affected.
64
- * Default: 10.0
65
- */
66
- range?: number;
67
- /**
68
- * The strength factor applied to the impulse affecting rigid-bodies within range. For newtonian
69
- * calculations, strength is treated as m1 mass.
70
- * Default: 1.0
71
- */
72
- strength?: number;
73
- /**
74
- * The method of calculating gravity on rigid bodies within range.
75
- * 'static' = the same force (strength) is applied on bodies within range, regardless of distance
76
- * 'linear' = force is calculated as strength * distance / range (force decreases the farther a body is from the attractor position)
77
- * 'newtonian' = force is calculated as gravitationalConstant * mass1 * mass2 / Math.pow(distance, 2)
78
- * Default: 'static'
79
- */
80
- gravityType?: GravityType;
81
- /**
82
- * The gravitational constant used to calculate force in newtonian calculations. Most people probably won't use this,
83
- * but it provides an option for more realistic physics simulations.
84
- * Default: 6.673e-11
85
- */
86
- gravitationalConstant?: number;
87
- };
@@ -1 +0,0 @@
1
- export {};