@gg-web-engine/rapier2d 0.0.39 → 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
@@ -1,18 +1,6 @@
1
1
  import { BitMask, Pnt2, } from '@gg-web-engine/core';
2
2
  import { Vector2, } from '@dimforge/rapier2d-compat';
3
3
  export class Rapier2dRigidBodyComponent {
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
- }
16
4
  get position() {
17
5
  return Pnt2.clone(this.nativeBody ? this.nativeBody.translation() : this._bodyDescr.translation);
18
6
  }
@@ -74,6 +62,18 @@ export class Rapier2dRigidBodyComponent {
74
62
  return { shape: this.shape, type: 'RIGID_STATIC' };
75
63
  }
76
64
  }
65
+ constructor(world, _colliderDescr, shape, _bodyDescr, _colliderOptions) {
66
+ this.world = world;
67
+ this._colliderDescr = _colliderDescr;
68
+ this.shape = shape;
69
+ this._bodyDescr = _bodyDescr;
70
+ this._colliderOptions = _colliderOptions;
71
+ this.entity = null;
72
+ this._nativeBody = null;
73
+ this._nativeBodyColliders = null;
74
+ this.name = '';
75
+ this.collisionGroups = BitMask.full(32);
76
+ }
77
77
  get interactWithCollisionGroups() {
78
78
  return BitMask.unpack(this.collisionGroups, 16);
79
79
  }
File without changes
@@ -1,15 +1,6 @@
1
1
  import { Subject } from 'rxjs';
2
2
  import { Rapier2dRigidBodyComponent } from './rapier-2d-rigid-body.component';
3
3
  export class Rapier2dTriggerComponent extends Rapier2dRigidBodyComponent {
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 Rapier2dTriggerComponent extends Rapier2dRigidBodyComponent {
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('Rapier2D bodies cannot be shared between different worlds');
File without changes
@@ -12,20 +12,6 @@ import { EventQueue, init, Vector2, World } from '@dimforge/rapier2d-compat';
12
12
  import { Rapier2dFactory } from '../rapier-2d-factory';
13
13
  import { Subject } from 'rxjs';
14
14
  export class Rapier2dWorldComponent {
15
- constructor() {
16
- this._factory = null;
17
- this.added$ = new Subject();
18
- this.removed$ = new Subject();
19
- this.children = [];
20
- this.unitScale = 100; // TODO abstractize somehow, hardcoded now
21
- this._gravity = Pnt2.scalarMult({ x: 0, y: 9.82 }, this.unitScale);
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('Rapier2d world not initialized');
@@ -54,6 +40,20 @@ export class Rapier2dWorldComponent {
54
40
  }
55
41
  return this._eventQueue;
56
42
  }
43
+ constructor() {
44
+ this._factory = null;
45
+ this.added$ = new Subject();
46
+ this.removed$ = new Subject();
47
+ this.children = [];
48
+ this.unitScale = 100; // TODO abstractize somehow, hardcoded now
49
+ this._gravity = Pnt2.scalarMult({ x: 0, y: 9.82 }, this.unitScale);
50
+ this._nativeWorld = null;
51
+ this._eventQueue = null;
52
+ this.handleIdEntityMap = new Map();
53
+ this.lockedCollisionGroups = [];
54
+ this.added$.subscribe(c => this.children.push(c));
55
+ this.removed$.subscribe(c => this.children.splice(this.children.indexOf(c), 1));
56
+ }
57
57
  init() {
58
58
  return __awaiter(this, void 0, void 0, function* () {
59
59
  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
package/dist/types.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { Rapier2dFactory } from './rapier-2d-factory';
2
2
  import { Rapier2dRigidBodyComponent } from './components/rapier-2d-rigid-body.component';
3
3
  import { Rapier2dTriggerComponent } from './components/rapier-2d-trigger.component';
4
- export declare type Rapier2dPhysicsTypeDocRepo = {
4
+ export type Rapier2dPhysicsTypeDocRepo = {
5
5
  factory: Rapier2dFactory;
6
6
  rigidBody: Rapier2dRigidBodyComponent;
7
7
  trigger: Rapier2dTriggerComponent;
package/dist/types.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gg-web-engine/rapier2d",
3
- "version": "0.0.39",
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/rapier2d-compat": "0.0.0-98015b1-20240128",
31
- "@gg-web-engine/core": "0.0.39",
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/rapier2d-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/rapier2d-compat": "0.0.0-98015b1-20240128",
42
- "@gg-web-engine/core": "0.0.39",
41
+ "@dimforge/rapier2d-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