@gg-web-engine/matter 0.0.56 → 0.0.57

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.
@@ -15,12 +15,12 @@ export declare class MatterRigidBodyComponent implements IRigidBody2dComponent<M
15
15
  set angularVelocity(value: number);
16
16
  name: string;
17
17
  entity: Entity2d | null;
18
- get debugBodySettings(): DebugBody2DSettings;
18
+ readonly debugBodySettings: DebugBody2DSettings;
19
19
  constructor(nativeBody: Body, shape: Shape2DDescriptor);
20
- get interactWithCollisionGroups(): CollisionGroup[];
21
- set interactWithCollisionGroups(value: CollisionGroup[] | 'all');
22
- get ownCollisionGroups(): CollisionGroup[];
23
- set ownCollisionGroups(value: CollisionGroup[] | 'all');
20
+ get interactWithCollisionGroups(): ReadonlyArray<CollisionGroup>;
21
+ set interactWithCollisionGroups(value: ReadonlyArray<CollisionGroup> | 'all');
22
+ get ownCollisionGroups(): ReadonlyArray<CollisionGroup>;
23
+ set ownCollisionGroups(value: ReadonlyArray<CollisionGroup> | 'all');
24
24
  clone(): MatterRigidBodyComponent;
25
25
  addToWorld(world: Gg2dWorld<VisualTypeDocRepo2D, MatterPhysicsTypeDocRepo, IVisualScene2dComponent, MatterWorldComponent>): void;
26
26
  removeFromWorld(world: Gg2dWorld<VisualTypeDocRepo2D, MatterPhysicsTypeDocRepo, IVisualScene2dComponent, MatterWorldComponent>): void;
@@ -1,4 +1,4 @@
1
- import { Pnt2, } from '@gg-web-engine/core';
1
+ import { DebugBody2DSettings, Pnt2, } from '@gg-web-engine/core';
2
2
  import { Body, Composite, Vector } from 'matter-js';
3
3
  export class MatterRigidBodyComponent {
4
4
  get position() {
@@ -25,19 +25,14 @@ export class MatterRigidBodyComponent {
25
25
  set angularVelocity(value) {
26
26
  Body.setAngularVelocity(this.nativeBody, value);
27
27
  }
28
- get debugBodySettings() {
29
- if (isFinite(this.nativeBody.mass)) {
30
- return { shape: this.shape, type: 'RIGID_DYNAMIC', sleeping: this.nativeBody.isSleeping };
31
- }
32
- else {
33
- return { shape: this.shape, type: 'RIGID_STATIC' };
34
- }
35
- }
36
28
  constructor(nativeBody, shape) {
37
29
  this.nativeBody = nativeBody;
38
30
  this.shape = shape;
39
31
  this.name = '';
40
32
  this.entity = null;
33
+ this.debugBodySettings = new DebugBody2DSettings(isFinite(this.nativeBody.mass)
34
+ ? { type: 'RIGID_DYNAMIC', sleeping: () => this.nativeBody.isSleeping }
35
+ : { type: 'RIGID_STATIC' }, this.shape);
41
36
  }
42
37
  get interactWithCollisionGroups() {
43
38
  throw new Error('Collision groups not implemented for Matter.js');
@@ -14,6 +14,7 @@ export declare class MatterWorldComponent implements IPhysicsWorld2dComponent<Ma
14
14
  private _gravity;
15
15
  get gravity(): Point2;
16
16
  set gravity(value: Point2);
17
+ readonly mainCollisionGroup: CollisionGroup;
17
18
  constructor();
18
19
  init(): Promise<void>;
19
20
  registerCollisionGroup(): CollisionGroup;
@@ -32,6 +32,7 @@ export class MatterWorldComponent {
32
32
  this.removed$ = new Subject();
33
33
  this.children = [];
34
34
  this._gravity = { x: 0, y: 9.82 };
35
+ this.mainCollisionGroup = 0;
35
36
  this.added$.subscribe(c => this.children.push(c));
36
37
  this.removed$.subscribe(c => this.children.splice(this.children.indexOf(c), 1));
37
38
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gg-web-engine/matter",
3
- "version": "0.0.56",
3
+ "version": "0.0.57",
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",
@@ -30,14 +30,14 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@types/matter-js": "0.19.7",
33
- "@gg-web-engine/core": "0.0.56",
33
+ "@gg-web-engine/core": "0.0.57",
34
34
  "matter-js": "0.20.0",
35
35
  "prettier": "^3.3.3",
36
36
  "rxjs": "7.8.1",
37
37
  "typescript": "~5.5.4"
38
38
  },
39
39
  "peerDependencies": {
40
- "@gg-web-engine/core": "0.0.56",
40
+ "@gg-web-engine/core": "0.0.57",
41
41
  "matter-js": "0.20.0",
42
42
  "rxjs": "7.8.1"
43
43
  }