@needle-tools/engine 3.4.0-alpha → 3.5.1-alpha
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/CHANGELOG.md +14 -0
- package/dist/needle-engine.js +59388 -59097
- package/dist/needle-engine.min.js +416 -391
- package/dist/needle-engine.umd.cjs +388 -363
- package/lib/engine/api.d.ts +1 -0
- package/lib/engine/api.js +1 -0
- package/lib/engine/api.js.map +1 -1
- package/lib/engine/engine_context.d.ts +9 -4
- package/lib/engine/engine_context.js +57 -32
- package/lib/engine/engine_context.js.map +1 -1
- package/lib/engine/engine_context_registry.d.ts +5 -3
- package/lib/engine/engine_context_registry.js +10 -2
- package/lib/engine/engine_context_registry.js.map +1 -1
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_element_loading.js +2 -3
- package/lib/engine/engine_element_loading.js.map +1 -1
- package/lib/engine/engine_input.d.ts +2 -2
- package/lib/engine/engine_physics.d.ts +20 -93
- package/lib/engine/engine_physics.js +20 -892
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics.types.js.map +1 -1
- package/lib/engine/engine_physics_rapier.d.ts +103 -0
- package/lib/engine/engine_physics_rapier.js +1003 -0
- package/lib/engine/engine_physics_rapier.js.map +1 -0
- package/lib/engine/engine_types.d.ts +50 -1
- package/lib/engine/engine_types.js +8 -0
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine-components/Collider.js +6 -6
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Joints.js +2 -2
- package/lib/engine-components/Joints.js.map +1 -1
- package/lib/engine-components/ReflectionProbe.js +16 -7
- package/lib/engine-components/ReflectionProbe.js.map +1 -1
- package/lib/engine-components/Renderer.js +3 -4
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +0 -1
- package/lib/engine-components/RigidBody.js +24 -30
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js +52 -26
- package/lib/engine-components/export/usdz/ThreeUSDZExporter.js.map +1 -1
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.d.ts +8 -2
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js +44 -7
- package/lib/engine-components/export/usdz/extensions/behavior/BehaviourComponents.js.map +1 -1
- package/lib/engine-components/ui/Canvas.js +29 -16
- package/lib/engine-components/ui/Canvas.js.map +1 -1
- package/lib/engine-components/ui/Layout.js +10 -5
- package/lib/engine-components/ui/Layout.js.map +1 -1
- package/lib/engine-components/ui/RectTransform.js +8 -3
- package/lib/engine-components/ui/RectTransform.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/plugins/vite/config.js +2 -1
- package/plugins/vite/defines.js +30 -0
- package/plugins/vite/dependency-watcher.js +173 -0
- package/plugins/vite/editor-connection.js +37 -39
- package/plugins/vite/index.js +5 -1
- package/plugins/vite/reload.js +3 -1
- package/src/engine/api.ts +1 -0
- package/src/engine/codegen/register_types.js +2 -2
- package/src/engine/engine_context.ts +75 -42
- package/src/engine/engine_context_registry.ts +13 -6
- package/src/engine/engine_element.ts +2 -1
- package/src/engine/engine_element_loading.ts +2 -3
- package/src/engine/engine_input.ts +2 -2
- package/src/engine/engine_physics.ts +25 -1020
- package/src/engine/engine_physics.types.ts +1 -3
- package/src/engine/engine_physics_rapier.ts +1127 -0
- package/src/engine/engine_types.ts +66 -4
- package/src/engine-components/Collider.ts +6 -6
- package/src/engine-components/Joints.ts +2 -2
- package/src/engine-components/ReflectionProbe.ts +17 -7
- package/src/engine-components/Renderer.ts +5 -5
- package/src/engine-components/RendererLightmap.ts +1 -1
- package/src/engine-components/RigidBody.ts +24 -31
- package/src/engine-components/export/usdz/ThreeUSDZExporter.ts +58 -29
- package/src/engine-components/export/usdz/extensions/behavior/BehaviourComponents.ts +51 -9
- package/src/engine-components/ui/Canvas.ts +29 -16
- package/src/engine-components/ui/Layout.ts +10 -5
- package/src/engine-components/ui/RectTransform.ts +9 -4
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { Camera, Intersection, Layers,
|
|
1
|
+
import { Camera, Intersection, Layers, Object3D, Ray, Raycaster, Vector2, Vector3 } from 'three';
|
|
2
2
|
import { Context } from './engine_setup';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
export type Rapier = typeof RAPIER;
|
|
3
|
+
import { Vec2, Vec3 } from './engine_types';
|
|
4
|
+
import { IPhysicsEngine } from './engine_types';
|
|
6
5
|
export declare class RaycastOptions {
|
|
7
6
|
ray: Ray | undefined;
|
|
8
7
|
cam: Camera | undefined | null;
|
|
@@ -30,12 +29,24 @@ export declare class SphereIntersection implements Intersection {
|
|
|
30
29
|
object: Object3D;
|
|
31
30
|
constructor(object: Object3D, distance: number, point: Vector3);
|
|
32
31
|
}
|
|
33
|
-
export declare class SphereOverlapResult {
|
|
34
|
-
object: Object3D;
|
|
35
|
-
collider: ICollider;
|
|
36
|
-
constructor(object: Object3D, collider: ICollider);
|
|
37
|
-
}
|
|
38
32
|
export declare class Physics {
|
|
33
|
+
/**@deprecated use this.context.physics.engine.raycast */
|
|
34
|
+
raycastPhysicsFast(origin: Vec2 | Vec3, direction?: Vec3 | undefined, maxDistance?: number, solid?: boolean): {
|
|
35
|
+
point: Vector3;
|
|
36
|
+
collider: import("./engine_types").ICollider;
|
|
37
|
+
normal?: Vector3 | undefined;
|
|
38
|
+
} | null;
|
|
39
|
+
/**@deprecated use this.context.physics.engine.raycastAndGetNormal */
|
|
40
|
+
raycastPhysicsFastAndGetNormal(origin: Vec2 | Vec3, direction?: Vec3 | undefined, maxDistance?: number, solid?: boolean): {
|
|
41
|
+
point: Vector3;
|
|
42
|
+
collider: import("./engine_types").ICollider;
|
|
43
|
+
normal?: Vector3 | undefined;
|
|
44
|
+
} | null;
|
|
45
|
+
/**@deprecated use this.context.physics.engine.sphereOverlap */
|
|
46
|
+
sphereOverlapPhysics(point: Vector3, radius: number): import("./engine_types").SphereOverlapResult[] | null;
|
|
47
|
+
private readonly context;
|
|
48
|
+
engine?: IPhysicsEngine;
|
|
49
|
+
constructor(context: Context);
|
|
39
50
|
private readonly raycaster;
|
|
40
51
|
private readonly defaultRaycastOptions;
|
|
41
52
|
private readonly targetBuffer;
|
|
@@ -59,88 +70,4 @@ export declare class Physics {
|
|
|
59
70
|
* @param options raycast options. If null, default options will be used.
|
|
60
71
|
*/
|
|
61
72
|
raycast(options?: RaycastOptions | null): Array<Intersection>;
|
|
62
|
-
private rapierRay;
|
|
63
|
-
private raycastVectorsBuffer;
|
|
64
|
-
/** Fast raycast against physics colliders
|
|
65
|
-
* @param origin ray origin in screen or worldspace
|
|
66
|
-
* @param direction ray direction in worldspace
|
|
67
|
-
* @param maxDistance max distance to raycast
|
|
68
|
-
* @param solid if true it will also hit the collider if origin is already inside it
|
|
69
|
-
*/
|
|
70
|
-
raycastPhysicsFast(origin: Vec2 | Vec3, direction?: Vec3 | undefined, maxDistance?: number, solid?: boolean): null | {
|
|
71
|
-
point: Vector3;
|
|
72
|
-
collider: ICollider;
|
|
73
|
-
};
|
|
74
|
-
raycastPhysicsFastAndGetNormal(origin: Vec2 | Vec3, direction?: Vec3 | undefined, maxDistance?: number, solid?: boolean): null | {
|
|
75
|
-
point: Vector3;
|
|
76
|
-
normal: Vector3;
|
|
77
|
-
collider: ICollider;
|
|
78
|
-
};
|
|
79
|
-
private getPhysicsRay;
|
|
80
|
-
private rapierSphere;
|
|
81
|
-
private rapierColliderArray;
|
|
82
|
-
private readonly rapierIdentityRotation;
|
|
83
|
-
private readonly rapierForwardVector;
|
|
84
|
-
/** Precice sphere overlap detection using rapier against colliders
|
|
85
|
-
* @param point center of the sphere in worldspace
|
|
86
|
-
* @param radius radius of the sphere
|
|
87
|
-
* @returns array of colliders that overlap with the sphere. Note: they currently only contain the collider and the gameobject
|
|
88
|
-
*/
|
|
89
|
-
sphereOverlapPhysics(point: Vector3, radius: number): Array<SphereOverlapResult>;
|
|
90
|
-
enabled: boolean;
|
|
91
|
-
private _tempPosition;
|
|
92
|
-
private _tempQuaternion;
|
|
93
|
-
private _tempScale;
|
|
94
|
-
private _tempMatrix;
|
|
95
|
-
private static _didLoadPhysicsEngine;
|
|
96
|
-
private _isUpdatingPhysicsWorld;
|
|
97
|
-
get isUpdating(): boolean;
|
|
98
|
-
private context;
|
|
99
|
-
private world?;
|
|
100
|
-
private _hasCreatedWorld;
|
|
101
|
-
private eventQueue?;
|
|
102
|
-
private collisionHandler?;
|
|
103
|
-
private objects;
|
|
104
|
-
private bodies;
|
|
105
|
-
private _meshCache;
|
|
106
|
-
constructor(context: Context);
|
|
107
|
-
createWorld(): Promise<void>;
|
|
108
|
-
private _gravity;
|
|
109
|
-
get gravity(): Vec3;
|
|
110
|
-
set gravity(value: Vec3);
|
|
111
|
-
clearCaches(): void;
|
|
112
|
-
addBoxCollider(collider: ICollider, center: Vector3, size: Vector3): void;
|
|
113
|
-
addSphereCollider(collider: ICollider, center: Vector3, radius: number): void;
|
|
114
|
-
addCapsuleCollider(collider: ICollider, center: Vector3, height: number, radius: number): void;
|
|
115
|
-
addMeshCollider(collider: ICollider, mesh: Mesh, convex: boolean, scale: Vector3): void;
|
|
116
|
-
private createCollider;
|
|
117
|
-
private getRigidbody;
|
|
118
|
-
removeBody(obj: IComponent): void;
|
|
119
|
-
updateBody(comp: ICollider | IRigidbody, translation: boolean, rotation: boolean): void;
|
|
120
|
-
updateProperties(rigidbody: IRigidbody): void;
|
|
121
|
-
internal_getRigidbody(rb: IRigidbody): RigidBody | null;
|
|
122
|
-
private internalUpdateProperties;
|
|
123
|
-
private lines?;
|
|
124
|
-
step(dt?: number): void;
|
|
125
|
-
private updateDebugRendering;
|
|
126
|
-
postStep(): void;
|
|
127
|
-
/** sync rendered objects with physics world (except for colliders without rigidbody) */
|
|
128
|
-
private syncObjects;
|
|
129
|
-
private syncPhysicsBody;
|
|
130
|
-
private static _matricesBuffer;
|
|
131
|
-
private getRigidbodyRelativeMatrix;
|
|
132
|
-
private static centerConnectionPos;
|
|
133
|
-
private static centerConnectionRot;
|
|
134
|
-
addFixedJoint(body1: IRigidbody, body2: IRigidbody): void;
|
|
135
|
-
/** The joint prevents any relative movement between two rigid-bodies, except for relative rotations along one axis. This is typically used to simulate wheels, fans, etc. They are characterized by one local anchor as well as one local axis on each rigid-body. */
|
|
136
|
-
addHingeJoint(body1: IRigidbody, body2: IRigidbody, anchor: {
|
|
137
|
-
x: number;
|
|
138
|
-
y: number;
|
|
139
|
-
z: number;
|
|
140
|
-
}, axis: {
|
|
141
|
-
x: number;
|
|
142
|
-
y: number;
|
|
143
|
-
z: number;
|
|
144
|
-
}): void;
|
|
145
|
-
private calculateJointRelativeMatrices;
|
|
146
73
|
}
|