@galacean/engine-physics-lite 2.0.0-alpha.2 → 2.0.0-alpha.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@galacean/engine-physics-lite",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.21",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -25,11 +25,11 @@
25
25
  "types/**/*"
26
26
  ],
27
27
  "devDependencies": {
28
- "@galacean/engine-design": "2.0.0-alpha.2",
29
- "@galacean/engine": "2.0.0-alpha.2"
28
+ "@galacean/engine-design": "2.0.0-alpha.21",
29
+ "@galacean/engine": "2.0.0-alpha.21"
30
30
  },
31
31
  "peerDependencies": {
32
- "@galacean/engine": "2.0.0-alpha.2"
32
+ "@galacean/engine": "2.0.0-alpha.21"
33
33
  },
34
34
  "scripts": {
35
35
  "b:types": "tsc"
@@ -1,5 +1,5 @@
1
1
  import { Quaternion, Vector3, Layer } from "@galacean/engine";
2
- import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, ICollision, IDynamicCollider, IFixedJoint, IHingeJoint, IMeshColliderShape, IPhysics, IPhysicsManager, IPhysicsMaterial, IPlaneColliderShape, ISphereColliderShape, ISpringJoint, IStaticCollider } from "@galacean/engine-design";
2
+ import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, IDynamicCollider, IFixedJoint, IHingeJoint, IMeshColliderShape, IPhysics, IPhysicsManager, IPhysicsMaterial, IPlaneColliderShape, ISphereColliderShape, ISpringJoint, IStaticCollider } from "@galacean/engine-design";
3
3
  import { LiteCollider } from "./LiteCollider";
4
4
  import { LitePhysicsMaterial } from "./LitePhysicsMaterial";
5
5
  import { LitePhysicsScene } from "./LitePhysicsScene";
@@ -17,7 +17,7 @@ export declare class LitePhysics implements IPhysics {
17
17
  /**
18
18
  * {@inheritDoc IPhysics.createPhysicsScene }
19
19
  */
20
- createPhysicsScene(physicsManager: LitePhysicsManager, onContactBegin?: (collision: ICollision) => void, onContactEnd?: (collision: ICollision) => void, onContactPersist?: (collision: ICollision) => void, onTriggerBegin?: (obj1: number, obj2: number) => void, onTriggerEnd?: (obj1: number, obj2: number) => void, onTriggerPersist?: (obj1: number, obj2: number) => void): LitePhysicsScene;
20
+ createPhysicsScene(physicsManager: LitePhysicsManager): LitePhysicsScene;
21
21
  /**
22
22
  * {@inheritDoc IPhysics.createStaticCollider }
23
23
  */
@@ -53,7 +53,7 @@ export declare class LitePhysics implements IPhysics {
53
53
  /**
54
54
  * {@inheritDoc IPhysics.createMeshColliderShape }
55
55
  */
56
- createMeshColliderShape(uniqueID: number, vertices: Float32Array, vertexCount: number, indices: Uint16Array | Uint32Array | null, isConvex: boolean, material: LitePhysicsMaterial): IMeshColliderShape;
56
+ createMeshColliderShape(uniqueID: number, positions: Vector3[], indices: Uint8Array | Uint16Array | Uint32Array | null, isConvex: boolean, material: LitePhysicsMaterial, cookingFlags: number): IMeshColliderShape | null;
57
57
  /**
58
58
  * {@inheritDoc IPhysics.createFixedJoint }
59
59
  */
@@ -1,5 +1,5 @@
1
1
  import { Quaternion, Ray, Vector3 } from "@galacean/engine";
2
- import { ICharacterController, ICollision, IPhysicsScene } from "@galacean/engine-design";
2
+ import { ICharacterController, IPhysicsScene, IPhysicsEvents } from "@galacean/engine-design";
3
3
  import { LiteCollider } from "./LiteCollider";
4
4
  import { LitePhysics } from "./LitePhysics";
5
5
  /**
@@ -10,21 +10,17 @@ export declare class LitePhysicsScene implements IPhysicsScene {
10
10
  private static _tempBox;
11
11
  private static _currentHit;
12
12
  private static _hitResult;
13
- private readonly _onContactEnter?;
14
- private readonly _onContactExit?;
15
- private readonly _onContactStay?;
16
- private readonly _onTriggerEnter?;
17
- private readonly _onTriggerExit?;
18
- private readonly _onTriggerStay?;
19
13
  private _staticColliders;
20
14
  private _dynamicColliders;
21
15
  private _sphere;
22
16
  private _box;
23
- private _currentEvents;
17
+ private _activeTriggers;
24
18
  private _eventMap;
25
- private _eventPool;
19
+ private _triggerEventPool;
20
+ private _triggerEvents;
21
+ private _physicsEvents;
26
22
  private _physics;
27
- constructor(physics: LitePhysics, onContactEnter?: (collision: ICollision) => void, onContactExit?: (collision: ICollision) => void, onContactStay?: (collision: ICollision) => void, onTriggerEnter?: (obj1: number, obj2: number) => void, onTriggerExit?: (obj1: number, obj2: number) => void, onTriggerStay?: (obj1: number, obj2: number) => void);
23
+ constructor(physics: LitePhysics);
28
24
  overlapBox(center: Vector3, orientation: Quaternion, halfExtents: Vector3, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
29
25
  overlapSphere(center: Vector3, radius: number, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
30
26
  overlapCapsule(center: Vector3, radius: number, height: number, orientation: Quaternion, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
@@ -44,6 +40,10 @@ export declare class LitePhysicsScene implements IPhysicsScene {
44
40
  * {@inheritDoc IPhysicsScene.update }
45
41
  */
46
42
  update(deltaTime: number): void;
43
+ /**
44
+ * {@inheritDoc IPhysicsScene.updateEvents }
45
+ */
46
+ updateEvents(): IPhysicsEvents;
47
47
  /**
48
48
  * {@inheritDoc IPhysicsScene.raycast }
49
49
  */
@@ -80,6 +80,10 @@ export declare class LitePhysicsScene implements IPhysicsScene {
80
80
  * {@inheritDoc IPhysicsScene.overlapCapsuleAll }
81
81
  */
82
82
  overlapCapsuleAll(center: Vector3, radius: number, height: number, orientation: Quaternion, onOverlap: (obj: number) => boolean): number[];
83
+ /**
84
+ * {@inheritDoc IPhysicsScene.gc }
85
+ */
86
+ gc(): void;
83
87
  /**
84
88
  * {@inheritDoc IPhysicsScene.destroy }
85
89
  */
@@ -98,7 +102,6 @@ export declare class LitePhysicsScene implements IPhysicsScene {
98
102
  private static _upWorldSphere;
99
103
  private _getTrigger;
100
104
  private _collisionDetection;
101
- private _fireEvent;
102
105
  private _boxCollision;
103
106
  private _sphereCollision;
104
107
  private _raycast;