@woosh/meep-engine 2.43.34 → 2.43.36

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.
@@ -12,7 +12,7 @@ export function line3_compute_nearest_point_to_point(
12
12
  const direction_y = by - ay;
13
13
  const direction_z = bz - az;
14
14
 
15
- // find closest point
15
+ // find the closest point
16
16
  const sp0_x = ref_x - ax;
17
17
  const sp0_y = ref_y - ay;
18
18
  const sp0_z = ref_z - az;
@@ -168,6 +168,26 @@ class Quaternion {
168
168
  forward.normalize();
169
169
 
170
170
  right._crossVectors(ux, uy, uz, forward.x, forward.y, forward.z);
171
+
172
+ if(right.lengthSq() === 0){
173
+ // up and forward are parallel
174
+
175
+ /*
176
+ adjust forward direction slightly
177
+ code take from : https://github.com/mrdoob/three.js/blob/88e8954b69377dad4ad1ceaf1a383f3536e88e5a/src/math/Matrix4.js#L304
178
+ */
179
+
180
+ if(Math.abs(uz) === 1){
181
+ forward.x += 0.001;
182
+ }else{
183
+ forward.z += 0.001;
184
+ }
185
+
186
+ forward.normalize();
187
+ right._crossVectors(ux,uy,uz, forward.x, forward.y, forward.z);
188
+
189
+ }
190
+
171
191
  right.normalize();
172
192
 
173
193
  up.crossVectors(forward, right);
@@ -27,10 +27,14 @@ export default class Vector3 implements Vector3Like {
27
27
 
28
28
  negate(): void
29
29
 
30
+ addVectors(a: Vector3Like, b: Vector3Like): void
31
+
30
32
  add(other: Vector3Like): void
31
33
 
32
34
  _add(x: number, y: number, z: number): void
33
35
 
36
+ subVectors(a: Vector3Like, b: Vector3Like): void
37
+
34
38
  sub(other: Vector3Like): void
35
39
 
36
40
  _sub(x: number, y: number, z: number): void
@@ -43,6 +47,8 @@ export default class Vector3 implements Vector3Like {
43
47
 
44
48
  ceil(): void
45
49
 
50
+ multiplyVectors(a:Vector3Like,b:Vector3Like):void
51
+
46
52
  _multiply(x: number, y: number, z: number): void
47
53
 
48
54
  multiply(other: Vector3Like): void
@@ -91,7 +97,7 @@ export default class Vector3 implements Vector3Like {
91
97
 
92
98
  writeToArray(array: number[] | ArrayLike<number>, offset: number): void
93
99
 
94
- asArray():number[]
100
+ asArray(): number[]
95
101
 
96
102
  static distance(a: Vector3Like, b: Vector3Like): number
97
103
 
@@ -166,6 +166,19 @@ class Vector3 {
166
166
  return this.set(this.x, y, z);
167
167
  }
168
168
 
169
+ /**
170
+ *
171
+ * @param {Vector3} a
172
+ * @param {Vector3} b
173
+ */
174
+ addVectors(a,b){
175
+ const x = a.x + b.x;
176
+ const y = a.y + b.y;
177
+ const z = a.z + b.z;
178
+
179
+ this.set(x,y,z);
180
+ }
181
+
169
182
  /**
170
183
  *
171
184
  * @param {Vector3} other
@@ -186,6 +199,7 @@ class Vector3 {
186
199
  return this.set(this.x + x, this.y + y, this.z + z);
187
200
  }
188
201
 
202
+
189
203
  /**
190
204
  *
191
205
  * @param {Vector3} a
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "productName": "Meep",
6
6
  "description": "production-ready JavaScript game engine based on Entity Component System Architecture",
7
7
  "author": "Alexander Goldring",
8
- "version": "2.43.34",
8
+ "version": "2.43.36",
9
9
  "dependencies": {
10
10
  "gl-matrix": "3.4.3",
11
11
  "fast-levenshtein": "2.0.6",