@galacean/engine-physics-lite 1.6.6 → 1.6.8

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.
@@ -1,106 +0,0 @@
1
- import { Quaternion, Ray, Vector3 } from "@galacean/engine";
2
- import { ICharacterController, ICollision, IPhysicsScene } from "@galacean/engine-design";
3
- import { LiteCollider } from "./LiteCollider";
4
- import { LitePhysics } from "./LitePhysics";
5
- /**
6
- * A manager is a collection of colliders and constraints which can interact.
7
- */
8
- export declare class LitePhysicsScene implements IPhysicsScene {
9
- private static _tempSphere;
10
- private static _tempBox;
11
- private static _currentHit;
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
- private _staticColliders;
20
- private _dynamicColliders;
21
- private _sphere;
22
- private _box;
23
- private _currentEvents;
24
- private _eventMap;
25
- private _eventPool;
26
- 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);
28
- overlapBox(center: Vector3, orientation: Quaternion, halfExtents: Vector3, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
29
- overlapSphere(center: Vector3, radius: number, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
30
- overlapCapsule(center: Vector3, radius: number, height: number, orientation: Quaternion, onOverlap: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number) => void): boolean;
31
- /**
32
- * {@inheritDoc IPhysicsScene.setGravity }
33
- */
34
- setGravity(value: Vector3): void;
35
- /**
36
- * {@inheritDoc IPhysicsScene.addCollider }
37
- */
38
- addCollider(actor: LiteCollider): void;
39
- /**
40
- * {@inheritDoc IPhysicsScene.removeCollider }
41
- */
42
- removeCollider(collider: LiteCollider): void;
43
- /**
44
- * {@inheritDoc IPhysicsScene.update }
45
- */
46
- update(deltaTime: number): void;
47
- /**
48
- * {@inheritDoc IPhysicsScene.raycast }
49
- */
50
- raycast(ray: Ray, distance: number, onRaycast: (obj: number) => boolean, hit?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
51
- /**
52
- * {@inheritDoc IPhysicsScene.addCharacterController }
53
- */
54
- addCharacterController(characterController: ICharacterController): void;
55
- /**
56
- * {@inheritDoc IPhysicsScene.removeCharacterController }
57
- */
58
- removeCharacterController(characterController: ICharacterController): void;
59
- /**
60
- * {@inheritDoc IPhysicsScene.boxCast }
61
- */
62
- boxCast(center: Vector3, orientation: Quaternion, halfExtents: Vector3, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
63
- /**
64
- * {@inheritDoc IPhysicsScene.sphereCast }
65
- */
66
- sphereCast(center: Vector3, radius: number, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
67
- /**
68
- * {@inheritDoc IPhysicsScene.capsuleCast }
69
- */
70
- capsuleCast(center: Vector3, radius: number, height: number, orientation: Quaternion, direction: Vector3, distance: number, onSweep: (obj: number) => boolean, outHitResult?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
71
- /**
72
- * {@inheritDoc IPhysicsScene.overlapBoxAll }
73
- */
74
- overlapBoxAll(center: Vector3, orientation: Quaternion, halfExtents: Vector3, onOverlap: (obj: number) => boolean): number[];
75
- /**
76
- * {@inheritDoc IPhysicsScene.overlapSphereAll }
77
- */
78
- overlapSphereAll(center: Vector3, radius: number, onOverlap: (obj: number) => boolean): number[];
79
- /**
80
- * {@inheritDoc IPhysicsScene.overlapCapsuleAll }
81
- */
82
- overlapCapsuleAll(center: Vector3, radius: number, height: number, orientation: Quaternion, onOverlap: (obj: number) => boolean): number[];
83
- /**
84
- * {@inheritDoc IPhysicsScene.destroy }
85
- */
86
- destroy(): void;
87
- /**
88
- * Calculate the bounding box in world space from boxCollider.
89
- * @param boxCollider - The boxCollider to calculate
90
- * @param out - The calculated boundingBox
91
- */
92
- private static _updateWorldBox;
93
- /**
94
- * Get the sphere info of the given sphere collider in world space.
95
- * @param sphereCollider - The given sphere collider
96
- * @param out - The calculated boundingSphere
97
- */
98
- private static _upWorldSphere;
99
- private _getTrigger;
100
- private _collisionDetection;
101
- private _fireEvent;
102
- private _boxCollision;
103
- private _sphereCollision;
104
- private _raycast;
105
- private _checkColliderCollide;
106
- }
@@ -1,16 +0,0 @@
1
- import { IStaticCollider } from "@galacean/engine-design";
2
- import { LiteCollider } from "./LiteCollider";
3
- import { Quaternion, Vector3 } from "@galacean/engine";
4
- import { LitePhysics } from "./LitePhysics";
5
- /**
6
- * A static collider component that will not move.
7
- * @remarks Mostly used for object which always stays at the same place and never moves around.
8
- */
9
- export declare class LiteStaticCollider extends LiteCollider implements IStaticCollider {
10
- /**
11
- * Initialize static actor.
12
- * @param position - The global position
13
- * @param rotation - The global rotation
14
- */
15
- constructor(litePhysics: LitePhysics, position: Vector3, rotation: Quaternion);
16
- }
@@ -1,118 +0,0 @@
1
- import { Matrix, Quaternion, Vector3 } from "@galacean/engine";
2
- import { LiteCollider } from "./LiteCollider";
3
- import { LiteUpdateFlag } from "./LiteUpdateFlag";
4
- import { LiteColliderShape } from "./shape/LiteColliderShape";
5
- /**
6
- * Used to implement transformation related functions.
7
- */
8
- export declare class LiteTransform {
9
- private static _tempQuat0;
10
- private static _tempMat42;
11
- private _position;
12
- private _rotation;
13
- private _rotationQuaternion;
14
- private _scale;
15
- private _worldRotationQuaternion;
16
- private _localMatrix;
17
- private _worldMatrix;
18
- private _updateFlagManager;
19
- private _isParentDirty;
20
- private _parentTransformCache;
21
- private _dirtyFlag;
22
- private _owner;
23
- set owner(value: LiteColliderShape | LiteCollider);
24
- /**
25
- * Local position.
26
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
27
- */
28
- get position(): Vector3;
29
- set position(value: Vector3);
30
- /**
31
- * Local rotation, defining the rotation by using a unit quaternion.
32
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
33
- */
34
- get rotationQuaternion(): Quaternion;
35
- set rotationQuaternion(value: Quaternion);
36
- /**
37
- * World rotation, defining the rotation by using a unit quaternion.
38
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
39
- */
40
- get worldRotationQuaternion(): Quaternion;
41
- set worldRotationQuaternion(value: Quaternion);
42
- /**
43
- * Local scaling.
44
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
45
- */
46
- get scale(): Vector3;
47
- set scale(value: Vector3);
48
- /**
49
- * Local matrix.
50
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
51
- */
52
- get localMatrix(): Matrix;
53
- set localMatrix(value: Matrix);
54
- /**
55
- * World matrix.
56
- * @remarks Need to re-assign after modification to ensure that the modification takes effect.
57
- */
58
- get worldMatrix(): Matrix;
59
- set worldMatrix(value: Matrix);
60
- /**
61
- * Set local position by X, Y, Z value.
62
- * @param x - X coordinate
63
- * @param y - Y coordinate
64
- * @param z - Z coordinate
65
- */
66
- setPosition(x: number, y: number, z: number): void;
67
- /**
68
- * Set local rotation by the X, Y, Z, and W components of the quaternion.
69
- * @param x - X component of quaternion
70
- * @param y - Y component of quaternion
71
- * @param z - Z component of quaternion
72
- * @param w - W component of quaternion
73
- */
74
- setRotationQuaternion(x: number, y: number, z: number, w: number): void;
75
- /**
76
- * Set local scaling by scaling values along X, Y, Z axis.
77
- * @param x - Scaling along X axis
78
- * @param y - Scaling along Y axis
79
- * @param z - Scaling along Z axis
80
- */
81
- setScale(x: number, y: number, z: number): void;
82
- /**
83
- * Register world transform change flag.
84
- * @returns Change flag
85
- */
86
- registerWorldChangeFlag(): LiteUpdateFlag;
87
- /**
88
- * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
89
- * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
90
- * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
91
- */
92
- private _updateWorldPositionFlag;
93
- /**
94
- * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
95
- * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
96
- * Get worldRotationQuaternion: Will trigger the world rotation (in quaternion) update of itself and all parent entities.
97
- * Get worldRotation: Will trigger the world rotation(in euler and quaternion) update of itself and world rotation(in quaternion) update of all parent entities.
98
- * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix or worldRotationQuaternion) to be false.
99
- */
100
- private _updateWorldRotationFlag;
101
- /**
102
- * Get worldMatrix: Will trigger the worldMatrix update of itself and all parent entities.
103
- * Get worldPosition: Will trigger the worldMatrix, local position update of itself and the worldMatrix update of all parent entities.
104
- * Get worldScale: Will trigger the scaling update of itself and all parent entities.
105
- * In summary, any update of related variables will cause the dirty mark of one of the full process (worldMatrix) to be false.
106
- */
107
- private _updateWorldScaleFlag;
108
- /**
109
- * Update all world transform property dirty flag, the principle is the same as above.
110
- */
111
- private _updateAllWorldFlag;
112
- private _getParentTransform;
113
- private _isContainDirtyFlags;
114
- private _isContainDirtyFlag;
115
- private _setDirtyFlagTrue;
116
- private _setDirtyFlagFalse;
117
- private _worldAssociatedChange;
118
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * Used to update tags.
3
- */
4
- export declare class LiteUpdateFlag {
5
- private _flags;
6
- /** Flag. */
7
- flag: boolean;
8
- constructor(_flags?: LiteUpdateFlag[]);
9
- /**
10
- * Destroy.
11
- */
12
- destroy(): void;
13
- }
@@ -1 +0,0 @@
1
- export {};
package/types/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { LitePhysics } from "./LitePhysics";
2
- export declare const version = "__buildVersion";
@@ -1,38 +0,0 @@
1
- import { Vector3, Vector4 } from "@galacean/engine";
2
- import { IBoxColliderShape } from "@galacean/engine-design";
3
- import { LitePhysicsMaterial } from "../LitePhysicsMaterial";
4
- import { LiteColliderShape } from "./LiteColliderShape";
5
- /**
6
- * Box collider shape in Lite.
7
- */
8
- export declare class LiteBoxColliderShape extends LiteColliderShape implements IBoxColliderShape {
9
- private static _tempBox;
10
- private static _tempMatrix;
11
- private static _tempInvMatrix;
12
- private _halfSize;
13
- private _sizeScale;
14
- /**
15
- * Init Box Shape.
16
- * @param uniqueID - UniqueID mark Shape.
17
- * @param size - Size of Shape.
18
- * @param material - Material of PhysXCollider.
19
- */
20
- constructor(uniqueID: number, size: Vector3, material: LitePhysicsMaterial);
21
- /**
22
- * {@inheritDoc IColliderShape.setPosition }
23
- */
24
- setPosition(position: Vector3): void;
25
- /**
26
- * {@inheritDoc IColliderShape.setWorldScale }
27
- */
28
- setWorldScale(scale: Vector3): void;
29
- /**
30
- * {@inheritDoc IBoxColliderShape.setSize }
31
- */
32
- setSize(value: Vector3): void;
33
- /**
34
- * {@inheritDoc IColliderShape.pointDistance }
35
- */
36
- pointDistance(point: Vector3): Vector4;
37
- private _setBondingBox;
38
- }
@@ -1,56 +0,0 @@
1
- import { Quaternion, Ray, Vector3, Vector4 } from "@galacean/engine";
2
- import { IColliderShape, IPhysicsMaterial } from "@galacean/engine-design";
3
- import { LiteHitResult } from "../LiteHitResult";
4
- /**
5
- * Abstract class for collider shapes.
6
- */
7
- export declare abstract class LiteColliderShape implements IColliderShape {
8
- protected static _tempPos: Vector3;
9
- protected static _tempRot: Quaternion;
10
- protected static _tempScale: Vector3;
11
- protected static _tempPoint: Vector3;
12
- protected static _tempVector4: Vector4;
13
- private static _ray;
14
- private _rotation;
15
- protected constructor();
16
- /**
17
- * {@inheritDoc IColliderShape.setRotation }
18
- */
19
- setRotation(rotation: Vector3): void;
20
- /**
21
- * {@inheritDoc IColliderShape.setPosition }
22
- */
23
- setPosition(position: Vector3): void;
24
- /**
25
- * {@inheritDoc IColliderShape.setWorldScale }
26
- */
27
- setWorldScale(scale: Vector3): void;
28
- /**
29
- * {@inheritDoc IColliderShape.setContactOffset }
30
- */
31
- setContactOffset(offset: number): void;
32
- /**
33
- * {@inheritDoc IColliderShape.setMaterial }
34
- */
35
- setMaterial(material: IPhysicsMaterial): void;
36
- /**
37
- * {@inheritDoc IColliderShape.setUniqueID }
38
- */
39
- setUniqueID(id: number): void;
40
- /**
41
- * {@inheritDoc IColliderShape.setIsTrigger }
42
- */
43
- setIsTrigger(value: boolean): void;
44
- /**
45
- * {@inheritDoc IColliderShape.pointDistance }
46
- */
47
- abstract pointDistance(point: Vector3): Vector4;
48
- /**
49
- * {@inheritDoc IColliderShape.destroy }
50
- */
51
- destroy(): void;
52
- protected _updateHitResult(ray: Ray, rayDistance: number, outHit: LiteHitResult, origin: Vector3, isWorldRay?: boolean): void;
53
- protected _getLocalRay(ray: Ray): Ray;
54
- private _getInvModelMatrix;
55
- private _setLocalPose;
56
- }
@@ -1,32 +0,0 @@
1
- import { ISphereColliderShape } from "@galacean/engine-design";
2
- import { LiteColliderShape } from "./LiteColliderShape";
3
- import { Vector3, Vector4 } from "@galacean/engine";
4
- import { LitePhysicsMaterial } from "../LitePhysicsMaterial";
5
- /**
6
- * Sphere collider shape in Lite.
7
- */
8
- export declare class LiteSphereColliderShape extends LiteColliderShape implements ISphereColliderShape {
9
- private static _tempSphere;
10
- private _radius;
11
- private _maxScale;
12
- get worldRadius(): number;
13
- /**
14
- * Init sphere shape.
15
- * @param uniqueID - UniqueID mark collider
16
- * @param radius - Size of SphereCollider
17
- * @param material - Material of PhysXCollider
18
- */
19
- constructor(uniqueID: number, radius: number, material: LitePhysicsMaterial);
20
- /**
21
- * {@inheritDoc ISphereColliderShape.setRadius }
22
- */
23
- setRadius(value: number): void;
24
- /**
25
- * {@inheritDoc IColliderShape.setWorldScale }
26
- */
27
- setWorldScale(scale: Vector3): void;
28
- /**
29
- * {@inheritDoc IColliderShape.pointDistance }
30
- */
31
- pointDistance(point: Vector3): Vector4;
32
- }