@needle-tools/engine 2.36.0-pre → 2.38.0-pre
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 +33 -0
- package/dist/needle-engine.d.ts +248 -151
- package/dist/needle-engine.js +451 -437
- package/dist/needle-engine.js.map +4 -4
- package/dist/needle-engine.min.js +82 -82
- package/dist/needle-engine.min.js.map +4 -4
- 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/debug/debug.d.ts +1 -0
- package/lib/engine/debug/debug.js +3 -0
- package/lib/engine/debug/debug.js.map +1 -1
- package/lib/engine/engine_addressables.d.ts +3 -1
- package/lib/engine/engine_addressables.js +12 -5
- package/lib/engine/engine_addressables.js.map +1 -1
- package/lib/engine/engine_element.js +3 -2
- package/lib/engine/engine_element.js.map +1 -1
- package/lib/engine/engine_element_overlay.js +4 -3
- package/lib/engine/engine_element_overlay.js.map +1 -1
- package/lib/engine/engine_gameobject.js +2 -1
- package/lib/engine/engine_gameobject.js.map +1 -1
- package/lib/engine/engine_input.d.ts +2 -0
- package/lib/engine/engine_input.js +14 -3
- package/lib/engine/engine_input.js.map +1 -1
- package/lib/engine/engine_physics.d.ts +35 -46
- package/lib/engine/engine_physics.js +479 -386
- package/lib/engine/engine_physics.js.map +1 -1
- package/lib/engine/engine_physics.types.d.ts +23 -0
- package/lib/engine/engine_physics.types.js +27 -0
- package/lib/engine/engine_physics.types.js.map +1 -0
- package/lib/engine/engine_serialization_core.d.ts +3 -0
- package/lib/engine/engine_serialization_core.js +5 -0
- package/lib/engine/engine_serialization_core.js.map +1 -1
- package/lib/engine/engine_setup.d.ts +7 -1
- package/lib/engine/engine_setup.js +13 -3
- package/lib/engine/engine_setup.js.map +1 -1
- package/lib/engine/engine_types.d.ts +45 -26
- package/lib/engine/engine_types.js +24 -37
- package/lib/engine/engine_types.js.map +1 -1
- package/lib/engine/engine_util_decorator.d.ts +6 -0
- package/lib/engine/engine_util_decorator.js +54 -0
- package/lib/engine/engine_util_decorator.js.map +1 -0
- package/lib/engine/engine_utils.d.ts +1 -1
- package/lib/engine/engine_utils.js +1 -1
- package/lib/engine/engine_utils.js.map +1 -1
- package/lib/engine/extensions/NEEDLE_gameobject_data.js +2 -0
- package/lib/engine/extensions/NEEDLE_gameobject_data.js.map +1 -1
- package/lib/engine-components/Animation.d.ts +7 -5
- package/lib/engine-components/Animation.js +7 -7
- package/lib/engine-components/Animation.js.map +1 -1
- package/lib/engine-components/AnimatorController.js +14 -7
- package/lib/engine-components/AnimatorController.js.map +1 -1
- package/lib/engine-components/BoxHelperComponent.js +1 -0
- package/lib/engine-components/BoxHelperComponent.js.map +1 -1
- package/lib/engine-components/Camera.d.ts +1 -0
- package/lib/engine-components/Camera.js +20 -5
- package/lib/engine-components/Camera.js.map +1 -1
- package/lib/engine-components/CharacterController.d.ts +31 -0
- package/lib/engine-components/CharacterController.js +167 -0
- package/lib/engine-components/CharacterController.js.map +1 -0
- package/lib/engine-components/Collider.d.ts +16 -5
- package/lib/engine-components/Collider.js +45 -23
- package/lib/engine-components/Collider.js.map +1 -1
- package/lib/engine-components/Component.d.ts +6 -15
- package/lib/engine-components/Component.js +7 -112
- package/lib/engine-components/Component.js.map +1 -1
- package/lib/engine-components/DragControls.js +9 -6
- package/lib/engine-components/DragControls.js.map +1 -1
- package/lib/engine-components/Light.d.ts +2 -0
- package/lib/engine-components/Light.js +13 -2
- package/lib/engine-components/Light.js.map +1 -1
- package/lib/engine-components/NavMesh.d.ts +0 -5
- package/lib/engine-components/NavMesh.js +100 -10
- package/lib/engine-components/NavMesh.js.map +1 -1
- package/lib/engine-components/NestedGltf.js +2 -0
- package/lib/engine-components/NestedGltf.js.map +1 -1
- package/lib/engine-components/Renderer.js +4 -0
- package/lib/engine-components/Renderer.js.map +1 -1
- package/lib/engine-components/RigidBody.d.ts +45 -25
- package/lib/engine-components/RigidBody.js +290 -142
- package/lib/engine-components/RigidBody.js.map +1 -1
- package/lib/engine-components/SmoothFollow.d.ts +2 -1
- package/lib/engine-components/SmoothFollow.js +25 -17
- package/lib/engine-components/SmoothFollow.js.map +1 -1
- package/lib/engine-components/SpatialTrigger.js +1 -1
- package/lib/engine-components/SpatialTrigger.js.map +1 -1
- package/lib/engine-components/SpectatorCamera.d.ts +1 -0
- package/lib/engine-components/SpectatorCamera.js +9 -2
- package/lib/engine-components/SpectatorCamera.js.map +1 -1
- package/lib/engine-components/SpringJoint.d.ts +0 -13
- package/lib/engine-components/SpringJoint.js +42 -41
- package/lib/engine-components/SpringJoint.js.map +1 -1
- package/lib/engine-components/VideoPlayer.js.map +1 -1
- package/lib/engine-components/WebXR.d.ts +1 -0
- package/lib/engine-components/WebXR.js +13 -6
- package/lib/engine-components/WebXR.js.map +1 -1
- package/lib/engine-components/WebXRController.js +12 -6
- package/lib/engine-components/WebXRController.js.map +1 -1
- package/lib/engine-components/codegen/components.d.ts +4 -3
- package/lib/engine-components/codegen/components.js +4 -3
- package/lib/engine-components/codegen/components.js.map +1 -1
- package/package.json +3 -4
- package/src/engine/api.ts +2 -1
- package/src/engine/codegen/register_types.js +16 -12
- package/src/engine/debug/debug.ts +4 -0
- package/src/engine/dist/engine_physics.js +739 -0
- package/src/engine/dist/engine_setup.js +777 -0
- package/src/engine/engine_addressables.ts +18 -8
- package/src/engine/engine_element.ts +3 -2
- package/src/engine/engine_element_overlay.ts +4 -3
- package/src/engine/engine_gameobject.ts +4 -4
- package/src/engine/engine_input.ts +12 -3
- package/src/engine/engine_physics.ts +492 -418
- package/src/engine/engine_physics.types.ts +28 -0
- package/src/engine/engine_serialization_core.ts +8 -1
- package/src/engine/engine_setup.ts +31 -18
- package/src/engine/engine_types.ts +83 -56
- package/src/engine/engine_util_decorator.ts +69 -0
- package/src/engine/engine_utils.ts +3 -3
- package/src/engine/extensions/NEEDLE_gameobject_data.ts +2 -0
- package/src/engine-components/Animation.ts +18 -12
- package/src/engine-components/AnimatorController.ts +16 -11
- package/src/engine-components/BoxHelperComponent.ts +1 -0
- package/src/engine-components/Camera.ts +21 -4
- package/src/engine-components/CharacterController.ts +171 -0
- package/src/engine-components/Collider.ts +49 -39
- package/src/engine-components/Component.ts +15 -130
- package/src/engine-components/DragControls.ts +9 -5
- package/src/engine-components/Light.ts +17 -3
- package/src/engine-components/NavMesh.ts +114 -115
- package/src/engine-components/NestedGltf.ts +2 -0
- package/src/engine-components/Renderer.ts +5 -1
- package/src/engine-components/RigidBody.ts +292 -149
- package/src/engine-components/SmoothFollow.ts +21 -18
- package/src/engine-components/SpatialTrigger.ts +1 -1
- package/src/engine-components/SpectatorCamera.ts +10 -2
- package/src/engine-components/SpringJoint.ts +41 -41
- package/src/engine-components/VideoPlayer.ts +1 -2
- package/src/engine-components/WebXR.ts +15 -6
- package/src/engine-components/WebXRController.ts +16 -7
- package/src/engine-components/codegen/components.ts +4 -3
- package/src/engine-components/dist/CharacterController.js +123 -0
- package/src/engine-components/dist/RigidBody.js +458 -0
|
@@ -1,118 +1,117 @@
|
|
|
1
1
|
|
|
2
|
-
import { Behaviour, GameObject } from "./Component";
|
|
3
|
-
/*
|
|
4
|
-
import { Pathfinding, PathfindingHelper } from 'three-pathfinding';
|
|
5
|
-
import * as THREE from 'three';
|
|
6
|
-
import { mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils'
|
|
7
|
-
*/
|
|
8
|
-
export class NavMesh extends Behaviour {
|
|
9
|
-
/*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// import { input } from "../engine/engine_input";
|
|
60
|
-
import { Physics, RaycastOptions } from "../engine/engine_physics"
|
|
61
|
-
// import { time } from "../engine/engine_time";
|
|
62
|
-
// import { scene } from "../engine/engine_setup";
|
|
63
|
-
import {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
this.currentPath.shift();
|
|
2
|
+
// import { Behaviour, GameObject } from "./Component";
|
|
3
|
+
// /*
|
|
4
|
+
// import { Pathfinding, PathfindingHelper } from 'three-pathfinding';
|
|
5
|
+
// import * as THREE from 'three';
|
|
6
|
+
// import { mergeBufferGeometries } from 'three/examples/jsm/utils/BufferGeometryUtils'
|
|
7
|
+
// */
|
|
8
|
+
// export class NavMesh extends Behaviour {
|
|
9
|
+
// /*
|
|
10
|
+
// public meshes: THREE.Object3D[] = [];
|
|
11
|
+
|
|
12
|
+
// private pathfinding: Pathfinding | null = null;
|
|
13
|
+
// private zones: string[] = [];
|
|
14
|
+
|
|
15
|
+
// onEnable(): void {
|
|
16
|
+
|
|
17
|
+
// this.pathfinding = new Pathfinding();
|
|
18
|
+
// const ZONE = 'zone';
|
|
19
|
+
// const geometries : THREE.BufferGeometry[] = [];
|
|
20
|
+
// if (this.meshes && this.meshes.length > 0) {
|
|
21
|
+
// for (let i = 0; i < this.meshes.length; i++) {
|
|
22
|
+
// const obj = this.meshes[i] as THREE.Mesh;
|
|
23
|
+
// if (!obj) continue;
|
|
24
|
+
// const geo = obj.geometry;
|
|
25
|
+
// if (!geo) continue;
|
|
26
|
+
// const copy : THREE.BufferGeometry = {...geo};
|
|
27
|
+
// // const copy = geo;
|
|
28
|
+
// const attributesCopy = {...copy.attributes};
|
|
29
|
+
// copy.attributes = attributesCopy;
|
|
30
|
+
// if(attributesCopy.uv2) delete attributesCopy.uv2;
|
|
31
|
+
// // copy.applyMatrix4(obj.matrixWorld);
|
|
32
|
+
// geometries.push(copy);
|
|
33
|
+
// // obj.updateMatrixWorld();
|
|
34
|
+
// // singleGeometry.merge(geo);
|
|
35
|
+
// // console.log(singleGeometry, geo);
|
|
36
|
+
// }
|
|
37
|
+
// }
|
|
38
|
+
// const mesh = mergeBufferGeometries(geometries);
|
|
39
|
+
// const zone = Pathfinding.createZone(mesh);
|
|
40
|
+
// const name = ZONE;
|
|
41
|
+
// this.zones.push(name);
|
|
42
|
+
// this.pathfinding.setZoneData(name, zone);
|
|
43
|
+
|
|
44
|
+
// // const target = new THREE.Vector3(2, 0, 2);
|
|
45
|
+
// // const groupID = this.pathfinding.getGroup(ZONE, target);
|
|
46
|
+
// // const path = this.pathfinding.findPath(this.worldPosition, target, ZONE, groupID);
|
|
47
|
+
// // console.log(path, this.pathfinding);
|
|
48
|
+
// }
|
|
49
|
+
|
|
50
|
+
// public tryFindPath(from: THREE.Vector3, to: THREE.Vector3): THREE.Vector3[] | null {
|
|
51
|
+
// const zone = this.zones[0];
|
|
52
|
+
// const groupId = this.pathfinding.getGroup(zone, to);
|
|
53
|
+
// const path = this.pathfinding.findPath(from, to, zone, groupId);
|
|
54
|
+
// return path;
|
|
55
|
+
// }
|
|
56
|
+
// */
|
|
57
|
+
// }
|
|
58
|
+
|
|
59
|
+
// // import { input } from "../engine/engine_input";
|
|
60
|
+
// import { Physics, RaycastOptions } from "../engine/engine_physics"
|
|
61
|
+
// // import { time } from "../engine/engine_time";
|
|
62
|
+
// // import { scene } from "../engine/engine_setup";
|
|
63
|
+
// import {SyncedTransform} from "./SyncedTransform";
|
|
64
|
+
|
|
65
|
+
// export class NavMeshAgent extends Behaviour {
|
|
66
|
+
// /*
|
|
67
|
+
// public navMesh: NavMesh | null = null;
|
|
68
|
+
|
|
69
|
+
// private currentPath: THREE.Vector3[] | null = null;
|
|
70
|
+
// private helper : PathfindingHelper | null = null;
|
|
71
|
+
|
|
72
|
+
// onEnable(): void {
|
|
73
|
+
// this.helper = new PathfindingHelper();
|
|
74
|
+
// scene.add(this.helper);
|
|
75
|
+
// }
|
|
76
|
+
|
|
77
|
+
// update(): void {
|
|
78
|
+
// if (input.mouseClick) {
|
|
79
|
+
// if (this.navMesh) {
|
|
80
|
+
// const from = this.worldPosition;
|
|
81
|
+
// const opts = new RaycastOptions();
|
|
82
|
+
// opts.setMask(RaycastOptions.AllLayers);
|
|
83
|
+
// const hits = Physics.raycast(opts);
|
|
84
|
+
// if (hits.length > 0) {
|
|
85
|
+
// const to = hits[0].point;
|
|
86
|
+
// this.helper.setPlayerPosition(from);
|
|
87
|
+
// this.helper.setTargetPosition(to);
|
|
88
|
+
// this.currentPath = this.navMesh.tryFindPath(from, to);
|
|
89
|
+
// this.helper.setPath(this.currentPath);
|
|
90
|
+
// // console.log(...this.currentPath);
|
|
91
|
+
|
|
92
|
+
// const sync = GameObject.getComponent(this.gameObject, SyncedTransform);
|
|
93
|
+
// if(sync) sync.requestOwnership();
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// }
|
|
97
|
+
|
|
98
|
+
// if (this.currentPath && this.currentPath.length > 0) {
|
|
99
|
+
|
|
100
|
+
// const wp = this.worldPosition;
|
|
101
|
+
// const target = this.currentPath[0];
|
|
102
|
+
// this.worldPosition = wp.lerp(target, time.deltaTime*2);
|
|
103
|
+
|
|
104
|
+
// this.gameObject.lookAt(target);
|
|
105
|
+
// // const vec = target.clone().sub(wp);
|
|
106
|
+
// // const wr = this.worldQuaternion;
|
|
107
|
+
// // wr.slerp(rot, time.deltaTime*5);
|
|
108
|
+
// // this.worldQuaternion = wr;
|
|
109
|
+
|
|
110
|
+
// if (wp.distanceTo(this.currentPath[0]) < 0.1)
|
|
111
|
+
// this.currentPath.shift();
|
|
113
112
|
|
|
114
113
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
114
|
+
// }
|
|
115
|
+
// }
|
|
116
|
+
// */
|
|
117
|
+
// }
|
|
@@ -41,6 +41,8 @@ export class NestedGltf extends Behaviour {
|
|
|
41
41
|
res.matrix.identity();
|
|
42
42
|
res.applyMatrix4(matrix);
|
|
43
43
|
res.matrixAutoUpdate = true;
|
|
44
|
+
res.layers.disableAll();
|
|
45
|
+
res.layers.set(this.layer);
|
|
44
46
|
}
|
|
45
47
|
this.destroy();
|
|
46
48
|
if (debug) console.log("Nested loading done:", this.filePath?.uri ?? this.filePath, res);
|
|
@@ -5,7 +5,7 @@ import { RendererLightmap } from "./RendererLightmap";
|
|
|
5
5
|
import { Context } from "../engine/engine_setup";
|
|
6
6
|
import { getParam } from "../engine/engine_utils";
|
|
7
7
|
import { serializeable } from "../engine/engine_serialization_decorator";
|
|
8
|
-
import { AxesHelper, Material, Mesh, Object3D, Texture, Vector4 } from "three";
|
|
8
|
+
import { AxesHelper, Material, Mesh, Object3D, SkinnedMesh, Texture, Vector4 } from "three";
|
|
9
9
|
import { NEEDLE_render_objects } from "../engine/extensions/NEEDLE_render_objects";
|
|
10
10
|
import { NEEDLE_deferred_texture } from "../engine/extensions/NEEDLE_deferred_texture";
|
|
11
11
|
import { NEED_UPDATE_INSTANCE_KEY } from "../engine/engine_instancing";
|
|
@@ -67,6 +67,7 @@ class SharedMaterialArray implements ISharedMaterials {
|
|
|
67
67
|
case "Group":
|
|
68
68
|
this._targets = [...go.children];
|
|
69
69
|
break;
|
|
70
|
+
case "SkinnedMesh":
|
|
70
71
|
case "Mesh":
|
|
71
72
|
this._targets.push(go);
|
|
72
73
|
break;
|
|
@@ -155,6 +156,9 @@ export class Renderer extends Behaviour implements IRenderer {
|
|
|
155
156
|
if (this.gameObject.type === "Mesh") {
|
|
156
157
|
return this.gameObject as unknown as Mesh
|
|
157
158
|
}
|
|
159
|
+
else if (this.gameObject.type === "SkinnesMesh") {
|
|
160
|
+
return this.gameObject as unknown as SkinnedMesh;
|
|
161
|
+
}
|
|
158
162
|
else if (this.gameObject.type === "Group") {
|
|
159
163
|
return this.gameObject.children[0] as unknown as Mesh;
|
|
160
164
|
}
|