@galacean/engine-physics-lite 1.5.0-alpha.0 → 1.5.0-alpha.2
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/browser.js +87 -20
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +87 -20
- package/dist/main.js.map +1 -1
- package/dist/module.js +87 -20
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/LiteCollider.d.ts +8 -2
- package/types/LiteDynamicCollider.d.ts +2 -1
- package/types/LitePhysics.d.ts +19 -1
- package/types/LitePhysicsScene.d.ts +15 -8
- package/types/LiteStaticCollider.d.ts +2 -1
package/types/LiteCollider.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ICollider } from "@galacean/engine-design";
|
|
2
|
-
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
2
|
+
import { Layer, Quaternion, Vector3 } from "@galacean/engine";
|
|
3
3
|
import { LiteColliderShape } from "./shape/LiteColliderShape";
|
|
4
|
+
import { LitePhysics } from "./LitePhysics";
|
|
4
5
|
/**
|
|
5
6
|
* Abstract class of physical collider.
|
|
6
7
|
*/
|
|
7
8
|
export declare abstract class LiteCollider implements ICollider {
|
|
8
|
-
|
|
9
|
+
private _litePhysics;
|
|
10
|
+
protected constructor(litePhysics: LitePhysics);
|
|
9
11
|
/**
|
|
10
12
|
* {@inheritDoc ICollider.addShape }
|
|
11
13
|
*/
|
|
@@ -22,6 +24,10 @@ export declare abstract class LiteCollider implements ICollider {
|
|
|
22
24
|
* {@inheritDoc ICollider.getWorldTransform }
|
|
23
25
|
*/
|
|
24
26
|
getWorldTransform(outPosition: Vector3, outRotation: Quaternion): void;
|
|
27
|
+
/**
|
|
28
|
+
* {@inheritDoc ICollider.setCollisionLayer }
|
|
29
|
+
*/
|
|
30
|
+
setCollisionLayer(collisionLayer: Layer): void;
|
|
25
31
|
/**
|
|
26
32
|
* {@inheritDoc ICollider.destroy }
|
|
27
33
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { LiteCollider } from "./LiteCollider";
|
|
2
2
|
import { IDynamicCollider } from "@galacean/engine-design";
|
|
3
3
|
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
4
|
+
import { LitePhysics } from "./LitePhysics";
|
|
4
5
|
/**
|
|
5
6
|
* A dynamic collider can act with self-defined movement or physical force
|
|
6
7
|
*/
|
|
@@ -10,7 +11,7 @@ export declare class LiteDynamicCollider extends LiteCollider implements IDynami
|
|
|
10
11
|
* @param position - The global position
|
|
11
12
|
* @param rotation - The global rotation
|
|
12
13
|
*/
|
|
13
|
-
constructor(position: Vector3, rotation: Quaternion);
|
|
14
|
+
constructor(litePhysics: LitePhysics, position: Vector3, rotation: Quaternion);
|
|
14
15
|
/**
|
|
15
16
|
* {@inheritDoc IDynamicCollider.getInertiaTensor }
|
|
16
17
|
*/
|
package/types/LitePhysics.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
1
|
+
import { Quaternion, Vector3, Layer } from "@galacean/engine";
|
|
2
2
|
import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, ICollision, IDynamicCollider, IFixedJoint, IHingeJoint, 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";
|
|
6
6
|
import { LitePhysicsManager } from "./LitePhysicsManager";
|
|
7
7
|
export declare class LitePhysics implements IPhysics {
|
|
8
|
+
private _layerCollisionMatrix;
|
|
8
9
|
/**
|
|
9
10
|
* {@inheritDoc IPhysics.initialize }
|
|
10
11
|
*/
|
|
@@ -61,4 +62,21 @@ export declare class LitePhysics implements IPhysics {
|
|
|
61
62
|
* {@inheritDoc IPhysics.createSpringJoint }
|
|
62
63
|
*/
|
|
63
64
|
createSpringJoint(collider: LiteCollider): ISpringJoint;
|
|
65
|
+
/**
|
|
66
|
+
* {@inheritDoc IPhysics.setColliderLayer }
|
|
67
|
+
*/
|
|
68
|
+
setColliderLayer(collider: LiteCollider, layer: Layer): void;
|
|
69
|
+
/**
|
|
70
|
+
* {@inheritDoc IPhysics.getColliderLayerCollision }
|
|
71
|
+
*/
|
|
72
|
+
getColliderLayerCollision(layer1: number, layer2: number): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* {@inheritDoc IPhysics.setColliderLayerCollision }
|
|
75
|
+
*/
|
|
76
|
+
setColliderLayerCollision(layer1: number, layer2: number, collide: boolean): void;
|
|
77
|
+
/**
|
|
78
|
+
* {@inheritDoc IPhysics.destroy }
|
|
79
|
+
*/
|
|
80
|
+
destroy(): void;
|
|
81
|
+
private _getColliderLayerIndex;
|
|
64
82
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Ray, Vector3 } from "@galacean/engine";
|
|
2
2
|
import { ICharacterController, ICollision, IPhysicsScene } from "@galacean/engine-design";
|
|
3
3
|
import { LiteCollider } from "./LiteCollider";
|
|
4
|
+
import { LitePhysics } from "./LitePhysics";
|
|
4
5
|
/**
|
|
5
6
|
* A manager is a collection of colliders and constraints which can interact.
|
|
6
7
|
*/
|
|
@@ -22,35 +23,40 @@ export declare class LitePhysicsScene implements IPhysicsScene {
|
|
|
22
23
|
private _currentEvents;
|
|
23
24
|
private _eventMap;
|
|
24
25
|
private _eventPool;
|
|
25
|
-
|
|
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);
|
|
26
28
|
/**
|
|
27
|
-
* {@inheritDoc
|
|
29
|
+
* {@inheritDoc IPhysicsScene.setGravity }
|
|
28
30
|
*/
|
|
29
31
|
setGravity(value: Vector3): void;
|
|
30
32
|
/**
|
|
31
|
-
* {@inheritDoc
|
|
33
|
+
* {@inheritDoc IPhysicsScene.addCollider }
|
|
32
34
|
*/
|
|
33
35
|
addCollider(actor: LiteCollider): void;
|
|
34
36
|
/**
|
|
35
|
-
* {@inheritDoc
|
|
37
|
+
* {@inheritDoc IPhysicsScene.removeCollider }
|
|
36
38
|
*/
|
|
37
39
|
removeCollider(collider: LiteCollider): void;
|
|
38
40
|
/**
|
|
39
|
-
* {@inheritDoc
|
|
41
|
+
* {@inheritDoc IPhysicsScene.update }
|
|
40
42
|
*/
|
|
41
43
|
update(deltaTime: number): void;
|
|
42
44
|
/**
|
|
43
|
-
* {@inheritDoc
|
|
45
|
+
* {@inheritDoc IPhysicsScene.raycast }
|
|
44
46
|
*/
|
|
45
47
|
raycast(ray: Ray, distance: number, onRaycast: (obj: number) => boolean, hit?: (shapeUniqueID: number, distance: number, position: Vector3, normal: Vector3) => void): boolean;
|
|
46
48
|
/**
|
|
47
|
-
* {@inheritDoc
|
|
49
|
+
* {@inheritDoc IPhysicsScene.addCharacterController }
|
|
48
50
|
*/
|
|
49
51
|
addCharacterController(characterController: ICharacterController): void;
|
|
50
52
|
/**
|
|
51
|
-
* {@inheritDoc
|
|
53
|
+
* {@inheritDoc IPhysicsScene.removeCharacterController }
|
|
52
54
|
*/
|
|
53
55
|
removeCharacterController(characterController: ICharacterController): void;
|
|
56
|
+
/**
|
|
57
|
+
* {@inheritDoc IPhysicsScene.destroy }
|
|
58
|
+
*/
|
|
59
|
+
destroy(): void;
|
|
54
60
|
/**
|
|
55
61
|
* Calculate the bounding box in world space from boxCollider.
|
|
56
62
|
* @param boxCollider - The boxCollider to calculate
|
|
@@ -69,4 +75,5 @@ export declare class LitePhysicsScene implements IPhysicsScene {
|
|
|
69
75
|
private _boxCollision;
|
|
70
76
|
private _sphereCollision;
|
|
71
77
|
private _raycast;
|
|
78
|
+
private _checkColliderCollide;
|
|
72
79
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IStaticCollider } from "@galacean/engine-design";
|
|
2
2
|
import { LiteCollider } from "./LiteCollider";
|
|
3
3
|
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
4
|
+
import { LitePhysics } from "./LitePhysics";
|
|
4
5
|
/**
|
|
5
6
|
* A static collider component that will not move.
|
|
6
7
|
* @remarks Mostly used for object which always stays at the same place and never moves around.
|
|
@@ -11,5 +12,5 @@ export declare class LiteStaticCollider extends LiteCollider implements IStaticC
|
|
|
11
12
|
* @param position - The global position
|
|
12
13
|
* @param rotation - The global rotation
|
|
13
14
|
*/
|
|
14
|
-
constructor(position: Vector3, rotation: Quaternion);
|
|
15
|
+
constructor(litePhysics: LitePhysics, position: Vector3, rotation: Quaternion);
|
|
15
16
|
}
|