@galacean/engine-design 1.4.0-alpha.1 → 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/package.json +2 -2
- package/types/physics/ICharacterController.d.ts +1 -1
- package/types/physics/ICollision.d.ts +36 -0
- package/types/physics/IDynamicCollider.d.ts +4 -0
- package/types/physics/IPhysics.d.ts +2 -1
- package/types/physics/index.d.ts +1 -0
- package/types/physics/shape/IColliderShape.d.ts +8 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galacean/engine-design",
|
|
3
|
-
"version": "1.4.0-alpha.
|
|
3
|
+
"version": "1.4.0-alpha.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"types": "types/index.d.ts",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@galacean/engine-math": "1.4.0-alpha.
|
|
20
|
+
"@galacean/engine-math": "1.4.0-alpha.2"
|
|
21
21
|
},
|
|
22
22
|
"scripts": {
|
|
23
23
|
"b:types": "tsc"
|
|
@@ -37,7 +37,7 @@ export interface ICharacterController extends ICollider {
|
|
|
37
37
|
*/
|
|
38
38
|
setUpDirection(up: Vector3): void;
|
|
39
39
|
/**
|
|
40
|
-
* Sets the slope limit.
|
|
40
|
+
* Sets the slope limit in degrees.
|
|
41
41
|
* @param slopeLimit The slope limit for the controller.
|
|
42
42
|
*/
|
|
43
43
|
setSlopeLimit(slopeLimit: number): void;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interface of collision.
|
|
3
|
+
*/
|
|
4
|
+
export interface ICollision {
|
|
5
|
+
/** The unique id of the first collider. */
|
|
6
|
+
shape0Id: number;
|
|
7
|
+
/** The unique id of the second collider. */
|
|
8
|
+
shape1Id: number;
|
|
9
|
+
/** Count of contact points. */
|
|
10
|
+
contactCount: number;
|
|
11
|
+
/** Get contact points. */
|
|
12
|
+
getContacts(): VectorContactPairPoint;
|
|
13
|
+
}
|
|
14
|
+
interface VectorContactPairPoint {
|
|
15
|
+
size(): number;
|
|
16
|
+
get(index: number): IContactPoint;
|
|
17
|
+
}
|
|
18
|
+
interface IContactPoint {
|
|
19
|
+
position: {
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
z: number;
|
|
23
|
+
};
|
|
24
|
+
normal: {
|
|
25
|
+
x: number;
|
|
26
|
+
y: number;
|
|
27
|
+
z: number;
|
|
28
|
+
};
|
|
29
|
+
impulse: {
|
|
30
|
+
x: number;
|
|
31
|
+
y: number;
|
|
32
|
+
z: number;
|
|
33
|
+
};
|
|
34
|
+
separation: number;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -111,6 +111,10 @@ export interface IDynamicCollider extends ICollider {
|
|
|
111
111
|
* @param value - rigid body flag
|
|
112
112
|
*/
|
|
113
113
|
setCollisionDetectionMode(value: number): void;
|
|
114
|
+
/**
|
|
115
|
+
* Whether the collider is affected by gravity.
|
|
116
|
+
*/
|
|
117
|
+
setUseGravity(value: boolean): void;
|
|
114
118
|
/**
|
|
115
119
|
* Controls whether physics affects the dynamic collider.
|
|
116
120
|
* @param value - is or not
|
|
@@ -8,6 +8,7 @@ import { IPhysicsScene } from "./IPhysicsScene";
|
|
|
8
8
|
import { IStaticCollider } from "./IStaticCollider";
|
|
9
9
|
import { IFixedJoint, IHingeJoint, ISpringJoint } from "./joints";
|
|
10
10
|
import { IBoxColliderShape, ICapsuleColliderShape, IPlaneColliderShape, ISphereColliderShape } from "./shape";
|
|
11
|
+
import { ICollision } from "./ICollision";
|
|
11
12
|
/**
|
|
12
13
|
* The interface of physics creation.
|
|
13
14
|
*/
|
|
@@ -31,7 +32,7 @@ export interface IPhysics {
|
|
|
31
32
|
* @param onTriggerExit - Function called when trigger end
|
|
32
33
|
* @param onTriggerStay - Function called when trigger stay
|
|
33
34
|
*/
|
|
34
|
-
createPhysicsScene(physicsManager: IPhysicsManager, onContactEnter?: (
|
|
35
|
+
createPhysicsScene(physicsManager: IPhysicsManager, 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): IPhysicsScene;
|
|
35
36
|
/**
|
|
36
37
|
* Create dynamic collider.
|
|
37
38
|
* @param position - The global position
|
package/types/physics/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export type { IPhysicsMaterial } from "./IPhysicsMaterial";
|
|
|
6
6
|
export type { IPhysicsScene } from "./IPhysicsScene";
|
|
7
7
|
export type { IPhysicsManager } from "./IPhysicsManager";
|
|
8
8
|
export type { IStaticCollider } from "./IStaticCollider";
|
|
9
|
+
export type { ICollision } from "./ICollision";
|
|
9
10
|
export * from "./joints/index";
|
|
10
11
|
export * from "./shape/index";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Vector3 } from "@galacean/engine-math";
|
|
1
|
+
import { Vector3, Vector4 } from "@galacean/engine-math";
|
|
2
2
|
import { IPhysicsMaterial } from "../IPhysicsMaterial";
|
|
3
3
|
/**
|
|
4
4
|
* Interface for physics collider shape.
|
|
@@ -34,6 +34,13 @@ export interface IColliderShape {
|
|
|
34
34
|
* @param value - True for TriggerShape, false for SimulationShape
|
|
35
35
|
*/
|
|
36
36
|
setIsTrigger(value: boolean): void;
|
|
37
|
+
/**
|
|
38
|
+
* Get the distance between a point and the shape.
|
|
39
|
+
* @param point - Location in world space you want to find the closest point to
|
|
40
|
+
* @returns The x, y, and z components of the Vector4 represent the closest point on the shape in world space,
|
|
41
|
+
* and the w component represents the distance between the point and the shape
|
|
42
|
+
*/
|
|
43
|
+
pointDistance(point: Vector3): Vector4;
|
|
37
44
|
/**
|
|
38
45
|
* Decrements the reference count of a shape and releases it if the new reference count is zero.
|
|
39
46
|
*/
|