@gg-web-engine/rapier3d 0.0.40 → 0.0.48

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/README.md CHANGED
File without changes
@@ -2,6 +2,9 @@ import { Pnt3, Qtrn, } from '@gg-web-engine/core';
2
2
  import { Vector3 } from '@dimforge/rapier3d-compat';
3
3
  import { Rapier3dRigidBodyComponent } from './rapier-3d-rigid-body.component';
4
4
  export class Rapier3dRaycastVehicleComponent extends Rapier3dRigidBodyComponent {
5
+ get nativeVehicle() {
6
+ return this._nativeVehicle;
7
+ }
5
8
  constructor(world, chassisBody) {
6
9
  super(world, ...chassisBody.factoryProps);
7
10
  this.world = world;
@@ -9,9 +12,6 @@ export class Rapier3dRaycastVehicleComponent extends Rapier3dRigidBodyComponent
9
12
  this._nativeVehicle = null;
10
13
  this.wheelDescr = [];
11
14
  }
12
- get nativeVehicle() {
13
- return this._nativeVehicle;
14
- }
15
15
  get wheelSpeed() {
16
16
  var _a;
17
17
  return (((_a = this.nativeVehicle) === null || _a === void 0 ? void 0 : _a.currentVehicleSpeed()) || 0) / 3.6;
@@ -1,20 +1,6 @@
1
1
  import { BitMask, Pnt3, Qtrn, } from '@gg-web-engine/core';
2
2
  import { ColliderDesc, Quaternion, RigidBodyDesc, Vector3 } from '@dimforge/rapier3d-compat';
3
3
  export class Rapier3dRigidBodyComponent {
4
- constructor(world, _colliderDescr, shape, _bodyDescr, _colliderOptions) {
5
- this.world = world;
6
- this._colliderDescr = _colliderDescr;
7
- this.shape = shape;
8
- this._bodyDescr = _bodyDescr;
9
- this._colliderOptions = _colliderOptions;
10
- this.entity = null;
11
- this._nativeBody = null;
12
- this._nativeBodyColliders = null;
13
- this.name = '';
14
- this.collisionGroups = BitMask.full(32);
15
- this.ownCollisionGroups = (_colliderOptions === null || _colliderOptions === void 0 ? void 0 : _colliderOptions.ownCollisionGroups) || 'all';
16
- this.interactWithCollisionGroups = (_colliderOptions === null || _colliderOptions === void 0 ? void 0 : _colliderOptions.interactWithCollisionGroups) || 'all';
17
- }
18
4
  get position() {
19
5
  return Pnt3.clone(this.nativeBody ? this.nativeBody.translation() : this._bodyDescr.translation);
20
6
  }
@@ -92,6 +78,20 @@ export class Rapier3dRigidBodyComponent {
92
78
  // TODO more fields here?
93
79
  return [colliderDescr, this.shape, bd, this._colliderOptions];
94
80
  }
81
+ constructor(world, _colliderDescr, shape, _bodyDescr, _colliderOptions) {
82
+ this.world = world;
83
+ this._colliderDescr = _colliderDescr;
84
+ this.shape = shape;
85
+ this._bodyDescr = _bodyDescr;
86
+ this._colliderOptions = _colliderOptions;
87
+ this.entity = null;
88
+ this._nativeBody = null;
89
+ this._nativeBodyColliders = null;
90
+ this.name = '';
91
+ this.collisionGroups = BitMask.full(32);
92
+ this.ownCollisionGroups = (_colliderOptions === null || _colliderOptions === void 0 ? void 0 : _colliderOptions.ownCollisionGroups) || 'all';
93
+ this.interactWithCollisionGroups = (_colliderOptions === null || _colliderOptions === void 0 ? void 0 : _colliderOptions.interactWithCollisionGroups) || 'all';
94
+ }
95
95
  get interactWithCollisionGroups() {
96
96
  return BitMask.unpack(this.collisionGroups, 16);
97
97
  }
File without changes
@@ -1,15 +1,6 @@
1
1
  import { Subject } from 'rxjs';
2
2
  import { Rapier3dRigidBodyComponent } from './rapier-3d-rigid-body.component';
3
3
  export class Rapier3dTriggerComponent extends Rapier3dRigidBodyComponent {
4
- constructor(world, _colliderDescr, shape, _bodyDescr) {
5
- super(world, _colliderDescr, shape, _bodyDescr, null);
6
- this.world = world;
7
- this._colliderDescr = _colliderDescr;
8
- this.shape = shape;
9
- this._bodyDescr = _bodyDescr;
10
- this.onEnter$ = new Subject();
11
- this.onLeft$ = new Subject();
12
- }
13
4
  get onEntityEntered() {
14
5
  return this.onEnter$.asObservable();
15
6
  }
@@ -19,6 +10,15 @@ export class Rapier3dTriggerComponent extends Rapier3dRigidBodyComponent {
19
10
  get debugBodySettings() {
20
11
  return { shape: this.shape, type: 'TRIGGER' };
21
12
  }
13
+ constructor(world, _colliderDescr, shape, _bodyDescr) {
14
+ super(world, _colliderDescr, shape, _bodyDescr, null);
15
+ this.world = world;
16
+ this._colliderDescr = _colliderDescr;
17
+ this.shape = shape;
18
+ this._bodyDescr = _bodyDescr;
19
+ this.onEnter$ = new Subject();
20
+ this.onLeft$ = new Subject();
21
+ }
22
22
  addToWorld(world) {
23
23
  if (world.physicsWorld != this.world) {
24
24
  throw new Error('Rapier3D bodies cannot be shared between different worlds');
File without changes
@@ -12,20 +12,6 @@ import { Rapier3dFactory } from '../rapier-3d-factory';
12
12
  import { Rapier3dLoader } from '../rapier-3d-loader';
13
13
  import { Subject } from 'rxjs';
14
14
  export class Rapier3dWorldComponent {
15
- constructor() {
16
- this._factory = null;
17
- this._loader = null;
18
- this.added$ = new Subject();
19
- this.removed$ = new Subject();
20
- this.children = [];
21
- this._gravity = { x: 0, y: 0, z: -9.82 };
22
- this._nativeWorld = null;
23
- this._eventQueue = null;
24
- this.handleIdEntityMap = new Map();
25
- this.lockedCollisionGroups = [];
26
- this.added$.subscribe(c => this.children.push(c));
27
- this.removed$.subscribe(c => this.children.splice(this.children.indexOf(c), 1));
28
- }
29
15
  get factory() {
30
16
  if (!this._factory) {
31
17
  throw new Error('Rapier3d world not initialized');
@@ -61,6 +47,20 @@ export class Rapier3dWorldComponent {
61
47
  }
62
48
  return this._eventQueue;
63
49
  }
50
+ constructor() {
51
+ this._factory = null;
52
+ this._loader = null;
53
+ this.added$ = new Subject();
54
+ this.removed$ = new Subject();
55
+ this.children = [];
56
+ this._gravity = { x: 0, y: 0, z: -9.82 };
57
+ this._nativeWorld = null;
58
+ this._eventQueue = null;
59
+ this.handleIdEntityMap = new Map();
60
+ this.lockedCollisionGroups = [];
61
+ this.added$.subscribe(c => this.children.push(c));
62
+ this.removed$.subscribe(c => this.children.splice(this.children.indexOf(c), 1));
63
+ }
64
64
  init() {
65
65
  return __awaiter(this, void 0, void 0, function* () {
66
66
  yield init();
package/dist/index.d.ts CHANGED
File without changes
package/dist/index.js CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
package/dist/types.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Rapier3dFactory } from './rapier-3d-factory';
2
2
  import { Rapier3dLoader } from './rapier-3d-loader';
3
3
  import { Rapier3dRigidBodyComponent } from './components/rapier-3d-rigid-body.component';
4
4
  import { Rapier3dTriggerComponent } from './components/rapier-3d-trigger.component';
5
- export declare type Rapier3dPhysicsTypeDocRepo = {
5
+ export type Rapier3dPhysicsTypeDocRepo = {
6
6
  factory: Rapier3dFactory;
7
7
  loader: Rapier3dLoader;
8
8
  rigidBody: Rapier3dRigidBodyComponent;
package/dist/types.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gg-web-engine/rapier3d",
3
- "version": "0.0.40",
3
+ "version": "0.0.48",
4
4
  "description": "An attempt to create open source game engine for browser",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,19 +27,19 @@
27
27
  },
28
28
  "homepage": "https://github.com/AndyGura/gg-web-engine#readme",
29
29
  "devDependencies": {
30
- "@dimforge/rapier3d-compat": "0.0.0-a86610f-20240508",
31
- "@gg-web-engine/core": "0.0.40",
32
- "@types/jest": "^29.5.0",
33
- "jest": "^29.5.0",
34
- "jest-environment-jsdom": "^29.5.0",
35
- "prettier": "^2.8.6",
30
+ "@dimforge/rapier3d-compat": "0.0.0-50223ff-20240729",
31
+ "@gg-web-engine/core": "0.0.48",
32
+ "@types/jest": "^29.5.12",
33
+ "jest": "^29.7.0",
34
+ "jest-environment-jsdom": "^29.7.0",
35
+ "prettier": "^3.3.3",
36
36
  "rxjs": "7.8.1",
37
- "ts-jest": "^29.0.5",
38
- "typescript": "~4.7.2"
37
+ "ts-jest": "^29.2.4",
38
+ "typescript": "~5.5.4"
39
39
  },
40
40
  "peerDependencies": {
41
- "@dimforge/rapier3d-compat": "0.0.0-a86610f-20240508",
42
- "@gg-web-engine/core": "0.0.40",
41
+ "@dimforge/rapier3d-compat": "0.0.0-50223ff-20240729",
42
+ "@gg-web-engine/core": "0.0.48",
43
43
  "rxjs": "7.8.1"
44
44
  },
45
45
  "jest": {
package/tsconfig.json CHANGED
File without changes