@galacean/engine-physics-lite 1.4.0-alpha.0 → 1.4.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 +184 -51
- 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 +184 -51
- package/dist/main.js.map +1 -1
- package/dist/module.js +185 -52
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/LiteDynamicCollider.d.ts +40 -0
- package/types/LitePhysics.d.ts +2 -2
- package/types/LitePhysicsScene.d.ts +2 -11
- package/types/shape/LiteBoxColliderShape.d.ts +7 -1
- package/types/shape/LiteColliderShape.d.ts +11 -2
- package/types/shape/LiteSphereColliderShape.d.ts +5 -1
|
@@ -11,6 +11,18 @@ export declare class LiteDynamicCollider extends LiteCollider implements IDynami
|
|
|
11
11
|
* @param rotation - The global rotation
|
|
12
12
|
*/
|
|
13
13
|
constructor(position: Vector3, rotation: Quaternion);
|
|
14
|
+
/**
|
|
15
|
+
* {@inheritDoc IDynamicCollider.getInertiaTensor }
|
|
16
|
+
*/
|
|
17
|
+
getInertiaTensor(out: Vector3): Vector3;
|
|
18
|
+
/**
|
|
19
|
+
* {@inheritDoc IDynamicCollider.getCenterOfMass }
|
|
20
|
+
*/
|
|
21
|
+
getCenterOfMass(out: Vector3): Vector3;
|
|
22
|
+
/**
|
|
23
|
+
* {@inheritDoc IDynamicCollider.setMassAndUpdateInertia }
|
|
24
|
+
*/
|
|
25
|
+
setMassAndUpdateInertia(mass: number): void;
|
|
14
26
|
/**
|
|
15
27
|
* {@inheritDoc IDynamicCollider.addForce }
|
|
16
28
|
*/
|
|
@@ -27,10 +39,22 @@ export declare class LiteDynamicCollider extends LiteCollider implements IDynami
|
|
|
27
39
|
* {@inheritDoc IDynamicCollider.sleep }
|
|
28
40
|
*/
|
|
29
41
|
sleep(): void;
|
|
42
|
+
/**
|
|
43
|
+
* {@inheritDoc IDynamicCollider.isSleeping }
|
|
44
|
+
*/
|
|
45
|
+
isSleeping(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* {@inheritDoc IDynamicCollider.getAngularDamping }
|
|
48
|
+
*/
|
|
49
|
+
getAngularDamping(): number;
|
|
30
50
|
/**
|
|
31
51
|
* {@inheritDoc IDynamicCollider.setAngularDamping }
|
|
32
52
|
*/
|
|
33
53
|
setAngularDamping(value: number): void;
|
|
54
|
+
/**
|
|
55
|
+
* {@inheritDoc IDynamicCollider.getAngularVelocity }
|
|
56
|
+
*/
|
|
57
|
+
getAngularVelocity(out: Vector3): Vector3;
|
|
34
58
|
/**
|
|
35
59
|
* {@inheritDoc IDynamicCollider.setAngularVelocity }
|
|
36
60
|
*/
|
|
@@ -51,14 +75,26 @@ export declare class LiteDynamicCollider extends LiteCollider implements IDynami
|
|
|
51
75
|
* {@inheritDoc IDynamicCollider.setInertiaTensor }
|
|
52
76
|
*/
|
|
53
77
|
setInertiaTensor(value: Vector3): void;
|
|
78
|
+
/**
|
|
79
|
+
* {@inheritDoc IDynamicCollider.setUseGravity }
|
|
80
|
+
*/
|
|
81
|
+
setUseGravity(value: boolean): void;
|
|
54
82
|
/**
|
|
55
83
|
* {@inheritDoc IDynamicCollider.setIsKinematic }
|
|
56
84
|
*/
|
|
57
85
|
setIsKinematic(value: boolean): void;
|
|
86
|
+
/**
|
|
87
|
+
* {@inheritDoc IDynamicCollider.setLinearDamping }
|
|
88
|
+
*/
|
|
89
|
+
getLinearDamping(): number;
|
|
58
90
|
/**
|
|
59
91
|
* {@inheritDoc IDynamicCollider.setLinearDamping }
|
|
60
92
|
*/
|
|
61
93
|
setLinearDamping(value: number): void;
|
|
94
|
+
/**
|
|
95
|
+
* {@inheritDoc IDynamicCollider.getLinearVelocity }
|
|
96
|
+
*/
|
|
97
|
+
getLinearVelocity(out: Vector3): Vector3;
|
|
62
98
|
/**
|
|
63
99
|
* {@inheritDoc IDynamicCollider.setLinearVelocity }
|
|
64
100
|
*/
|
|
@@ -71,6 +107,10 @@ export declare class LiteDynamicCollider extends LiteCollider implements IDynami
|
|
|
71
107
|
* {@inheritDoc IDynamicCollider.setMaxAngularVelocity }
|
|
72
108
|
*/
|
|
73
109
|
setMaxAngularVelocity(value: number): void;
|
|
110
|
+
/**
|
|
111
|
+
* {@inheritDoc IDynamicCollider.setMaxDepenetrationVelocity }
|
|
112
|
+
*/
|
|
113
|
+
getMaxDepenetrationVelocity(): number;
|
|
74
114
|
/**
|
|
75
115
|
* {@inheritDoc IDynamicCollider.setMaxDepenetrationVelocity }
|
|
76
116
|
*/
|
package/types/LitePhysics.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Quaternion, Vector3 } from "@galacean/engine";
|
|
2
|
-
import { IBoxColliderShape, ICapsuleColliderShape, ICharacterController, IDynamicCollider, IFixedJoint, IHingeJoint, IPhysics, IPhysicsManager, IPhysicsMaterial, IPlaneColliderShape, ISphereColliderShape, ISpringJoint, IStaticCollider } from "@galacean/engine-design";
|
|
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";
|
|
@@ -16,7 +16,7 @@ export declare class LitePhysics implements IPhysics {
|
|
|
16
16
|
/**
|
|
17
17
|
* {@inheritDoc IPhysics.createPhysicsScene }
|
|
18
18
|
*/
|
|
19
|
-
createPhysicsScene(physicsManager: LitePhysicsManager, onContactBegin?: (
|
|
19
|
+
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
20
|
/**
|
|
21
21
|
* {@inheritDoc IPhysics.createStaticCollider }
|
|
22
22
|
*/
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Ray, Vector3 } from "@galacean/engine";
|
|
2
|
-
import { ICharacterController, IPhysicsScene } from "@galacean/engine-design";
|
|
2
|
+
import { ICharacterController, ICollision, IPhysicsScene } from "@galacean/engine-design";
|
|
3
3
|
import { LiteCollider } from "./LiteCollider";
|
|
4
|
-
import { LiteColliderShape } from "./shape/LiteColliderShape";
|
|
5
4
|
/**
|
|
6
5
|
* A manager is a collection of colliders and constraints which can interact.
|
|
7
6
|
*/
|
|
@@ -23,19 +22,11 @@ export declare class LitePhysicsScene implements IPhysicsScene {
|
|
|
23
22
|
private _currentEvents;
|
|
24
23
|
private _eventMap;
|
|
25
24
|
private _eventPool;
|
|
26
|
-
constructor(onContactEnter?: (
|
|
25
|
+
constructor(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);
|
|
27
26
|
/**
|
|
28
27
|
* {@inheritDoc IPhysicsManager.setGravity }
|
|
29
28
|
*/
|
|
30
29
|
setGravity(value: Vector3): void;
|
|
31
|
-
/**
|
|
32
|
-
* {@inheritDoc IPhysicsManager.addColliderShape }
|
|
33
|
-
*/
|
|
34
|
-
addColliderShape(colliderShape: LiteColliderShape): void;
|
|
35
|
-
/**
|
|
36
|
-
* {@inheritDoc IPhysicsManager.removeColliderShape }
|
|
37
|
-
*/
|
|
38
|
-
removeColliderShape(colliderShape: LiteColliderShape): void;
|
|
39
30
|
/**
|
|
40
31
|
* {@inheritDoc IPhysicsManager.addCollider }
|
|
41
32
|
*/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3 } from "@galacean/engine";
|
|
1
|
+
import { Vector3, Vector4 } from "@galacean/engine";
|
|
2
2
|
import { IBoxColliderShape } from "@galacean/engine-design";
|
|
3
3
|
import { LitePhysicsMaterial } from "../LitePhysicsMaterial";
|
|
4
4
|
import { LiteColliderShape } from "./LiteColliderShape";
|
|
@@ -7,6 +7,8 @@ import { LiteColliderShape } from "./LiteColliderShape";
|
|
|
7
7
|
*/
|
|
8
8
|
export declare class LiteBoxColliderShape extends LiteColliderShape implements IBoxColliderShape {
|
|
9
9
|
private static _tempBox;
|
|
10
|
+
private static _tempMatrix;
|
|
11
|
+
private static _tempInvMatrix;
|
|
10
12
|
private _halfSize;
|
|
11
13
|
private _sizeScale;
|
|
12
14
|
/**
|
|
@@ -28,5 +30,9 @@ export declare class LiteBoxColliderShape extends LiteColliderShape implements I
|
|
|
28
30
|
* {@inheritDoc IBoxColliderShape.setSize }
|
|
29
31
|
*/
|
|
30
32
|
setSize(value: Vector3): void;
|
|
33
|
+
/**
|
|
34
|
+
* {@inheritDoc IColliderShape.pointDistance }
|
|
35
|
+
*/
|
|
36
|
+
pointDistance(point: Vector3): Vector4;
|
|
31
37
|
private _setBondingBox;
|
|
32
38
|
}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
import { Ray, Vector3 } from "@galacean/engine";
|
|
1
|
+
import { Quaternion, Ray, Vector3, Vector4 } from "@galacean/engine";
|
|
2
2
|
import { IColliderShape, IPhysicsMaterial } from "@galacean/engine-design";
|
|
3
3
|
import { LiteHitResult } from "../LiteHitResult";
|
|
4
4
|
/**
|
|
5
5
|
* Abstract class for collider shapes.
|
|
6
6
|
*/
|
|
7
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;
|
|
8
13
|
private static _ray;
|
|
9
|
-
private
|
|
14
|
+
private _rotation;
|
|
10
15
|
protected constructor();
|
|
11
16
|
/**
|
|
12
17
|
* {@inheritDoc IColliderShape.setRotation }
|
|
@@ -36,6 +41,10 @@ export declare abstract class LiteColliderShape implements IColliderShape {
|
|
|
36
41
|
* {@inheritDoc IColliderShape.setIsTrigger }
|
|
37
42
|
*/
|
|
38
43
|
setIsTrigger(value: boolean): void;
|
|
44
|
+
/**
|
|
45
|
+
* {@inheritDoc IColliderShape.pointDistance }
|
|
46
|
+
*/
|
|
47
|
+
abstract pointDistance(point: Vector3): Vector4;
|
|
39
48
|
/**
|
|
40
49
|
* {@inheritDoc IColliderShape.destroy }
|
|
41
50
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ISphereColliderShape } from "@galacean/engine-design";
|
|
2
2
|
import { LiteColliderShape } from "./LiteColliderShape";
|
|
3
|
-
import { Vector3 } from "@galacean/engine";
|
|
3
|
+
import { Vector3, Vector4 } from "@galacean/engine";
|
|
4
4
|
import { LitePhysicsMaterial } from "../LitePhysicsMaterial";
|
|
5
5
|
/**
|
|
6
6
|
* Sphere collider shape in Lite.
|
|
@@ -25,4 +25,8 @@ export declare class LiteSphereColliderShape extends LiteColliderShape implement
|
|
|
25
25
|
* {@inheritDoc IColliderShape.setWorldScale }
|
|
26
26
|
*/
|
|
27
27
|
setWorldScale(scale: Vector3): void;
|
|
28
|
+
/**
|
|
29
|
+
* {@inheritDoc IColliderShape.pointDistance }
|
|
30
|
+
*/
|
|
31
|
+
pointDistance(point: Vector3): Vector4;
|
|
28
32
|
}
|