@gg-web-engine/core 0.0.57 → 0.0.59
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/2d/components/physics/i-physics-world-2d.component.d.ts +1 -1
- package/dist/2d/components/physics/i-rigid-body-2d.component.d.ts +1 -1
- package/dist/2d/components/physics/i-trigger-2d.component.d.ts +3 -3
- package/dist/2d/components/rendering/i-camera-2d.component.d.ts +5 -0
- package/dist/2d/components/rendering/i-display-object-2d.component.d.ts +1 -1
- package/dist/2d/components/rendering/i-renderer-2d.component.d.ts +1 -1
- package/dist/2d/components/rendering/i-visual-scene-2d.component.d.ts +2 -3
- package/dist/2d/entities/controllers/entity-2d-positioning.animator.d.ts +2 -2
- package/dist/2d/entities/entity-2d.d.ts +7 -7
- package/dist/2d/entities/i-renderable-2d.entity.d.ts +4 -4
- package/dist/2d/entities/renderer-2d.entity.d.ts +2 -1
- package/dist/2d/entities/trigger-2d.entity.d.ts +8 -4
- package/dist/2d/factories.d.ts +7 -7
- package/dist/2d/gg-2d-world.d.ts +38 -6
- package/dist/2d/gg-2d-world.js +27 -21
- package/dist/2d/index.d.ts +3 -0
- package/dist/2d/index.js +3 -0
- package/dist/2d/level-loader.d.ts +101 -0
- package/dist/2d/level-loader.js +88 -0
- package/dist/2d/loader.d.ts +11 -0
- package/dist/2d/loader.js +10 -0
- package/dist/3d/components/physics/i-physics-world-3d.component.d.ts +5 -5
- package/dist/3d/components/physics/i-raycast-vehicle.component.d.ts +1 -1
- package/dist/3d/components/physics/i-rigid-body-3d.component.d.ts +1 -1
- package/dist/3d/components/physics/i-trigger-3d.component.d.ts +3 -3
- package/dist/3d/components/rendering/{i-camera.component.d.ts → i-camera-3d.component.d.ts} +1 -1
- package/dist/3d/components/rendering/i-camera-3d.component.js +1 -0
- package/dist/3d/components/rendering/i-display-object-3d.component.d.ts +1 -1
- package/dist/3d/components/rendering/i-renderer-3d.component.d.ts +1 -2
- package/dist/3d/components/rendering/i-visual-scene-3d.component.d.ts +3 -4
- package/dist/3d/entities/camera-3d.entity.d.ts +24 -0
- package/dist/3d/entities/camera-3d.entity.js +35 -0
- package/dist/3d/entities/controllers/animators/camera-3d.animator.d.ts +3 -3
- package/dist/3d/entities/controllers/animators/entity-3d-positioning.animator.d.ts +2 -2
- package/dist/3d/entities/entity-3d.d.ts +6 -6
- package/dist/3d/entities/gg-car/gg-car.entity.d.ts +5 -5
- package/dist/3d/entities/i-renderable-3d.entity.d.ts +4 -4
- package/dist/3d/entities/map-graph-3d.entity.d.ts +6 -6
- package/dist/3d/entities/raycast-vehicle-3d.entity.d.ts +3 -3
- package/dist/3d/entities/renderer-3d.entity.d.ts +1 -6
- package/dist/3d/entities/renderer-3d.entity.js +0 -15
- package/dist/3d/entities/surface-following.entity.d.ts +3 -3
- package/dist/3d/entities/surface-following.entity.js +3 -0
- package/dist/3d/entities/trigger-3d.entity.d.ts +8 -4
- package/dist/3d/factories.d.ts +14 -14
- package/dist/3d/gg-3d-world.d.ts +37 -9
- package/dist/3d/gg-3d-world.js +23 -19
- package/dist/3d/index.d.ts +3 -1
- package/dist/3d/index.js +3 -1
- package/dist/3d/level-loader.d.ts +300 -0
- package/dist/3d/level-loader.js +267 -0
- package/dist/3d/loader.d.ts +55 -14
- package/dist/3d/loader.js +37 -8
- package/dist/3d/loaders.d.ts +4 -4
- package/dist/base/blueprint/blueprint-node.d.ts +75 -0
- package/dist/base/blueprint/blueprint-node.js +51 -0
- package/dist/base/blueprint/blueprint.d.ts +123 -0
- package/dist/base/blueprint/blueprint.js +86 -0
- package/dist/base/blueprint/nodes/remove-entity.node.d.ts +26 -0
- package/dist/base/blueprint/nodes/remove-entity.node.js +29 -0
- package/dist/base/components/i-world-component.d.ts +5 -5
- package/dist/base/components/physics/i-body.component.d.ts +5 -5
- package/dist/base/components/physics/i-physics-world.component.d.ts +13 -5
- package/dist/base/components/physics/i-rigid-body.component.d.ts +2 -2
- package/dist/base/components/physics/i-trigger.component.d.ts +4 -4
- package/dist/base/components/rendering/i-display-object.component.d.ts +6 -6
- package/dist/base/components/rendering/i-renderer.component.d.ts +5 -4
- package/dist/base/components/rendering/i-visual-scene.component.d.ts +4 -2
- package/dist/base/entities/controllers/animation-mixer.d.ts +3 -3
- package/dist/base/entities/group.entity.d.ts +17 -0
- package/dist/base/entities/group.entity.js +19 -0
- package/dist/base/entities/i-entity.d.ts +19 -8
- package/dist/base/entities/i-entity.js +28 -0
- package/dist/base/entities/i-renderable.entity.d.ts +2 -2
- package/dist/base/entities/i-renderer.entity.d.ts +11 -5
- package/dist/base/entities/i-renderer.entity.js +15 -0
- package/dist/base/gg-world.d.ts +42 -5
- package/dist/base/gg-world.js +45 -10
- package/dist/base/index.d.ts +6 -0
- package/dist/base/index.js +6 -0
- package/dist/base/inputs/mouse.input.js +1 -0
- package/dist/base/level-loader.d.ts +217 -0
- package/dist/base/level-loader.js +258 -0
- package/dist/base/math/numbers.d.ts +2 -1
- package/dist/base/math/numbers.js +7 -1
- package/dist/base/math/point2.d.ts +17 -1
- package/dist/base/math/point2.js +35 -0
- package/dist/base/math/point3.d.ts +2 -0
- package/dist/base/math/point3.js +15 -1
- package/dist/base/models/points.d.ts +20 -16
- package/dist/base/models/raycasting.d.ts +52 -0
- package/dist/base/models/raycasting.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/tsconfig.json +3 -1
- /package/dist/{3d/components/rendering/i-camera.component.js → 2d/components/rendering/i-camera-2d.component.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IPhysicsWorldComponent, Point2 } from '../../../base';
|
|
2
2
|
import { PhysicsTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
|
-
export interface IPhysicsWorld2dComponent<
|
|
3
|
+
export interface IPhysicsWorld2dComponent<PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> extends IPhysicsWorldComponent<Point2, number, PTypeDoc> {
|
|
4
4
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRigidBodyComponent, Point2 } from '../../../base';
|
|
2
2
|
import { PhysicsTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
3
|
import { DebugBody2DSettings } from '../../models/body-options';
|
|
4
|
-
export interface IRigidBody2dComponent<
|
|
4
|
+
export interface IRigidBody2dComponent<PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> extends IRigidBodyComponent<Point2, number, PTypeDoc> {
|
|
5
5
|
angularVelocity: number;
|
|
6
6
|
/** body info for physics debugger view */
|
|
7
7
|
readonly debugBodySettings: DebugBody2DSettings;
|
|
@@ -2,9 +2,9 @@ import { ITriggerComponent, Point2 } from '../../../base';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { PhysicsTypeDocRepo2D } from '../../gg-2d-world';
|
|
4
4
|
import { DebugBody2DSettings } from '../../models/body-options';
|
|
5
|
-
export interface ITrigger2dComponent<
|
|
5
|
+
export interface ITrigger2dComponent<PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> extends ITriggerComponent<Point2, number, PTypeDoc> {
|
|
6
6
|
/** body info for physics debugger view */
|
|
7
7
|
readonly debugBodySettings: DebugBody2DSettings;
|
|
8
|
-
get onEntityEntered(): Observable<
|
|
9
|
-
get onEntityLeft(): Observable<
|
|
8
|
+
get onEntityEntered(): Observable<PTypeDoc['rigidBody']>;
|
|
9
|
+
get onEntityLeft(): Observable<PTypeDoc['rigidBody'] | null>;
|
|
10
10
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { IDisplayObject2dComponent } from './i-display-object-2d.component';
|
|
2
|
+
import { VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
|
+
export interface ICamera2dComponent<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IDisplayObject2dComponent<VTypeDoc> {
|
|
4
|
+
zoom: number;
|
|
5
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IDisplayObjectComponent, Point2 } from '../../../base';
|
|
2
2
|
import { VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
|
-
export interface IDisplayObject2dComponent<
|
|
3
|
+
export interface IDisplayObject2dComponent<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IDisplayObjectComponent<Point2, number, VTypeDoc> {
|
|
4
4
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IRendererComponent, Point2 } from '../../../base';
|
|
2
2
|
import { VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
|
-
export declare abstract class IRenderer2dComponent<
|
|
3
|
+
export declare abstract class IRenderer2dComponent<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IRendererComponent<Point2, number, VTypeDoc> {
|
|
4
4
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { IVisualSceneComponent, Point2
|
|
1
|
+
import { IVisualSceneComponent, Point2 } from '../../../base';
|
|
2
2
|
import { VisualTypeDocRepo2D } from '../../gg-2d-world';
|
|
3
|
-
export interface IVisualScene2dComponent<
|
|
4
|
-
createRenderer(canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & TypeDoc['rendererExtraOpts']>): TypeDoc['renderer'];
|
|
3
|
+
export interface IVisualScene2dComponent<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IVisualSceneComponent<Point2, number, VTypeDoc> {
|
|
5
4
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { AnimationFunction, AnimationMixer, Point2 } from '../../../base';
|
|
2
|
-
import { Gg2dWorld,
|
|
2
|
+
import { Gg2dWorld, Gg2dWorldTypeDocRepo } from '../../gg-2d-world';
|
|
3
3
|
import { Entity2d } from '../entity-2d';
|
|
4
4
|
type Positioning2d = {
|
|
5
5
|
position: Point2;
|
|
6
6
|
rotation: number;
|
|
7
7
|
};
|
|
8
|
-
export declare class Entity2dPositioningAnimator<T extends Entity2d = Entity2d> extends AnimationMixer<Positioning2d, Point2, number,
|
|
8
|
+
export declare class Entity2dPositioningAnimator<T extends Entity2d = Entity2d> extends AnimationMixer<Positioning2d, Point2, number, Gg2dWorldTypeDocRepo> {
|
|
9
9
|
entity: T;
|
|
10
10
|
protected _animationFunction: AnimationFunction<Positioning2d>;
|
|
11
11
|
constructor(entity: T, _animationFunction: AnimationFunction<Positioning2d>);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Point2, TickOrder } from '../../base';
|
|
2
2
|
import { IPositionable2d } from '../interfaces/i-positionable-2d';
|
|
3
3
|
import { IRenderable2dEntity } from './i-renderable-2d.entity';
|
|
4
|
-
import {
|
|
5
|
-
export declare class Entity2d<
|
|
4
|
+
import { Gg2dWorldTypeDocRepo } from '../gg-2d-world';
|
|
5
|
+
export declare class Entity2d<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo> extends IRenderable2dEntity<TypeDoc> implements IPositionable2d {
|
|
6
6
|
readonly tickOrder = TickOrder.OBJECTS_BINDING;
|
|
7
7
|
private _position;
|
|
8
8
|
get position(): Point2;
|
|
@@ -10,15 +10,15 @@ export declare class Entity2d<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeD
|
|
|
10
10
|
private _rotation;
|
|
11
11
|
get rotation(): number;
|
|
12
12
|
set rotation(value: number);
|
|
13
|
-
readonly object2D:
|
|
14
|
-
readonly objectBody:
|
|
13
|
+
readonly object2D: TypeDoc['vTypeDoc']['displayObject'] | null;
|
|
14
|
+
readonly objectBody: TypeDoc['pTypeDoc']['rigidBody'] | null;
|
|
15
15
|
updateVisibility(): void;
|
|
16
16
|
/**
|
|
17
17
|
* Synchronize physics body transform with entity (and object2d if defined)
|
|
18
18
|
* */
|
|
19
|
-
protected runTransformBinding(objectBody:
|
|
19
|
+
protected runTransformBinding(objectBody: TypeDoc['pTypeDoc']['rigidBody'], object2D: TypeDoc['vTypeDoc']['displayObject'] | null): void;
|
|
20
20
|
constructor(options: {
|
|
21
|
-
object2D?:
|
|
22
|
-
objectBody?:
|
|
21
|
+
object2D?: TypeDoc['vTypeDoc']['displayObject'];
|
|
22
|
+
objectBody?: TypeDoc['pTypeDoc']['rigidBody'];
|
|
23
23
|
});
|
|
24
24
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IRenderableEntity, Point2 } from '../../base';
|
|
2
|
-
import { Gg2dWorld,
|
|
3
|
-
export declare abstract class IRenderable2dEntity<TypeDoc extends
|
|
4
|
-
protected _world: Gg2dWorld<TypeDoc
|
|
5
|
-
get world(): Gg2dWorld<TypeDoc
|
|
2
|
+
import { Gg2dWorld, Gg2dWorldTypeDocRepo } from '../gg-2d-world';
|
|
3
|
+
export declare abstract class IRenderable2dEntity<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo> extends IRenderableEntity<Point2, number, TypeDoc> {
|
|
4
|
+
protected _world: Gg2dWorld<TypeDoc> | null;
|
|
5
|
+
get world(): Gg2dWorld<TypeDoc> | null;
|
|
6
6
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IRendererEntity, Point2 } from '../../base';
|
|
2
2
|
import { VisualTypeDocRepo2D } from '../gg-2d-world';
|
|
3
|
-
|
|
3
|
+
import { IPositionable2d } from '../interfaces/i-positionable-2d';
|
|
4
|
+
export declare class Renderer2dEntity<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> extends IRendererEntity<Point2, number, VTypeDoc> implements IPositionable2d {
|
|
4
5
|
}
|
|
@@ -2,12 +2,16 @@ import { Observable } from 'rxjs';
|
|
|
2
2
|
import { ITrigger2dComponent } from '../components/physics/i-trigger-2d.component';
|
|
3
3
|
import { IEntity, Point2, TickOrder } from '../../base';
|
|
4
4
|
import { IPositionable2d } from '../interfaces/i-positionable-2d';
|
|
5
|
-
import {
|
|
6
|
-
export declare class Trigger2dEntity<
|
|
5
|
+
import { Gg2dWorldTypeDocPPatch, Gg2dWorldTypeDocRepo, PhysicsTypeDocRepo2D } from '../gg-2d-world';
|
|
6
|
+
export declare class Trigger2dEntity<PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> extends IEntity<Point2, number, Gg2dWorldTypeDocPPatch<PTypeDoc>> implements IPositionable2d {
|
|
7
7
|
readonly objectBody: ITrigger2dComponent;
|
|
8
8
|
readonly tickOrder = TickOrder.OBJECTS_BINDING;
|
|
9
|
-
get onEntityEntered(): Observable<IEntity<Point2, number,
|
|
10
|
-
|
|
9
|
+
get onEntityEntered(): Observable<IEntity<Point2, number, Gg2dWorldTypeDocRepo & {
|
|
10
|
+
pTypeDoc: PTypeDoc;
|
|
11
|
+
}> & IPositionable2d>;
|
|
12
|
+
get onEntityLeft(): Observable<(IEntity<Point2, number, Gg2dWorldTypeDocRepo & {
|
|
13
|
+
pTypeDoc: PTypeDoc;
|
|
14
|
+
}> & IPositionable2d) | null>;
|
|
11
15
|
private _position;
|
|
12
16
|
get position(): Point2;
|
|
13
17
|
set position(value: Point2);
|
package/dist/2d/factories.d.ts
CHANGED
|
@@ -5,19 +5,19 @@ export type DisplayObject2dOpts<Tex> = {
|
|
|
5
5
|
color?: number;
|
|
6
6
|
texture?: Tex;
|
|
7
7
|
};
|
|
8
|
-
export declare abstract class IDisplayObject2dComponentFactory<
|
|
9
|
-
abstract createPrimitive(descriptor: Shape2DDescriptor, material?: DisplayObject2dOpts<
|
|
8
|
+
export declare abstract class IDisplayObject2dComponentFactory<VTypeDoc extends VisualTypeDocRepo2D = VisualTypeDocRepo2D> {
|
|
9
|
+
abstract createPrimitive(descriptor: Shape2DDescriptor, material?: DisplayObject2dOpts<VTypeDoc['texture']>): VTypeDoc['displayObject'];
|
|
10
10
|
randomColor(): number;
|
|
11
|
-
createSquare(dimensions: Point2, material?: DisplayObject2dOpts<
|
|
12
|
-
createCircle(radius: number, material?: DisplayObject2dOpts<
|
|
11
|
+
createSquare(dimensions: Point2, material?: DisplayObject2dOpts<VTypeDoc['texture']>): VTypeDoc['displayObject'];
|
|
12
|
+
createCircle(radius: number, material?: DisplayObject2dOpts<VTypeDoc['texture']>): VTypeDoc['displayObject'];
|
|
13
13
|
}
|
|
14
|
-
export interface IPhysicsBody2dComponentFactory<
|
|
14
|
+
export interface IPhysicsBody2dComponentFactory<PTypeDoc extends PhysicsTypeDocRepo2D = PhysicsTypeDocRepo2D> {
|
|
15
15
|
createRigidBody(descriptor: BodyShape2DDescriptor, transform?: {
|
|
16
16
|
position?: Point2;
|
|
17
17
|
rotation?: number;
|
|
18
|
-
}):
|
|
18
|
+
}): PTypeDoc['rigidBody'];
|
|
19
19
|
createTrigger(descriptor: Shape2DDescriptor, transform?: {
|
|
20
20
|
position?: Point2;
|
|
21
21
|
rotation?: number;
|
|
22
|
-
}):
|
|
22
|
+
}): PTypeDoc['trigger'];
|
|
23
23
|
}
|
package/dist/2d/gg-2d-world.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { GgWorld, Point2, RendererOptions } from '../base';
|
|
2
|
+
import { Gg2dLoader } from './loader';
|
|
2
3
|
import { BodyShape2DDescriptor } from './models/shapes';
|
|
3
4
|
import { Entity2d } from './entities/entity-2d';
|
|
4
5
|
import { IPhysicsWorld2dComponent } from './components/physics/i-physics-world-2d.component';
|
|
@@ -7,6 +8,7 @@ import { Renderer2dEntity } from './entities/renderer-2d.entity';
|
|
|
7
8
|
import { DisplayObject2dOpts, IDisplayObject2dComponentFactory, IPhysicsBody2dComponentFactory } from './factories';
|
|
8
9
|
import { IRenderer2dComponent } from './components/rendering/i-renderer-2d.component';
|
|
9
10
|
import { IDisplayObject2dComponent } from './components/rendering/i-display-object-2d.component';
|
|
11
|
+
import { ICamera2dComponent } from './components/rendering/i-camera-2d.component';
|
|
10
12
|
import { ITrigger2dComponent } from './components/physics/i-trigger-2d.component';
|
|
11
13
|
import { IRigidBody2dComponent } from './components/physics/i-rigid-body-2d.component';
|
|
12
14
|
export type VisualTypeDocRepo2D = {
|
|
@@ -14,6 +16,7 @@ export type VisualTypeDocRepo2D = {
|
|
|
14
16
|
displayObject: IDisplayObject2dComponent;
|
|
15
17
|
renderer: IRenderer2dComponent;
|
|
16
18
|
rendererExtraOpts: {};
|
|
19
|
+
camera: ICamera2dComponent;
|
|
17
20
|
texture: unknown;
|
|
18
21
|
};
|
|
19
22
|
export type PhysicsTypeDocRepo2D = {
|
|
@@ -21,12 +24,41 @@ export type PhysicsTypeDocRepo2D = {
|
|
|
21
24
|
rigidBody: IRigidBody2dComponent;
|
|
22
25
|
trigger: ITrigger2dComponent;
|
|
23
26
|
};
|
|
24
|
-
export
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export type Gg2dWorldTypeDocRepo = {
|
|
28
|
+
vTypeDoc: VisualTypeDocRepo2D;
|
|
29
|
+
pTypeDoc: PhysicsTypeDocRepo2D;
|
|
30
|
+
};
|
|
31
|
+
export type Gg2dWorldTypeDocVPatch<VTypeDoc extends VisualTypeDocRepo2D> = Omit<Gg2dWorldTypeDocRepo, 'vTypeDoc'> & {
|
|
32
|
+
vTypeDoc: VTypeDoc;
|
|
33
|
+
};
|
|
34
|
+
export type Gg2dWorldTypeDocPPatch<PTypeDoc extends PhysicsTypeDocRepo2D> = Omit<Gg2dWorldTypeDocRepo, 'pTypeDoc'> & {
|
|
35
|
+
pTypeDoc: PTypeDoc;
|
|
36
|
+
};
|
|
37
|
+
export type Gg2dWorldSceneTypeRepo<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo> = {
|
|
38
|
+
visualScene: IVisualScene2dComponent<TypeDoc['vTypeDoc']> | null;
|
|
39
|
+
physicsWorld: IPhysicsWorld2dComponent<TypeDoc['pTypeDoc']> | null;
|
|
40
|
+
};
|
|
41
|
+
export type Gg2dWorldSceneTypeDocVPatch<VTypeDoc extends VisualTypeDocRepo2D, VS extends IVisualScene2dComponent<VTypeDoc> | null> = Omit<Gg2dWorldSceneTypeRepo, 'visualScene'> & {
|
|
42
|
+
visualScene: VS;
|
|
43
|
+
};
|
|
44
|
+
export type Gg2dWorldSceneTypeDocPPatch<PTypeDoc extends PhysicsTypeDocRepo2D, PW extends IPhysicsWorld2dComponent<PTypeDoc> | null> = Omit<Gg2dWorldSceneTypeRepo, 'physicsWorld'> & {
|
|
45
|
+
physicsWorld: PW;
|
|
46
|
+
};
|
|
47
|
+
export type TypedGg2dWorld<VW extends Gg2dWorld<any> | null, PW extends Gg2dWorld<any> | null> = VW extends Gg2dWorld<infer VTD, infer VSTD> | null ? PW extends Gg2dWorld<infer PTD, infer PSTD> | null ? Gg2dWorld<{
|
|
48
|
+
vTypeDoc: VTD['vTypeDoc'];
|
|
49
|
+
pTypeDoc: PTD['pTypeDoc'];
|
|
50
|
+
}, {
|
|
51
|
+
visualScene: VSTD['visualScene'];
|
|
52
|
+
physicsWorld: PSTD['physicsWorld'];
|
|
53
|
+
}> : never : never;
|
|
54
|
+
export declare class Gg2dWorld<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo, SceneTypeDoc extends Gg2dWorldSceneTypeRepo<TypeDoc> = Gg2dWorldSceneTypeRepo<TypeDoc>> extends GgWorld<Point2, number, TypeDoc, SceneTypeDoc> {
|
|
55
|
+
readonly loader: Gg2dLoader<TypeDoc>;
|
|
56
|
+
constructor(args: {
|
|
57
|
+
visualScene?: SceneTypeDoc['visualScene'];
|
|
58
|
+
physicsWorld?: SceneTypeDoc['physicsWorld'];
|
|
59
|
+
});
|
|
60
|
+
addPrimitiveRigidBody(descr: BodyShape2DDescriptor, position?: Point2, rotation?: number, material?: DisplayObject2dOpts<TypeDoc['vTypeDoc']['texture']>): Entity2d<TypeDoc>;
|
|
61
|
+
addRenderer(camera: TypeDoc['vTypeDoc']['camera'], canvas?: HTMLCanvasElement, rendererOptions?: Partial<RendererOptions & TypeDoc['vTypeDoc']['rendererExtraOpts']>): Renderer2dEntity<TypeDoc['vTypeDoc']>;
|
|
30
62
|
protected registerConsoleCommands(ggstatic: {
|
|
31
63
|
registerConsoleCommand: (world: GgWorld<any, any> | null, command: string, handler: (...args: string[]) => Promise<string>, doc?: string) => void;
|
|
32
64
|
}): void;
|
package/dist/2d/gg-2d-world.js
CHANGED
|
@@ -8,44 +8,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { GgWorld, Pnt2 } from '../base';
|
|
11
|
+
import { Gg2dLoader } from './loader';
|
|
11
12
|
import { Entity2d } from './entities/entity-2d';
|
|
12
13
|
import { Renderer2dEntity } from './entities/renderer-2d.entity';
|
|
13
14
|
export class Gg2dWorld extends GgWorld {
|
|
14
|
-
constructor(
|
|
15
|
-
super(
|
|
16
|
-
this.
|
|
17
|
-
this.physicsWorld = physicsWorld;
|
|
15
|
+
constructor(args) {
|
|
16
|
+
super(args);
|
|
17
|
+
this.loader = new Gg2dLoader(this);
|
|
18
18
|
}
|
|
19
19
|
addPrimitiveRigidBody(descr, position = Pnt2.O, rotation = 0, material = {}) {
|
|
20
|
+
var _a, _b;
|
|
20
21
|
const entity = new Entity2d({
|
|
21
|
-
object2D: this.visualScene.factory.createPrimitive(descr.shape, material),
|
|
22
|
-
objectBody: this.physicsWorld.factory.createRigidBody(descr),
|
|
22
|
+
object2D: (_a = this.visualScene) === null || _a === void 0 ? void 0 : _a.factory.createPrimitive(descr.shape, material),
|
|
23
|
+
objectBody: (_b = this.physicsWorld) === null || _b === void 0 ? void 0 : _b.factory.createRigidBody(descr),
|
|
23
24
|
});
|
|
24
25
|
entity.position = position;
|
|
25
26
|
entity.rotation = rotation;
|
|
26
27
|
this.addEntity(entity);
|
|
27
28
|
return entity;
|
|
28
29
|
}
|
|
29
|
-
addRenderer(canvas, rendererOptions) {
|
|
30
|
-
|
|
30
|
+
addRenderer(camera, canvas, rendererOptions) {
|
|
31
|
+
if (!this.visualScene) {
|
|
32
|
+
throw new Error('Cannot add renderer to the world without visual scene');
|
|
33
|
+
}
|
|
34
|
+
const entity = new Renderer2dEntity(this.visualScene.createRenderer(camera, canvas, rendererOptions));
|
|
31
35
|
this.addEntity(entity);
|
|
32
36
|
return entity;
|
|
33
37
|
}
|
|
34
38
|
registerConsoleCommands(ggstatic) {
|
|
35
39
|
super.registerConsoleCommands(ggstatic);
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (args.length > 0) {
|
|
41
|
-
if (isNaN(+args[0]) || isNaN(+args[1])) {
|
|
42
|
-
throw new Error('Wrong arguments');
|
|
40
|
+
if (this.physicsWorld) {
|
|
41
|
+
ggstatic.registerConsoleCommand(this, 'gravity', (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
42
|
+
if (args.length == 1) {
|
|
43
|
+
args = ['0', args[0]]; // mean Y axis
|
|
43
44
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
if (args.length > 0) {
|
|
46
|
+
if (isNaN(+args[0]) || isNaN(+args[1])) {
|
|
47
|
+
throw new Error('Wrong arguments');
|
|
48
|
+
}
|
|
49
|
+
this.physicsWorld.gravity = { x: +args[0], y: +args[1] };
|
|
50
|
+
}
|
|
51
|
+
return JSON.stringify(this.physicsWorld.gravity);
|
|
52
|
+
}), 'args: [ ?float, ?float ]; Get or set 2D world gravity vector. 1 argument sets' +
|
|
53
|
+
' vector {x: 0, y: value}, 2 arguments sets the whole vector.' +
|
|
54
|
+
' Default value is "9.82" or "0 9.82"');
|
|
55
|
+
}
|
|
50
56
|
}
|
|
51
57
|
}
|
package/dist/2d/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './components/physics/i-rigid-body-2d.component';
|
|
2
2
|
export * from './components/physics/i-trigger-2d.component';
|
|
3
3
|
export * from './components/physics/i-physics-world-2d.component';
|
|
4
|
+
export * from './components/rendering/i-camera-2d.component';
|
|
4
5
|
export * from './components/rendering/i-display-object-2d.component';
|
|
5
6
|
export * from './components/rendering/i-renderer-2d.component';
|
|
6
7
|
export * from './components/rendering/i-visual-scene-2d.component';
|
|
@@ -14,3 +15,5 @@ export * from './models/body-options';
|
|
|
14
15
|
export * from './models/shapes';
|
|
15
16
|
export * from './factories';
|
|
16
17
|
export * from './gg-2d-world';
|
|
18
|
+
export * from './loader';
|
|
19
|
+
export * from './level-loader';
|
package/dist/2d/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './components/physics/i-rigid-body-2d.component';
|
|
2
2
|
export * from './components/physics/i-trigger-2d.component';
|
|
3
3
|
export * from './components/physics/i-physics-world-2d.component';
|
|
4
|
+
export * from './components/rendering/i-camera-2d.component';
|
|
4
5
|
export * from './components/rendering/i-display-object-2d.component';
|
|
5
6
|
export * from './components/rendering/i-renderer-2d.component';
|
|
6
7
|
export * from './components/rendering/i-visual-scene-2d.component';
|
|
@@ -14,3 +15,5 @@ export * from './models/body-options';
|
|
|
14
15
|
export * from './models/shapes';
|
|
15
16
|
export * from './factories';
|
|
16
17
|
export * from './gg-2d-world';
|
|
18
|
+
export * from './loader';
|
|
19
|
+
export * from './level-loader';
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { LevelLoader } from '../base/level-loader';
|
|
2
|
+
import { Gg2dWorld, Gg2dWorldTypeDocRepo } from './gg-2d-world';
|
|
3
|
+
import { Point2 } from '../base';
|
|
4
|
+
import { DisplayObject2dOpts } from './factories';
|
|
5
|
+
import { Body2DOptions } from './models/body-options';
|
|
6
|
+
import { Shape2DDescriptor } from './models/shapes';
|
|
7
|
+
/**
|
|
8
|
+
* Shape names accepted by the built-in `"Primitive"` entity class in a 2D level JSON, via the
|
|
9
|
+
* sibling `shape` field on the entity (e.g. `{ class: "Primitive", shape: "SQUARE" }`) - the same
|
|
10
|
+
* `Shape2DDescriptor['shape']` values used at the engine API level, so no translation is needed
|
|
11
|
+
* between a level JSON and `Gg2dWorld.addPrimitiveRigidBody`.
|
|
12
|
+
*/
|
|
13
|
+
export type Primitive2DShapeName = Shape2DDescriptor['shape'];
|
|
14
|
+
/**
|
|
15
|
+
* Settings shared by every primitive entity (Square, Circle, ...)
|
|
16
|
+
*/
|
|
17
|
+
export interface PrimitiveSettings {
|
|
18
|
+
/**
|
|
19
|
+
* Which primitive shape to construct
|
|
20
|
+
*/
|
|
21
|
+
shape: Primitive2DShapeName;
|
|
22
|
+
/**
|
|
23
|
+
* Position of the primitive
|
|
24
|
+
*/
|
|
25
|
+
position?: Point2;
|
|
26
|
+
/**
|
|
27
|
+
* Rotation of the primitive in radians
|
|
28
|
+
*/
|
|
29
|
+
rotation?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Dimensions of the primitive (for Square)
|
|
32
|
+
*/
|
|
33
|
+
dimensions?: Point2;
|
|
34
|
+
/**
|
|
35
|
+
* Radius of the primitive (for Circle)
|
|
36
|
+
*/
|
|
37
|
+
radius?: number;
|
|
38
|
+
/**
|
|
39
|
+
* Material options for the primitive
|
|
40
|
+
*/
|
|
41
|
+
material?: DisplayObject2dOpts<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Physics body options, merged over sensible defaults
|
|
44
|
+
*/
|
|
45
|
+
body?: Partial<Body2DOptions>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Settings for a trigger entity
|
|
49
|
+
*/
|
|
50
|
+
export interface TriggerSettings {
|
|
51
|
+
/**
|
|
52
|
+
* Position of the trigger
|
|
53
|
+
*/
|
|
54
|
+
position?: Point2;
|
|
55
|
+
/**
|
|
56
|
+
* Rotation of the trigger in radians
|
|
57
|
+
*/
|
|
58
|
+
rotation?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Dimensions of the trigger
|
|
61
|
+
*/
|
|
62
|
+
dimensions: Point2;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 2D level loader: registers the built-in primitive/trigger entity classes and dispatches
|
|
66
|
+
* `LevelJson` entities to them (or to custom classes registered via `registerClass`).
|
|
67
|
+
* @template TypeDoc - The type document repository
|
|
68
|
+
*/
|
|
69
|
+
export declare class Gg2dLevelLoader<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo> extends LevelLoader<Point2, number, TypeDoc> {
|
|
70
|
+
protected readonly world: Gg2dWorld<TypeDoc>;
|
|
71
|
+
constructor(world: Gg2dWorld<TypeDoc>);
|
|
72
|
+
/**
|
|
73
|
+
* Register the built-in classes for primitives and triggers
|
|
74
|
+
*/
|
|
75
|
+
private registerDefaultClasses;
|
|
76
|
+
/**
|
|
77
|
+
* Turn a `PrimitiveSettings` (`shape` plus shape-specific fields) into the `Shape2DDescriptor`
|
|
78
|
+
* consumed by `Gg2dWorld.addPrimitiveRigidBody`.
|
|
79
|
+
* @param settings - The primitive settings, as parsed from a `"Primitive"` entity's `shape` +
|
|
80
|
+
* `config`
|
|
81
|
+
* @returns The shape descriptor
|
|
82
|
+
*/
|
|
83
|
+
private buildShapeDescriptor;
|
|
84
|
+
/**
|
|
85
|
+
* Create a primitive entity (both display object and physics body) from a shape descriptor
|
|
86
|
+
* @param world - The world instance
|
|
87
|
+
* @param shape - The shape descriptor
|
|
88
|
+
* @param settings - Position/rotation/material/body settings shared by all primitives
|
|
89
|
+
* @returns The created entity
|
|
90
|
+
*/
|
|
91
|
+
private createPrimitive;
|
|
92
|
+
/**
|
|
93
|
+
* Create a trigger entity: a `Trigger2dEntity` wrapping the raw physics trigger component, so
|
|
94
|
+
* the app can subscribe to `onEntityEntered`/`onEntityLeft` without any extra wiring - see the
|
|
95
|
+
* base `LevelLoader` docs for how it's parented for level-lifecycle cleanup.
|
|
96
|
+
* @param world - The world instance
|
|
97
|
+
* @param settings - The trigger settings
|
|
98
|
+
* @returns The created trigger entity
|
|
99
|
+
*/
|
|
100
|
+
private createTrigger;
|
|
101
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { LevelLoader } from '../base/level-loader';
|
|
2
|
+
import { Trigger2dEntity } from './entities/trigger-2d.entity';
|
|
3
|
+
const defaultBodyOptions = {
|
|
4
|
+
dynamic: true,
|
|
5
|
+
mass: 1,
|
|
6
|
+
restitution: 0.2,
|
|
7
|
+
friction: 0.5,
|
|
8
|
+
ownCollisionGroups: 'all',
|
|
9
|
+
interactWithCollisionGroups: 'all',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 2D level loader: registers the built-in primitive/trigger entity classes and dispatches
|
|
13
|
+
* `LevelJson` entities to them (or to custom classes registered via `registerClass`).
|
|
14
|
+
* @template TypeDoc - The type document repository
|
|
15
|
+
*/
|
|
16
|
+
export class Gg2dLevelLoader extends LevelLoader {
|
|
17
|
+
constructor(world) {
|
|
18
|
+
super(world);
|
|
19
|
+
this.world = world;
|
|
20
|
+
this.registerDefaultClasses();
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Register the built-in classes for primitives and triggers
|
|
24
|
+
*/
|
|
25
|
+
registerDefaultClasses() {
|
|
26
|
+
this.registerClass('Primitive', (world, settings) => this.createPrimitive(world, this.buildShapeDescriptor(settings), settings));
|
|
27
|
+
this.registerClass('Trigger', this.createTrigger.bind(this));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Turn a `PrimitiveSettings` (`shape` plus shape-specific fields) into the `Shape2DDescriptor`
|
|
31
|
+
* consumed by `Gg2dWorld.addPrimitiveRigidBody`.
|
|
32
|
+
* @param settings - The primitive settings, as parsed from a `"Primitive"` entity's `shape` +
|
|
33
|
+
* `config`
|
|
34
|
+
* @returns The shape descriptor
|
|
35
|
+
*/
|
|
36
|
+
buildShapeDescriptor(settings) {
|
|
37
|
+
switch (settings.shape) {
|
|
38
|
+
case 'SQUARE':
|
|
39
|
+
if (!settings.dimensions) {
|
|
40
|
+
throw new Error('Dimensions are required for SQUARE primitive');
|
|
41
|
+
}
|
|
42
|
+
return { shape: 'SQUARE', dimensions: settings.dimensions };
|
|
43
|
+
case 'CIRCLE':
|
|
44
|
+
if (settings.radius === undefined) {
|
|
45
|
+
throw new Error('Radius is required for CIRCLE primitive');
|
|
46
|
+
}
|
|
47
|
+
return { shape: 'CIRCLE', radius: settings.radius };
|
|
48
|
+
default:
|
|
49
|
+
throw new Error(`Unknown primitive shape "${settings.shape}"`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Create a primitive entity (both display object and physics body) from a shape descriptor
|
|
54
|
+
* @param world - The world instance
|
|
55
|
+
* @param shape - The shape descriptor
|
|
56
|
+
* @param settings - Position/rotation/material/body settings shared by all primitives
|
|
57
|
+
* @returns The created entity
|
|
58
|
+
*/
|
|
59
|
+
createPrimitive(world, shape, settings) {
|
|
60
|
+
const { position, rotation, material, body } = settings;
|
|
61
|
+
return world.addPrimitiveRigidBody({ shape, body: Object.assign(Object.assign({}, defaultBodyOptions), body) }, position, rotation, material);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Create a trigger entity: a `Trigger2dEntity` wrapping the raw physics trigger component, so
|
|
65
|
+
* the app can subscribe to `onEntityEntered`/`onEntityLeft` without any extra wiring - see the
|
|
66
|
+
* base `LevelLoader` docs for how it's parented for level-lifecycle cleanup.
|
|
67
|
+
* @param world - The world instance
|
|
68
|
+
* @param settings - The trigger settings
|
|
69
|
+
* @returns The created trigger entity
|
|
70
|
+
*/
|
|
71
|
+
createTrigger(world, settings) {
|
|
72
|
+
var _a;
|
|
73
|
+
const { position, rotation, dimensions } = settings;
|
|
74
|
+
const shape = { shape: 'SQUARE', dimensions };
|
|
75
|
+
const trigger = (_a = world.physicsWorld) === null || _a === void 0 ? void 0 : _a.factory.createTrigger(shape, { position, rotation });
|
|
76
|
+
if (!trigger) {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
const entity = new Trigger2dEntity(trigger);
|
|
80
|
+
if (position !== undefined) {
|
|
81
|
+
entity.position = position;
|
|
82
|
+
}
|
|
83
|
+
if (rotation !== undefined) {
|
|
84
|
+
entity.rotation = rotation;
|
|
85
|
+
}
|
|
86
|
+
return entity;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Gg2dWorldTypeDocRepo } from './gg-2d-world';
|
|
2
|
+
import { Gg2dLevelLoader } from './level-loader';
|
|
3
|
+
/**
|
|
4
|
+
* Full loader exposed as `Gg2dWorld.loader`, extending `Gg2dLevelLoader` (so
|
|
5
|
+
* `registerClass`/`loadLevel`/`loadLevelFromUrl`/`getEntityByName` are all available directly on
|
|
6
|
+
* `world.loader`) - kept as its own class/type so 2D can grow other loading capabilities (the way
|
|
7
|
+
* `Gg3dLoader` has GLB loading) without a breaking rename.
|
|
8
|
+
* @template TypeDoc - The type document repository
|
|
9
|
+
*/
|
|
10
|
+
export declare class Gg2dLoader<TypeDoc extends Gg2dWorldTypeDocRepo = Gg2dWorldTypeDocRepo> extends Gg2dLevelLoader<TypeDoc> {
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Gg2dLevelLoader } from './level-loader';
|
|
2
|
+
/**
|
|
3
|
+
* Full loader exposed as `Gg2dWorld.loader`, extending `Gg2dLevelLoader` (so
|
|
4
|
+
* `registerClass`/`loadLevel`/`loadLevelFromUrl`/`getEntityByName` are all available directly on
|
|
5
|
+
* `world.loader`) - kept as its own class/type so 2D can grow other loading capabilities (the way
|
|
6
|
+
* `Gg3dLoader` has GLB loading) without a breaking rename.
|
|
7
|
+
* @template TypeDoc - The type document repository
|
|
8
|
+
*/
|
|
9
|
+
export class Gg2dLoader extends Gg2dLevelLoader {
|
|
10
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { IPhysicsWorldComponent, Point3, Point4 } from '../../../base';
|
|
2
2
|
import { PhysicsTypeDocRepo3D } from '../../gg-3d-world';
|
|
3
3
|
import { Subject } from 'rxjs';
|
|
4
|
-
export interface IPhysicsWorld3dComponent<
|
|
5
|
-
readonly loader:
|
|
4
|
+
export interface IPhysicsWorld3dComponent<PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends IPhysicsWorldComponent<Point3, Point4, PTypeDoc> {
|
|
5
|
+
readonly loader: PTypeDoc['loader'];
|
|
6
6
|
/** event emitter, emits newly added physics components */
|
|
7
|
-
readonly added$: Subject<
|
|
7
|
+
readonly added$: Subject<PTypeDoc['trigger'] | PTypeDoc['rigidBody'] | PTypeDoc['raycastVehicle'] | any>;
|
|
8
8
|
/** event emitter, emits just removed physics components */
|
|
9
|
-
readonly removed$: Subject<
|
|
9
|
+
readonly removed$: Subject<PTypeDoc['trigger'] | PTypeDoc['rigidBody'] | PTypeDoc['raycastVehicle'] | any>;
|
|
10
10
|
/** list of currently added to world physics components */
|
|
11
|
-
readonly children: (
|
|
11
|
+
readonly children: (PTypeDoc['trigger'] | PTypeDoc['rigidBody'] | PTypeDoc['raycastVehicle'] | any)[];
|
|
12
12
|
}
|
|
@@ -17,7 +17,7 @@ export type WheelOptions = {
|
|
|
17
17
|
rollInfluence: number;
|
|
18
18
|
maxTravel: number;
|
|
19
19
|
};
|
|
20
|
-
export interface IRaycastVehicleComponent<
|
|
20
|
+
export interface IRaycastVehicleComponent<PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends IRigidBody3dComponent<PTypeDoc> {
|
|
21
21
|
/** Return speed in m/s, calculated by car itself (which should be shown on the speedometer) */
|
|
22
22
|
get wheelSpeed(): number;
|
|
23
23
|
addWheel(options: WheelOptions, suspensionOptions: SuspensionOptions): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IRigidBodyComponent, Point3, Point4 } from '../../../base';
|
|
2
2
|
import { PhysicsTypeDocRepo3D } from '../../gg-3d-world';
|
|
3
3
|
import { DebugBody3DSettings } from '../../models/body-options';
|
|
4
|
-
export interface IRigidBody3dComponent<
|
|
4
|
+
export interface IRigidBody3dComponent<PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends IRigidBodyComponent<Point3, Point4, PTypeDoc> {
|
|
5
5
|
angularVelocity: Point3;
|
|
6
6
|
/** body info for physics debugger view */
|
|
7
7
|
readonly debugBodySettings: DebugBody3DSettings;
|
|
@@ -2,9 +2,9 @@ import { ITriggerComponent, Point3, Point4 } from '../../../base';
|
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { PhysicsTypeDocRepo3D } from '../../gg-3d-world';
|
|
4
4
|
import { DebugBody3DSettings } from '../../models/body-options';
|
|
5
|
-
export interface ITrigger3dComponent<
|
|
5
|
+
export interface ITrigger3dComponent<PTypeDoc extends PhysicsTypeDocRepo3D = PhysicsTypeDocRepo3D> extends ITriggerComponent<Point3, Point4, PTypeDoc> {
|
|
6
6
|
/** body info for physics debugger view */
|
|
7
7
|
readonly debugBodySettings: DebugBody3DSettings;
|
|
8
|
-
get onEntityEntered(): Observable<
|
|
9
|
-
get onEntityLeft(): Observable<
|
|
8
|
+
get onEntityEntered(): Observable<PTypeDoc['rigidBody']>;
|
|
9
|
+
get onEntityLeft(): Observable<PTypeDoc['rigidBody'] | null>;
|
|
10
10
|
}
|