Needle Engine

Changes between version 3.7.2-alpha and 3.7.3-alpha
Files changed (2) hide show
  1. src/engine/engine_types.ts +5 -0
  2. src/engine-components/export/usdz/extensions/USDZText.ts +10 -0
src/engine/engine_types.ts CHANGED
@@ -390,6 +390,11 @@
390
390
  /** clear all possibly cached data (e.g. mesh data when creating scaled mesh colliders) */
391
391
  clearCaches();
392
392
 
393
+ enabled: boolean;
394
+
395
+ set gravity(vec3: Vec3);
396
+ get gravity(): Vec3;
397
+
393
398
  // raycasting
394
399
  /** Fast raycast against physics colliders
395
400
  * @param origin ray origin in screen or worldspace
src/engine-components/export/usdz/extensions/USDZText.ts CHANGED
@@ -139,6 +139,7 @@
139
139
  }
140
140
 
141
141
  const rotateYAxisMatrix = new Matrix4().makeRotationY(Math.PI);
142
+ const invertX = new Matrix4().makeScale(-1, 1, -1);
142
143
 
143
144
  export class TextExtension implements IUSDExporterExtension {
144
145
  get extensionName(): string {
@@ -155,9 +156,18 @@
155
156
  if (rt) {
156
157
  width = rt.width;
157
158
  height = rt.height;
159
+
160
+ // Take the matrix from the three mesh ui object:
161
+ const mat = rt.shadowComponent!.matrix;
162
+ model.matrix.copy(mat);
163
+ // model.matrix.premultiply(rotateYAxisMatrix);
164
+ model.matrix.premultiply(invertX);
158
165
  }
159
166
  const newModel = model.clone();
160
167
  newModel.matrix = rotateYAxisMatrix.clone();
168
+ if (rt) // Not ideal but works for now:
169
+ newModel.matrix.premultiply(invertX);
170
+
161
171
  const color = new Color().copySRGBToLinear(text.color);
162
172
  newModel.material = new MeshStandardMaterial({ color: color, emissive: color });
163
173
  model.add(newModel);