@@ -688,7 +688,9 @@
|
|
688
688
|
|
689
689
|
onStart(action: AnimationAction) {
|
690
690
|
if (action.getClip() !== this.clip) return;
|
691
|
-
|
691
|
+
|
692
|
+
if (!RootMotionAction.lastObjRotation[this.root.uuid])
|
693
|
+
RootMotionAction.lastObjRotation[this.root.uuid] = new Quaternion();
|
692
694
|
const lastRotation = RootMotionAction.lastObjRotation[this.root.uuid];
|
693
695
|
// const firstKeyframe = RootMotionAction.firstKeyframeRotation[this.clip.uuid];
|
694
696
|
// lastRotation.invert().premultiply(firstKeyframe).invert();
|
@@ -4,7 +4,7 @@
|
|
4
4
|
import { RGBAColor } from "./js-extensions/RGBAColor.js";
|
5
5
|
import { Context, XRSessionMode } from "../engine/engine_setup.js";
|
6
6
|
import { ICamera } from "../engine/engine_types.js"
|
7
|
-
import { showBalloonMessage } from "../engine/debug/index.js";
|
7
|
+
import { isDevEnvironment, showBalloonMessage, showBalloonWarning } from "../engine/debug/index.js";
|
8
8
|
import { getWorldPosition, Graphics } from "../engine/engine_three_utils.js";
|
9
9
|
import { Gizmos } from "../engine/engine_gizmos.js";
|
10
10
|
|
@@ -219,7 +219,7 @@
|
|
219
219
|
}
|
220
220
|
|
221
221
|
onEnable(): void {
|
222
|
-
if (debug) console.log(this);
|
222
|
+
if (debug) console.log(`Camera enabled: \"${this.name}\". ClearFlags=${ClearFlags[this._clearFlags]}`, this);
|
223
223
|
this.buildCamera();
|
224
224
|
if (this.tag == "MainCamera" || !this.context.mainCameraComponent) {
|
225
225
|
this.context.setCurrentCamera(this);
|
@@ -316,8 +316,11 @@
|
|
316
316
|
|
317
317
|
// restore previous fov (e.g. when user was in VR or AR and the camera's fov has changed)
|
318
318
|
this.fieldOfView = this._fov;
|
319
|
-
|
320
|
-
if (debug)
|
319
|
+
|
320
|
+
if (debug) {
|
321
|
+
const msg = `Camera \"${this.name}\" clear flags: ${ClearFlags[this._clearFlags]}`;
|
322
|
+
console.log(msg);
|
323
|
+
}
|
321
324
|
switch (this._clearFlags) {
|
322
325
|
case ClearFlags.Skybox:
|
323
326
|
if (Camera.backgroundShouldBeTransparent(this.context)) {
|
@@ -346,6 +349,9 @@
|
|
346
349
|
this.context.scene.background = null;
|
347
350
|
this.context.renderer.setClearColor(this._backgroundColor, alpha);
|
348
351
|
}
|
352
|
+
else {
|
353
|
+
if (debug) console.warn(`Camera \"${this.name}\" has no background color`, this)
|
354
|
+
}
|
349
355
|
break;
|
350
356
|
case ClearFlags.Uninitialized:
|
351
357
|
this.context.scene.background = null
|
@@ -402,11 +408,13 @@
|
|
402
408
|
enable() {
|
403
409
|
this._skybox = this.context.lightmaps.tryGetSkybox(this._camera.sourceId) as THREE.Texture;
|
404
410
|
if (!this._skybox) {
|
405
|
-
console.warn("
|
411
|
+
console.warn(`Camera \"${this._camera.name}\" failed to load/find skybox texture`, this._camera.sourceId, this.context.lightmaps, "Current background: ", this.context.scene.background);
|
412
|
+
if (debug || isDevEnvironment())
|
413
|
+
showBalloonWarning(`Camera \"${this._camera.name}\" has no skybox texture`);
|
406
414
|
}
|
407
415
|
else if (this.context.scene.background !== this._skybox) {
|
408
416
|
if (debug)
|
409
|
-
console.log("
|
417
|
+
console.log(`Camera \"${this._camera.name}\" set skybox`, this._camera, this._skybox);
|
410
418
|
this._skybox.colorSpace = SRGBColorSpace;
|
411
419
|
this._skybox.mapping = EquirectangularReflectionMapping;
|
412
420
|
this.context.scene.background = this._skybox;
|
@@ -563,8 +563,6 @@
|
|
563
563
|
let positions = geo.getAttribute("position").array as Float32Array;
|
564
564
|
const indices = geo.index?.array as Uint32Array;
|
565
565
|
|
566
|
-
// console.log(geo.center())
|
567
|
-
|
568
566
|
// scaling seems not supported yet https://github.com/dimforge/rapier/issues/243
|
569
567
|
if (Math.abs(scale.x - 1) > 0.0001 || Math.abs(scale.y - 1) > 0.0001 || Math.abs(scale.z - 1) > 0.0001) {
|
570
568
|
const key = geo.uuid + "_" + scale.x + "_" + scale.y + "_" + scale.z + "_" + convex;
|
@@ -588,7 +586,7 @@
|
|
588
586
|
const desc = convex ? ColliderDesc.convexMesh(positions) : ColliderDesc.trimesh(positions, indices);
|
589
587
|
if (desc) {
|
590
588
|
const col = this.createCollider(collider, desc);
|
591
|
-
col.setMassProperties(1, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0, w: 1 });
|
589
|
+
// col.setMassProperties(1, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0 }, { x: 0, y: 0, z: 0, w: 1 });
|
592
590
|
// rb?.setTranslation({ x: 0, y: 2, z: 0 });
|
593
591
|
// col.setTranslationWrtParent(new Vector3(0,2,0));
|
594
592
|
|
@@ -782,6 +780,8 @@
|
|
782
780
|
});
|
783
781
|
const geometry = new BufferGeometry();
|
784
782
|
this.lines = new LineSegments(geometry, material);
|
783
|
+
this.lines.layers.disableAll();
|
784
|
+
this.lines.layers.enable(2);
|
785
785
|
}
|
786
786
|
if (this.lines.parent !== this.context?.scene)
|
787
787
|
this.context?.scene.add(this.lines);
|
@@ -838,8 +838,8 @@
|
|
838
838
|
if (center && center.isVector3) {
|
839
839
|
this._tempQuaternion.set(rot.x, rot.y, rot.z, rot.w);
|
840
840
|
const offset = this._tempPosition.copy(center).applyQuaternion(this._tempQuaternion);
|
841
|
-
const scale = getWorldScale(obj.gameObject);
|
842
|
-
offset.multiply(scale);
|
841
|
+
// const scale = getWorldScale(obj.gameObject);
|
842
|
+
// offset.multiply(scale);
|
843
843
|
pos.x -= offset.x;
|
844
844
|
pos.y -= offset.y;
|
845
845
|
pos.z -= offset.z;
|
@@ -456,6 +456,7 @@
|
|
456
456
|
this.setTarget(center, true);
|
457
457
|
this.autoTarget = false;
|
458
458
|
|
459
|
+
// TODO: this doesnt take the Camera component nearClipPlane into account
|
459
460
|
camera.near = distance / 100;
|
460
461
|
camera.far = distance * 100;
|