@caperjs/plugin-crunch 0.1.0
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/LICENSE +22 -0
- package/README.md +205 -0
- package/lib/Actor.d.ts +227 -0
- package/lib/Actor.d.ts.map +1 -0
- package/lib/CrunchPhysicsPlugin.d.ts +508 -0
- package/lib/CrunchPhysicsPlugin.d.ts.map +1 -0
- package/lib/Entity.d.ts +377 -0
- package/lib/Entity.d.ts.map +1 -0
- package/lib/Group.d.ts +122 -0
- package/lib/Group.d.ts.map +1 -0
- package/lib/Sensor.d.ts +161 -0
- package/lib/Sensor.d.ts.map +1 -0
- package/lib/Solid.d.ts +109 -0
- package/lib/Solid.d.ts.map +1 -0
- package/lib/System.d.ts +265 -0
- package/lib/System.d.ts.map +1 -0
- package/lib/caper-plugin-crunch.mjs +1331 -0
- package/lib/caper-plugin-crunch.mjs.map +1 -0
- package/lib/index.d.ts +13 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/interfaces.d.ts +32 -0
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/types.d.ts +246 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils.d.ts +63 -0
- package/lib/utils.d.ts.map +1 -0
- package/lib/version.d.ts +2 -0
- package/lib/version.d.ts.map +1 -0
- package/package.json +42 -0
- package/src/Actor.ts +726 -0
- package/src/CrunchPhysicsPlugin.ts +718 -0
- package/src/Entity.ts +762 -0
- package/src/Group.ts +181 -0
- package/src/Sensor.ts +427 -0
- package/src/Solid.ts +380 -0
- package/src/System.ts +1546 -0
- package/src/collision-layers.d.ts +87 -0
- package/src/index.ts +18 -0
- package/src/interfaces.ts +33 -0
- package/src/types.ts +336 -0
- package/src/utils.ts +72 -0
- package/src/version.ts +1 -0
package/lib/Solid.d.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { Actor } from './Actor';
|
|
2
|
+
import { Entity } from './Entity';
|
|
3
|
+
import { Sensor } from './Sensor';
|
|
4
|
+
import { EntityData, PhysicsEntityConfig, PhysicsEntityType } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Static or moving solid object that other entities can collide with.
|
|
7
|
+
* Solids are typically used for platforms, walls, and other obstacles.
|
|
8
|
+
*
|
|
9
|
+
* Features:
|
|
10
|
+
* - Static collision boundaries
|
|
11
|
+
* - Support for moving platforms
|
|
12
|
+
* - Carries actors and sensors that are riding it
|
|
13
|
+
* - Pushes overlapping entities out of the way
|
|
14
|
+
*
|
|
15
|
+
* @typeParam T - Application type, defaults to base Application
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // Create a static platform
|
|
20
|
+
* const platform = physics.createSolid({
|
|
21
|
+
* type: 'Platform',
|
|
22
|
+
* position: [0, 500],
|
|
23
|
+
* size: [800, 32],
|
|
24
|
+
* view: platformSprite
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Create a moving platform
|
|
28
|
+
* const movingPlatform = physics.createSolid({
|
|
29
|
+
* type: 'Platform',
|
|
30
|
+
* position: [100, 300],
|
|
31
|
+
* size: [200, 32],
|
|
32
|
+
* view: platformSprite
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* // Move the platform back and forth
|
|
36
|
+
* gsap.to(movingPlatform, {
|
|
37
|
+
* x: 500,
|
|
38
|
+
* duration: 2,
|
|
39
|
+
* yoyo: true,
|
|
40
|
+
* repeat: -1
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare class Solid<D extends EntityData = EntityData> extends Entity<D> {
|
|
45
|
+
readonly entityType: PhysicsEntityType;
|
|
46
|
+
/** Whether this solid should be removed when culled (typically false) */
|
|
47
|
+
shouldRemoveOnCull: boolean;
|
|
48
|
+
/** Whether this solid can be collided with */
|
|
49
|
+
private _canCollide;
|
|
50
|
+
get canCollide(): boolean;
|
|
51
|
+
/** Whether this solid has collisions enabled */
|
|
52
|
+
collideable: boolean;
|
|
53
|
+
/** Whether this solid is currently moving */
|
|
54
|
+
moving: boolean;
|
|
55
|
+
private _nextX;
|
|
56
|
+
private _nextY;
|
|
57
|
+
setPosition(x: number, y: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the solid's X position.
|
|
60
|
+
* For moving solids, this queues the movement to be applied on next update.
|
|
61
|
+
*/
|
|
62
|
+
set x(value: number);
|
|
63
|
+
get x(): number;
|
|
64
|
+
/**
|
|
65
|
+
* Sets the solid's Y position.
|
|
66
|
+
* For moving solids, this queues the movement to be applied on next update.
|
|
67
|
+
*/
|
|
68
|
+
set y(value: number);
|
|
69
|
+
get y(): number;
|
|
70
|
+
/**
|
|
71
|
+
* Initializes or reinitializes the solid with new configuration.
|
|
72
|
+
*
|
|
73
|
+
* @param config - Configuration for the solid
|
|
74
|
+
*/
|
|
75
|
+
init(config: PhysicsEntityConfig<D>): void;
|
|
76
|
+
/** Right edge X coordinate */
|
|
77
|
+
get right(): number;
|
|
78
|
+
/** Left edge X coordinate */
|
|
79
|
+
get left(): number;
|
|
80
|
+
/** Top edge Y coordinate */
|
|
81
|
+
get top(): number;
|
|
82
|
+
/** Bottom edge Y coordinate */
|
|
83
|
+
get bottom(): number;
|
|
84
|
+
/**
|
|
85
|
+
* Checks if this solid can collide with the given entity type.
|
|
86
|
+
* This method is kept for backward compatibility.
|
|
87
|
+
*
|
|
88
|
+
* @returns Always returns true as we're now using only collision layers/masks
|
|
89
|
+
*/
|
|
90
|
+
canCollideWith(): boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Moves the solid by the specified amount, carrying any riding entities.
|
|
93
|
+
* Also pushes any overlapping entities out of the way.
|
|
94
|
+
*
|
|
95
|
+
* @param x - X distance to move
|
|
96
|
+
* @param y - Y distance to move
|
|
97
|
+
* @param actors - Set of actors to check for riding/pushing
|
|
98
|
+
* @param sensors - Set of sensors to check for riding/pushing
|
|
99
|
+
*/
|
|
100
|
+
move(x: number, y: number, actors?: Set<Actor>, sensors?: Set<Sensor>, force?: boolean): void;
|
|
101
|
+
/**
|
|
102
|
+
* Checks if this solid overlaps with the given entity.
|
|
103
|
+
*
|
|
104
|
+
* @param entity - Entity to check for overlap
|
|
105
|
+
* @returns True if overlapping
|
|
106
|
+
*/
|
|
107
|
+
private overlaps;
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=Solid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Solid.d.ts","sourceRoot":"","sources":["../src/Solid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE7E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,qBAAa,KAAK,CAAC,CAAC,SAAS,UAAU,GAAG,UAAU,CAAE,SAAQ,MAAM,CAAC,CAAC,CAAC;IACrE,SAAgB,UAAU,EAAE,iBAAiB,CAAW;IACxD,yEAAyE;IAClE,kBAAkB,UAAS;IAElC,8CAA8C;IAC9C,OAAO,CAAC,WAAW,CAAiB;IAEpC,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,gDAAgD;IACzC,WAAW,EAAE,OAAO,CAAQ;IAEnC,6CAA6C;IACtC,MAAM,EAAE,OAAO,CAAS;IAE/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,MAAM,CAAS;IAEhB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI;IAK9C;;;OAGG;IACH,IAAW,CAAC,CAAC,KAAK,EAAE,MAAM,EAGzB;IAED,IAAW,CAAC,IAAI,MAAM,CAErB;IAED;;;OAGG;IACH,IAAW,CAAC,CAAC,KAAK,EAAE,MAAM,EAGzB;IAED,IAAW,CAAC,IAAI,MAAM,CAErB;IAED;;;;OAIG;IACI,IAAI,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,IAAI;IAQjD,8BAA8B;IAC9B,IAAW,KAAK,IAAI,MAAM,CAEzB;IAED,6BAA6B;IAC7B,IAAW,IAAI,IAAI,MAAM,CAExB;IAED,4BAA4B;IAC5B,IAAW,GAAG,IAAI,MAAM,CAEvB;IAED,+BAA+B;IAC/B,IAAW,MAAM,IAAI,MAAM,CAE1B;IAED;;;;;OAKG;IACH,cAAc,IAAI,OAAO;IAUzB;;;;;;;;OAQG;IACI,IAAI,CACT,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,MAAM,GAAE,GAAG,CAAC,KAAK,CAAsB,EACvC,OAAO,GAAE,GAAG,CAAC,MAAM,CAAuB,EAC1C,KAAK,GAAE,OAAe,GACrB,IAAI;IA2MP;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;CAUjB"}
|
package/lib/System.d.ts
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import { Container } from 'pixi.js';
|
|
2
|
+
import { Actor } from './Actor';
|
|
3
|
+
import { default as CrunchPhysicsPlugin } from './CrunchPhysicsPlugin';
|
|
4
|
+
import { Entity } from './Entity';
|
|
5
|
+
import { Group } from './Group';
|
|
6
|
+
import { AABBLike } from './interfaces';
|
|
7
|
+
import { Sensor } from './Sensor';
|
|
8
|
+
import { Solid } from './Solid';
|
|
9
|
+
import { ActorCollision, Collision, PhysicsEntityConfig, PhysicsEntityView, Rectangle, SensorOverlap } from './types';
|
|
10
|
+
/**
|
|
11
|
+
* Configuration options for the Crunch physics system.
|
|
12
|
+
* These options control the core behavior of the physics simulation.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* const options: PhysicsSystemOptions = {
|
|
17
|
+
* gridSize: 32,
|
|
18
|
+
* gravity: 980,
|
|
19
|
+
* maxVelocity: 1000,
|
|
20
|
+
* debug: true,
|
|
21
|
+
* boundary: { x: 0, y: 0, width: 800, height: 600 },
|
|
22
|
+
* culling: true,
|
|
23
|
+
* collisionResolver: (collisions) => {
|
|
24
|
+
* for (const collision of collisions) {
|
|
25
|
+
* handleCollision(collision);
|
|
26
|
+
* }
|
|
27
|
+
* }
|
|
28
|
+
* };
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
export interface PhysicsSystemOptions {
|
|
32
|
+
/** Reference to the parent Crunch physics plugin */
|
|
33
|
+
plugin: CrunchPhysicsPlugin;
|
|
34
|
+
/** Size of each grid cell for spatial partitioning (in pixels) */
|
|
35
|
+
gridSize: number;
|
|
36
|
+
/** Gravity strength in pixels per second squared */
|
|
37
|
+
gravity: number;
|
|
38
|
+
/** Maximum velocity for any entity in pixels per second */
|
|
39
|
+
maxVelocity: number;
|
|
40
|
+
/** Whether to render debug visualizations */
|
|
41
|
+
debug?: boolean;
|
|
42
|
+
/** World boundary for culling entities */
|
|
43
|
+
boundary?: Rectangle;
|
|
44
|
+
/** Whether to automatically cull out-of-bounds entities */
|
|
45
|
+
culling?: boolean;
|
|
46
|
+
/** Custom handler for resolving collisions */
|
|
47
|
+
collisionResolver?: (collisions: Collision[]) => void;
|
|
48
|
+
/** Custom handler for resolving sensor overlaps */
|
|
49
|
+
overlapResolver?: (overlaps: SensorOverlap[]) => void;
|
|
50
|
+
/** Custom handler for resolving actor-to-actor collisions */
|
|
51
|
+
actorCollisionResolver?: (collisions: ActorCollision[]) => void;
|
|
52
|
+
/** Whether to enable actor-to-actor collisions */
|
|
53
|
+
enableActorCollisions?: boolean;
|
|
54
|
+
/** Default collision layer for new entities */
|
|
55
|
+
defaultCollisionLayer?: number;
|
|
56
|
+
/** Default collision mask for new entities */
|
|
57
|
+
defaultCollisionMask?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Core physics system that manages all physics entities and their interactions.
|
|
61
|
+
* Handles spatial partitioning, collision detection, and entity lifecycle.
|
|
62
|
+
*
|
|
63
|
+
* Features:
|
|
64
|
+
* - Grid-based spatial partitioning for efficient collision checks
|
|
65
|
+
* - Entity management (actors, solids, sensors, groups)
|
|
66
|
+
* - Collision and overlap detection
|
|
67
|
+
* - Debug visualization
|
|
68
|
+
* - Culling system for out-of-bounds entities
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* // Create the physics system
|
|
73
|
+
* const system = new System({
|
|
74
|
+
* gridSize: 32,
|
|
75
|
+
* gravity: 980,
|
|
76
|
+
* maxVelocity: 1000
|
|
77
|
+
* });
|
|
78
|
+
*
|
|
79
|
+
* // Add entities
|
|
80
|
+
* const player = system.createActor({
|
|
81
|
+
* type: 'Player',
|
|
82
|
+
* position: [100, 100]
|
|
83
|
+
* });
|
|
84
|
+
*
|
|
85
|
+
* const platform = system.createSolid({
|
|
86
|
+
* type: 'Platform',
|
|
87
|
+
* position: [0, 500],
|
|
88
|
+
* size: [800, 32]
|
|
89
|
+
* });
|
|
90
|
+
*
|
|
91
|
+
* // Update physics (in game loop)
|
|
92
|
+
* system.update(deltaTime);
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export declare class System {
|
|
96
|
+
private readonly options;
|
|
97
|
+
entities: Set<Entity>;
|
|
98
|
+
private _flaggedEntities;
|
|
99
|
+
actors: Set<Actor>;
|
|
100
|
+
solids: Set<Solid>;
|
|
101
|
+
sensors: Set<Sensor>;
|
|
102
|
+
groups: Set<Group>;
|
|
103
|
+
private actorsByType;
|
|
104
|
+
private solidsByType;
|
|
105
|
+
private sensorsByType;
|
|
106
|
+
private groupsByType;
|
|
107
|
+
private followers;
|
|
108
|
+
private groupWithEntities;
|
|
109
|
+
private grid;
|
|
110
|
+
private collisions;
|
|
111
|
+
private sensorOverlaps;
|
|
112
|
+
private actorCollisions;
|
|
113
|
+
private _checkedPairs;
|
|
114
|
+
private _collisionResultPool;
|
|
115
|
+
private _collisionResultPoolIndex;
|
|
116
|
+
private _actorCollisionPool;
|
|
117
|
+
private _actorCollisionPoolIndex;
|
|
118
|
+
private _debugContainer;
|
|
119
|
+
private _debugGfx;
|
|
120
|
+
private _debug;
|
|
121
|
+
private _movedActors;
|
|
122
|
+
private _activeGridCells;
|
|
123
|
+
private _potentialCollisions;
|
|
124
|
+
set debug(value: boolean);
|
|
125
|
+
set gridSize(value: number);
|
|
126
|
+
set gravity(value: number);
|
|
127
|
+
get gravity(): number;
|
|
128
|
+
set maxVelocity(value: number);
|
|
129
|
+
get maxVelocity(): number;
|
|
130
|
+
set boundary(value: Rectangle);
|
|
131
|
+
get boundary(): Rectangle;
|
|
132
|
+
get container(): Container;
|
|
133
|
+
addView(view: PhysicsEntityView): void;
|
|
134
|
+
constructor(options: PhysicsSystemOptions);
|
|
135
|
+
private _resetPositionFlags;
|
|
136
|
+
update(dt: number): void;
|
|
137
|
+
private updateSolids;
|
|
138
|
+
private updateActors;
|
|
139
|
+
private updateEntityPositions;
|
|
140
|
+
private processCollisionsAndOverlaps;
|
|
141
|
+
private cullOutOfBounds;
|
|
142
|
+
private updateSensor;
|
|
143
|
+
createEntity(config: PhysicsEntityConfig): Actor | Solid | Sensor | Group;
|
|
144
|
+
addEntity(entity: Entity | Actor | Solid | Sensor | Group): Actor | Solid | Sensor | Group;
|
|
145
|
+
removeEntity(entity: Entity | Actor | Solid | Sensor | Group): void;
|
|
146
|
+
createActor(config: PhysicsEntityConfig): Actor;
|
|
147
|
+
addActor(actor: Actor): Actor;
|
|
148
|
+
createSensor(config: PhysicsEntityConfig): Sensor;
|
|
149
|
+
addSensor(sensor: Sensor): Sensor;
|
|
150
|
+
createSolid(config: PhysicsEntityConfig): Solid;
|
|
151
|
+
addSolid(solid: Solid): Solid;
|
|
152
|
+
removeActor(actor: Actor, destroyView?: boolean): void;
|
|
153
|
+
removeSolid(solid: Solid, destroyView?: boolean): void;
|
|
154
|
+
removeSensor(sensor: Sensor, destroyView?: boolean): void;
|
|
155
|
+
moveSolid(solid: Solid, x: number, y: number): void;
|
|
156
|
+
getSolidsAt(x: number, y: number, entity: Actor | Sensor): Solid[];
|
|
157
|
+
addFollower(entity: Entity, follower: Entity): void;
|
|
158
|
+
removeFollower(entity: Entity): void;
|
|
159
|
+
getFollowersOf(entity: Entity): Entity[];
|
|
160
|
+
removeFollowersOf(entity: Entity): void;
|
|
161
|
+
addToGroup(group: Group, entity: Entity): Entity;
|
|
162
|
+
removeFromGroup(entity: Entity): Entity;
|
|
163
|
+
getEntitiesInGroup(group: Group): Entity[];
|
|
164
|
+
removeEntitiesOfGroup(group: Group): Entity[];
|
|
165
|
+
private overlaps;
|
|
166
|
+
private getCells;
|
|
167
|
+
private addSolidToGrid;
|
|
168
|
+
private removeSolidFromGrid;
|
|
169
|
+
debugRender(): void;
|
|
170
|
+
/**
|
|
171
|
+
* Get all entities of a specific type
|
|
172
|
+
* @param type The type to look for
|
|
173
|
+
* @returns Array of entities matching the type
|
|
174
|
+
*/
|
|
175
|
+
getByType(type: string): (Actor | Solid)[];
|
|
176
|
+
/**
|
|
177
|
+
* Get all actors of a specific type
|
|
178
|
+
* @param type The type to look for
|
|
179
|
+
* @returns Array of actors matching the type
|
|
180
|
+
*/
|
|
181
|
+
getActorsByType(type: string | string[]): Actor[];
|
|
182
|
+
/**
|
|
183
|
+
* Get all solids of a specific type
|
|
184
|
+
* @param type The type to look for
|
|
185
|
+
* @returns Array of solids matching the type
|
|
186
|
+
*/
|
|
187
|
+
getSolidsByType(type: string | string[]): Solid[];
|
|
188
|
+
/**
|
|
189
|
+
* Get all sensors of a specific type
|
|
190
|
+
* @param type The type to look for
|
|
191
|
+
* @returns Array of sensors matching the type
|
|
192
|
+
*/
|
|
193
|
+
getSensorsByType(type: string | string[]): Sensor[];
|
|
194
|
+
clearGrid(): void;
|
|
195
|
+
clearAll(destroy?: boolean): void;
|
|
196
|
+
destroy(): void;
|
|
197
|
+
/**
|
|
198
|
+
* Gets a collision result object from the pool or creates a new one if needed
|
|
199
|
+
*/
|
|
200
|
+
private getCollisionResult;
|
|
201
|
+
/**
|
|
202
|
+
* Gets an actor collision object from the pool or creates a new one if needed
|
|
203
|
+
*/
|
|
204
|
+
private getActorCollision;
|
|
205
|
+
/**
|
|
206
|
+
* Resets the collision result pools for the next frame
|
|
207
|
+
*/
|
|
208
|
+
private resetCollisionPools;
|
|
209
|
+
/**
|
|
210
|
+
* Updates an actor's position in the grid.
|
|
211
|
+
* This is called when an actor moves or when its size changes.
|
|
212
|
+
*
|
|
213
|
+
* @param actor - The actor to update in the grid
|
|
214
|
+
*/
|
|
215
|
+
updateActorInGrid(actor: Actor): void;
|
|
216
|
+
/**
|
|
217
|
+
* Removes an actor from its current grid cells.
|
|
218
|
+
*
|
|
219
|
+
* @param actor - The actor to remove from the grid
|
|
220
|
+
*/
|
|
221
|
+
removeActorFromGrid(actor: Actor): void;
|
|
222
|
+
/**
|
|
223
|
+
* Checks for collisions between all active actors.
|
|
224
|
+
* This is an O(n²) operation, so it can be expensive with many actors.
|
|
225
|
+
*/
|
|
226
|
+
private checkActorCollisions;
|
|
227
|
+
setCollisionResolver(resolver: (collisions: Collision[]) => void): void;
|
|
228
|
+
/**
|
|
229
|
+
* Sets a custom resolver for actor-to-actor collisions.
|
|
230
|
+
*
|
|
231
|
+
* @param resolver - Function to handle actor-to-actor collisions
|
|
232
|
+
*/
|
|
233
|
+
setActorCollisionResolver(resolver: (collisions: ActorCollision[]) => void): void;
|
|
234
|
+
/**
|
|
235
|
+
* Returns whether actor-to-actor collision detection is enabled.
|
|
236
|
+
*
|
|
237
|
+
* @returns True if actor collisions are enabled
|
|
238
|
+
*/
|
|
239
|
+
get enableActorCollisions(): boolean;
|
|
240
|
+
/**
|
|
241
|
+
* Enables or disables actor-to-actor collision detection.
|
|
242
|
+
* When enabled, it initializes the grid for all existing actors.
|
|
243
|
+
*
|
|
244
|
+
* @param enabled - Whether to enable actor-to-actor collisions
|
|
245
|
+
*/
|
|
246
|
+
setActorCollisionsEnabled(enabled: boolean): void;
|
|
247
|
+
createGroup(config: PhysicsEntityConfig): Group;
|
|
248
|
+
addGroup(group: Group): Group;
|
|
249
|
+
removeGroup(group: Group, destroyView?: boolean): void;
|
|
250
|
+
/**
|
|
251
|
+
* Get all groups of a specific type
|
|
252
|
+
* @param type The type to look for
|
|
253
|
+
* @returns Array of groups matching the type
|
|
254
|
+
*/
|
|
255
|
+
getGroupsByType(type: string | string[]): Group[];
|
|
256
|
+
/**
|
|
257
|
+
* Checks if two AABB rectangles overlap.
|
|
258
|
+
*
|
|
259
|
+
* @param a - The first AABB rectangle
|
|
260
|
+
* @param b - The second AABB rectangle
|
|
261
|
+
* @returns True if the rectangles overlap, false otherwise
|
|
262
|
+
*/
|
|
263
|
+
aabbOverlap(a: AABBLike, b: AABBLike): boolean;
|
|
264
|
+
}
|
|
265
|
+
//# sourceMappingURL=System.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"System.d.ts","sourceRoot":"","sources":["../src/System.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAY,MAAM,SAAS,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,mBAAmB,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EACL,cAAc,EAEd,SAAS,EACT,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,aAAa,EACd,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,oBAAoB;IACnC,oDAAoD;IACpD,MAAM,EAA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