@cyclonium/physics-2d 0.0.100
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/lib/body-collider-link.d.ts +32 -0
- package/lib/body-collider-link.js +164 -0
- package/lib/character-controller-2d.d.ts +69 -0
- package/lib/character-controller-2d.js +399 -0
- package/lib/collider-2d.d.ts +81 -0
- package/lib/collider-2d.js +364 -0
- package/lib/colliders/box-collider-2d.d.ts +20 -0
- package/lib/colliders/box-collider-2d.js +84 -0
- package/lib/colliders/capsule-collider-2d.d.ts +17 -0
- package/lib/colliders/capsule-collider-2d.js +78 -0
- package/lib/colliders/circle-collider-2d.d.ts +14 -0
- package/lib/colliders/circle-collider-2d.js +59 -0
- package/lib/colliders/polygon-collider-2d.d.ts +17 -0
- package/lib/colliders/polygon-collider-2d.js +77 -0
- package/lib/collision-matrix.d.ts +12 -0
- package/lib/collision-matrix.js +70 -0
- package/lib/contact.d.ts +7 -0
- package/lib/contact.js +2 -0
- package/lib/exchange.d.ts +5 -0
- package/lib/exchange.js +23 -0
- package/lib/gizmo-headless.d.ts +7 -0
- package/lib/gizmo-headless.js +7 -0
- package/lib/gizmo.d.ts +13 -0
- package/lib/gizmo.js +122 -0
- package/lib/index.d.ts +20 -0
- package/lib/index.js +20 -0
- package/lib/physics-2d-debugger-headless.d.ts +6 -0
- package/lib/physics-2d-debugger-headless.js +9 -0
- package/lib/physics-2d-debugger.d.ts +11 -0
- package/lib/physics-2d-debugger.js +146 -0
- package/lib/physics-2d-settings.d.ts +13 -0
- package/lib/physics-2d-settings.js +53 -0
- package/lib/physics-component-2d-base.d.ts +22 -0
- package/lib/physics-component-2d-base.js +85 -0
- package/lib/physics-world-2d-scene-component.d.ts +20 -0
- package/lib/physics-world-2d-scene-component.js +107 -0
- package/lib/physics-world-2d.d.ts +103 -0
- package/lib/physics-world-2d.js +506 -0
- package/lib/physics-world-registry.d.ts +6 -0
- package/lib/physics-world-registry.js +26 -0
- package/lib/px2-impl.d.ts +4 -0
- package/lib/px2-impl.js +18 -0
- package/lib/rigid-body-2d.d.ts +72 -0
- package/lib/rigid-body-2d.js +391 -0
- package/lib/scene-query-probe-2d.d.ts +102 -0
- package/lib/scene-query-probe-2d.js +223 -0
- package/lib/scene-query-probes/box-scene-query-probe-2d.d.ts +21 -0
- package/lib/scene-query-probes/box-scene-query-probe-2d.js +62 -0
- package/lib/scene-query-probes/capsule-scene-query-probe-2d.d.ts +27 -0
- package/lib/scene-query-probes/capsule-scene-query-probe-2d.js +96 -0
- package/lib/scene-query-probes/circle-scene-query-probe-2d.d.ts +20 -0
- package/lib/scene-query-probes/circle-scene-query-probe-2d.js +64 -0
- package/lib/scene-query.d.ts +67 -0
- package/lib/scene-query.js +128 -0
- package/lib/shared.d.ts +9 -0
- package/lib/shared.js +42 -0
- package/lib/utils/3-to-2.d.ts +3 -0
- package/lib/utils/3-to-2.js +12 -0
- package/lib/wasm-binary-helper/index.d.ts +6 -0
- package/lib/wasm-binary-helper/index.js +14 -0
- package/lib/wasm-binary-helper/wasm-binary-id.d.ts +2 -0
- package/lib/wasm-binary-helper/wasm-binary-id.js +2 -0
- package/lib/wasm-binary-helper.d.ts +6 -0
- package/lib/wasm-binary-helper.js +6 -0
- package/package.json +50 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Asset } from 'cc';
|
|
8
|
+
import { editable, serializable } from '@cyclonium/core/legacy-decorator';
|
|
9
|
+
import { cycloBuiltinClass } from '@cyclonium/core/internal';
|
|
10
|
+
import { CollisionMatrix } from './collision-matrix.js';
|
|
11
|
+
import { dumpRaw } from '@cyclonium/core/utils';
|
|
12
|
+
let Physics2DSettings = class Physics2DSettings extends Asset {
|
|
13
|
+
fps = 60;
|
|
14
|
+
get tags() {
|
|
15
|
+
return this._tags;
|
|
16
|
+
}
|
|
17
|
+
get tags_editor() {
|
|
18
|
+
return this._tags;
|
|
19
|
+
}
|
|
20
|
+
set tags_editor(value) {
|
|
21
|
+
this._tags = { ...value };
|
|
22
|
+
}
|
|
23
|
+
get collisionMatrix() {
|
|
24
|
+
return this._collisionMatrix;
|
|
25
|
+
}
|
|
26
|
+
findTagIndex(tag) {
|
|
27
|
+
return this._tags[tag] ?? -1;
|
|
28
|
+
}
|
|
29
|
+
_tags = {};
|
|
30
|
+
_collisionMatrix = new CollisionMatrix();
|
|
31
|
+
};
|
|
32
|
+
__decorate([
|
|
33
|
+
serializable,
|
|
34
|
+
editable
|
|
35
|
+
], Physics2DSettings.prototype, "fps", void 0);
|
|
36
|
+
__decorate([
|
|
37
|
+
editable,
|
|
38
|
+
dumpRaw
|
|
39
|
+
], Physics2DSettings.prototype, "tags_editor", null);
|
|
40
|
+
__decorate([
|
|
41
|
+
editable
|
|
42
|
+
], Physics2DSettings.prototype, "collisionMatrix", null);
|
|
43
|
+
__decorate([
|
|
44
|
+
serializable
|
|
45
|
+
], Physics2DSettings.prototype, "_tags", void 0);
|
|
46
|
+
__decorate([
|
|
47
|
+
serializable
|
|
48
|
+
], Physics2DSettings.prototype, "_collisionMatrix", void 0);
|
|
49
|
+
Physics2DSettings = __decorate([
|
|
50
|
+
cycloBuiltinClass('Physics2DSettings')
|
|
51
|
+
], Physics2DSettings);
|
|
52
|
+
export { Physics2DSettings };
|
|
53
|
+
//# sourceMappingURL=physics-2d-settings.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CycloComponent } from '@cyclonium/core/framework';
|
|
2
|
+
import type { PhysicsWorld2D } from './physics-world-2d.js';
|
|
3
|
+
export declare const invokeOnSyncTransforms: (component: PhysicsComponent2DBase, forceTransform: boolean, forceScale: boolean) => void;
|
|
4
|
+
export declare const invokeOnAfterStep: (component: PhysicsComponent2DBase) => void;
|
|
5
|
+
export declare abstract class PhysicsComponent2DBase extends CycloComponent {
|
|
6
|
+
protected get world(): PhysicsWorld2D | null;
|
|
7
|
+
protected abstract onAttachToWorld(world: PhysicsWorld2D): void;
|
|
8
|
+
protected abstract onDetachFromWorld(world: PhysicsWorld2D): void;
|
|
9
|
+
protected onSyncTransforms(_forceTransform: boolean, _forceScale: boolean): void;
|
|
10
|
+
protected onAfterPhysicsStep(): void;
|
|
11
|
+
protected onAwake(): void;
|
|
12
|
+
protected onStart(): void;
|
|
13
|
+
protected onDestroy(): void;
|
|
14
|
+
protected onEnabled(): void;
|
|
15
|
+
private _physicsWorld;
|
|
16
|
+
private _firstEnabled;
|
|
17
|
+
private _attached;
|
|
18
|
+
private _handleAncestorChange;
|
|
19
|
+
private _tryAttach;
|
|
20
|
+
private _tryDetach;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=physics-component-2d-base.d.ts.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { Node } from 'cc';
|
|
8
|
+
import { CycloComponent } from '@cyclonium/core/framework';
|
|
9
|
+
import { cycloBuiltinClass } from '@cyclonium/core/internal';
|
|
10
|
+
import { getPhysicsWorld } from './physics-world-registry.js';
|
|
11
|
+
export const invokeOnSyncTransforms = (component, forceTransform, forceScale) => {
|
|
12
|
+
// @ts-expect-error protected hook invoker
|
|
13
|
+
return component.onSyncTransforms(forceTransform, forceScale);
|
|
14
|
+
};
|
|
15
|
+
export const invokeOnAfterStep = (component) => {
|
|
16
|
+
// @ts-expect-error protected hook invoker
|
|
17
|
+
return component.onAfterPhysicsStep();
|
|
18
|
+
};
|
|
19
|
+
let PhysicsComponent2DBase = class PhysicsComponent2DBase extends CycloComponent {
|
|
20
|
+
get world() {
|
|
21
|
+
return this._physicsWorld;
|
|
22
|
+
}
|
|
23
|
+
onSyncTransforms(_forceTransform, _forceScale) { }
|
|
24
|
+
onAfterPhysicsStep() { }
|
|
25
|
+
onAwake() {
|
|
26
|
+
if (!this._attached) {
|
|
27
|
+
this._tryAttach();
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
onStart() {
|
|
31
|
+
if (!this._attached) {
|
|
32
|
+
this._tryAttach();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
onDestroy() {
|
|
36
|
+
super.onDestroy();
|
|
37
|
+
this._tryDetach();
|
|
38
|
+
}
|
|
39
|
+
onEnabled() {
|
|
40
|
+
if (!this._firstEnabled) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this._firstEnabled = false;
|
|
44
|
+
this.node.on(Node.EventType.PARENT_CHANGED, this._handleAncestorChange, this);
|
|
45
|
+
this._tryAttach();
|
|
46
|
+
}
|
|
47
|
+
_physicsWorld = null;
|
|
48
|
+
_firstEnabled = true;
|
|
49
|
+
_attached = false;
|
|
50
|
+
_handleAncestorChange() {
|
|
51
|
+
if (this.node) {
|
|
52
|
+
this._tryAttach();
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
this._tryDetach();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
_tryAttach() {
|
|
59
|
+
const node = this.node;
|
|
60
|
+
const physicsWorld = getPhysicsWorld(node.scene);
|
|
61
|
+
if (physicsWorld === this._physicsWorld) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
this._tryDetach();
|
|
65
|
+
if (physicsWorld) {
|
|
66
|
+
this._physicsWorld = physicsWorld;
|
|
67
|
+
this._attached = true;
|
|
68
|
+
this.onAttachToWorld(physicsWorld);
|
|
69
|
+
physicsWorld.listenersOnWillDestroy.add(() => this._tryDetach(), { signal: this.destroyingSignal });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
_tryDetach() {
|
|
73
|
+
if (!this._physicsWorld) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
this._attached = false;
|
|
77
|
+
this.onDetachFromWorld(this._physicsWorld);
|
|
78
|
+
this._physicsWorld = null;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
PhysicsComponent2DBase = __decorate([
|
|
82
|
+
cycloBuiltinClass({ abstract: true })
|
|
83
|
+
], PhysicsComponent2DBase);
|
|
84
|
+
export { PhysicsComponent2DBase };
|
|
85
|
+
//# sourceMappingURL=physics-component-2d-base.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CycloComponent } from '@cyclonium/core/framework';
|
|
2
|
+
import { PhysicsWorld2D } from './physics-world-2d.js';
|
|
3
|
+
import { Physics2DSettings } from './physics-2d-settings.js';
|
|
4
|
+
export declare class PhysicsWorld2DSceneComponent extends CycloComponent {
|
|
5
|
+
get debug(): boolean;
|
|
6
|
+
set debug(v: boolean);
|
|
7
|
+
get settings(): Physics2DSettings | null;
|
|
8
|
+
set settings(value: Physics2DSettings | null);
|
|
9
|
+
protected onAwake(): void;
|
|
10
|
+
protected onDestroy(): void;
|
|
11
|
+
protected onUpdate(deltaTime: number): void;
|
|
12
|
+
get physicsWorld(): PhysicsWorld2D | null;
|
|
13
|
+
private _physicsWorld;
|
|
14
|
+
private _physicsDebugger;
|
|
15
|
+
private _lastUpdateFrame;
|
|
16
|
+
private _debug;
|
|
17
|
+
private _settings;
|
|
18
|
+
private _updateFrame;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=physics-world-2d-scene-component.d.ts.map
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { EDITOR_NOT_IN_PREVIEW } from 'cc/env';
|
|
8
|
+
import { editable, executionOrder, idem, serializable } from '@cyclonium/core/legacy-decorator';
|
|
9
|
+
import { CycloComponent } from '@cyclonium/core/framework';
|
|
10
|
+
import { PhysicsWorld2D } from './physics-world-2d.js';
|
|
11
|
+
import { Physics2DDebugger } from '#physics-2d-debugger';
|
|
12
|
+
import { PredefinedExecutionOrder } from '@cyclonium/core/framework';
|
|
13
|
+
import { director } from 'cc';
|
|
14
|
+
import { cycloBuiltinClass } from '@cyclonium/core/internal';
|
|
15
|
+
import { Physics2DSettings } from './physics-2d-settings.js';
|
|
16
|
+
let PhysicsWorld2DSceneComponent = class PhysicsWorld2DSceneComponent extends CycloComponent {
|
|
17
|
+
get debug() {
|
|
18
|
+
return this._debug;
|
|
19
|
+
}
|
|
20
|
+
set debug(v) {
|
|
21
|
+
this._debug = v;
|
|
22
|
+
if (this._physicsDebugger) {
|
|
23
|
+
this._physicsDebugger.destroy();
|
|
24
|
+
this._physicsDebugger = undefined;
|
|
25
|
+
}
|
|
26
|
+
if (v && this._physicsWorld) {
|
|
27
|
+
this._physicsDebugger = new Physics2DDebugger(this._physicsWorld.impl, this.node.scene);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
get settings() {
|
|
31
|
+
return this._settings;
|
|
32
|
+
}
|
|
33
|
+
set settings(value) {
|
|
34
|
+
this._settings = value;
|
|
35
|
+
}
|
|
36
|
+
onAwake() {
|
|
37
|
+
if (!EDITOR_NOT_IN_PREVIEW) {
|
|
38
|
+
const settings = this._settings ?? new Physics2DSettings();
|
|
39
|
+
this._physicsWorld = new PhysicsWorld2D({
|
|
40
|
+
scene: this.node.scene,
|
|
41
|
+
tags: settings.tags,
|
|
42
|
+
collisionMatrix: settings.collisionMatrix,
|
|
43
|
+
solverMatrix: settings.collisionMatrix,
|
|
44
|
+
});
|
|
45
|
+
if (this._debug) {
|
|
46
|
+
this._physicsDebugger = new Physics2DDebugger(this._physicsWorld.impl, this.node.scene);
|
|
47
|
+
}
|
|
48
|
+
// addFrameTask({
|
|
49
|
+
// fn: this._updateFrame,
|
|
50
|
+
// thisArg: this,
|
|
51
|
+
// priority: TaskPriority.after(TaskPriority.predefined.componentsLateUpdate),
|
|
52
|
+
// });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
onDestroy() {
|
|
56
|
+
if (!EDITOR_NOT_IN_PREVIEW) {
|
|
57
|
+
this._physicsDebugger?.destroy();
|
|
58
|
+
this._physicsDebugger = undefined;
|
|
59
|
+
this._physicsWorld?.destroy();
|
|
60
|
+
this._physicsWorld = null;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
onUpdate(deltaTime) {
|
|
64
|
+
this._updateFrame(deltaTime);
|
|
65
|
+
}
|
|
66
|
+
get physicsWorld() {
|
|
67
|
+
return this._physicsWorld;
|
|
68
|
+
}
|
|
69
|
+
_physicsWorld = null;
|
|
70
|
+
_physicsDebugger = undefined;
|
|
71
|
+
_lastUpdateFrame = -1;
|
|
72
|
+
_debug = false;
|
|
73
|
+
_settings = null;
|
|
74
|
+
_updateFrame(_deltaTime) {
|
|
75
|
+
const world = this._physicsWorld;
|
|
76
|
+
if (!world) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const syncedFrame = ++this._lastUpdateFrame;
|
|
80
|
+
const actualFrame = director.getTotalFrames();
|
|
81
|
+
if (syncedFrame !== actualFrame) {
|
|
82
|
+
this._lastUpdateFrame = actualFrame;
|
|
83
|
+
world.setOutdated();
|
|
84
|
+
}
|
|
85
|
+
world.step(1 / 60);
|
|
86
|
+
this._physicsDebugger?.render();
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
__decorate([
|
|
90
|
+
editable,
|
|
91
|
+
idem
|
|
92
|
+
], PhysicsWorld2DSceneComponent.prototype, "debug", null);
|
|
93
|
+
__decorate([
|
|
94
|
+
editable(Physics2DSettings)
|
|
95
|
+
], PhysicsWorld2DSceneComponent.prototype, "settings", null);
|
|
96
|
+
__decorate([
|
|
97
|
+
serializable
|
|
98
|
+
], PhysicsWorld2DSceneComponent.prototype, "_debug", void 0);
|
|
99
|
+
__decorate([
|
|
100
|
+
serializable
|
|
101
|
+
], PhysicsWorld2DSceneComponent.prototype, "_settings", void 0);
|
|
102
|
+
PhysicsWorld2DSceneComponent = __decorate([
|
|
103
|
+
cycloBuiltinClass('PhysicsWorld2DSceneComponent'),
|
|
104
|
+
executionOrder(PredefinedExecutionOrder.physics)
|
|
105
|
+
], PhysicsWorld2DSceneComponent);
|
|
106
|
+
export { PhysicsWorld2DSceneComponent };
|
|
107
|
+
//# sourceMappingURL=physics-world-2d-scene-component.js.map
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Scene } from 'cc';
|
|
2
|
+
import type { Collider2D } from './collider-2d.js';
|
|
3
|
+
import { CollisionMatrix } from './collision-matrix.js';
|
|
4
|
+
import { px2Impl } from './px2-impl.js';
|
|
5
|
+
import { RigidBody2D } from './rigid-body-2d.js';
|
|
6
|
+
import { Vec2 } from '@cyclonium/core/math/vec2';
|
|
7
|
+
import { Ray2D } from '@cyclonium/core/math/ray';
|
|
8
|
+
import { ColliderShapeCastHit, RayColliderIntersection, type SceneQueryFilter, type ShapeCastQueryOptions } from './scene-query.js';
|
|
9
|
+
export declare class RaycastResult {
|
|
10
|
+
constructor(ray: Ray2D, collider: Collider2D, distance: number);
|
|
11
|
+
get collider(): Collider2D;
|
|
12
|
+
get distance(): number;
|
|
13
|
+
get position(): Vec2;
|
|
14
|
+
private _ray;
|
|
15
|
+
private _collider;
|
|
16
|
+
private _distance;
|
|
17
|
+
}
|
|
18
|
+
export interface CircleShapeDesc {
|
|
19
|
+
radius: number;
|
|
20
|
+
}
|
|
21
|
+
export interface CapsuleShapeDesc {
|
|
22
|
+
halfHeight: number;
|
|
23
|
+
radius: number;
|
|
24
|
+
}
|
|
25
|
+
export interface RectShapeDesc {
|
|
26
|
+
halfExtents: Vec2;
|
|
27
|
+
}
|
|
28
|
+
export interface ShapeTransformDesc {
|
|
29
|
+
position: Vec2;
|
|
30
|
+
rotation?: number;
|
|
31
|
+
}
|
|
32
|
+
export declare class PhysicsWorld2D {
|
|
33
|
+
static of(scene: Scene): PhysicsWorld2D;
|
|
34
|
+
static ofUndefined(scene: Scene): PhysicsWorld2D | undefined;
|
|
35
|
+
constructor({ scene, tags, collisionMatrix, solverMatrix, }: {
|
|
36
|
+
scene: Scene;
|
|
37
|
+
tags: Record<string, number>;
|
|
38
|
+
collisionMatrix: CollisionMatrix;
|
|
39
|
+
solverMatrix: CollisionMatrix;
|
|
40
|
+
});
|
|
41
|
+
get listenersOnWillDestroy(): import("@cyclonium/event").EventListenerRegistry<[]>;
|
|
42
|
+
get impl(): px2Impl.World;
|
|
43
|
+
destroy(): void;
|
|
44
|
+
step(_deltaTime: number): void;
|
|
45
|
+
setOutdated(): void;
|
|
46
|
+
getTagId(tag: string): number;
|
|
47
|
+
intersectionWithPoint(point: Vec2, filter: SceneQueryFilter): Generator<Collider2D, void, unknown>;
|
|
48
|
+
intersectionWithCollider(collider: Collider2D, filter: SceneQueryFilter): Generator<Collider2D, void, unknown>;
|
|
49
|
+
intersectWithCircle(center: Vec2, radius: number, filter: SceneQueryFilter, rotation?: number): Generator<Collider2D, void, unknown>;
|
|
50
|
+
intersectWithBox(center: Vec2, halfExtents: Vec2, filter: SceneQueryFilter, rotation?: number): Generator<Collider2D, void, unknown>;
|
|
51
|
+
/**
|
|
52
|
+
* Finds colliders overlapping a capsule shape.
|
|
53
|
+
*/
|
|
54
|
+
intersectWithCapsule(capsule: CapsuleShapeDesc & ShapeTransformDesc, filter: SceneQueryFilter): Generator<Collider2D, void, unknown>;
|
|
55
|
+
intersectWithRay(ray: Ray2D, maxDistance: number, filter: SceneQueryFilter): Generator<RayColliderIntersection, void, unknown>;
|
|
56
|
+
castRay(ray: Ray2D, maxDistance: number, filter: SceneQueryFilter): RaycastResult | undefined;
|
|
57
|
+
castCircle(circle: CircleShapeDesc & ShapeTransformDesc, opts: ShapeCastQueryOptions): ColliderShapeCastHit | undefined;
|
|
58
|
+
castRect(rect: RectShapeDesc & ShapeTransformDesc, opts: ShapeCastQueryOptions): ColliderShapeCastHit | undefined;
|
|
59
|
+
castCapsule(capsule: CapsuleShapeDesc & ShapeTransformDesc, opts: ShapeCastQueryOptions): ColliderShapeCastHit | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Pushes current scene graph transforms to the physics backend without stepping simulation.
|
|
62
|
+
*/
|
|
63
|
+
syncTransforms(): void;
|
|
64
|
+
_createRigidBody(component: RigidBody2D, desc: px2Impl.RigidBodyDesc): RigidBody2DControlBlock;
|
|
65
|
+
_removeRigidBody(impl: px2Impl.RigidBody): void;
|
|
66
|
+
_addColliderHandle(component: Collider2D): Collider2DHandle;
|
|
67
|
+
_getCollider(impl: px2Impl.Collider): Collider2D | undefined;
|
|
68
|
+
getColliderWithWarn_internal(impl: px2Impl.Collider): Collider2D | undefined;
|
|
69
|
+
private _tags;
|
|
70
|
+
private _collisionMatrix;
|
|
71
|
+
private _solverMatrix;
|
|
72
|
+
private _worldImpl;
|
|
73
|
+
private _eventQueue;
|
|
74
|
+
private _linkManager;
|
|
75
|
+
private _rigidBodies;
|
|
76
|
+
private _colliders;
|
|
77
|
+
private _collisionRecords;
|
|
78
|
+
private _physicsComponents;
|
|
79
|
+
private _outDated;
|
|
80
|
+
private _emitterForWillDestroy;
|
|
81
|
+
private _getTagBit;
|
|
82
|
+
private _createImplCollider;
|
|
83
|
+
private _removeImplCollider;
|
|
84
|
+
private _emitEvents;
|
|
85
|
+
private _emitCollisionEvent;
|
|
86
|
+
private _intersectWithShape;
|
|
87
|
+
private _castShape;
|
|
88
|
+
}
|
|
89
|
+
export interface RigidBody2DControlBlock {
|
|
90
|
+
impl: px2Impl.RigidBody;
|
|
91
|
+
enableCollisionEvents(value: boolean): void;
|
|
92
|
+
setTags(tags: string[]): void;
|
|
93
|
+
setActiveCollisionTypes(collisionTypeFilter: number): void;
|
|
94
|
+
}
|
|
95
|
+
export interface Collider2DHandle {
|
|
96
|
+
component: Collider2D;
|
|
97
|
+
destroy(wakeUp: boolean): void;
|
|
98
|
+
attachedRigidBody: RigidBody2D | null;
|
|
99
|
+
impl: px2Impl.Collider | null;
|
|
100
|
+
createCollider(desc: px2Impl.ColliderDesc): px2Impl.Collider;
|
|
101
|
+
removeCollider(wakeUp: boolean): void;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=physics-world-2d.d.ts.map
|