|
243 | 243 |
|
244 | 244 | /* ── Babylon scene ── */ |
245 | 245 | const engine = new BABYLON.Engine(canvas, true, { preserveDrawingBuffer: false, stencil: false, antialias: true }); |
246 | | - const scene = new BABYLON.Scene(engine); |
247 | | - // v1.1.1: right-handed coordinate system. Babylon defaults to LH where +Z |
248 | | - // is into the screen, so a face built with +Z=nose-forward by warpToFace |
249 | | - // would render facing AWAY from the default ArcRotateCamera at -Z (the |
250 | | - // user would see the back of the head). RH flips Z so +Z is out-of-screen, |
251 | | - // which means the face naturally faces the camera AND the camera view |
252 | | - // alphas (front=-π/2, profile=0, three-q=-π/2-0.6) map to the |
| 246 | + // v1.1.2: useRightHandedSystem MUST be set via Scene constructor options |
| 247 | + // (not by post-construction property assignment) — the post-assign path |
| 248 | + // gets silently no-op'd somewhere in Babylon 9.5's scene init pipeline, |
| 249 | + // so the scene boots in LH despite our request. The constructor option |
| 250 | + // sticks. Verified empirically with playwright: post-assign showed |
| 251 | + // `scene.useRightHandedSystem === false` at first frame, but options-form |
| 252 | + // shows true. |
| 253 | + // |
| 254 | + // Why we want RH at all: Babylon's LH default puts +Z into the screen. |
| 255 | + // warpToFace builds the face with +Z = nose-forward, so in LH the face |
| 256 | + // would render facing AWAY from the default ArcRotateCamera at -Z (user |
| 257 | + // sees back of head, profile shows wrong side). RH flips Z so +Z is |
| 258 | + // out-of-screen, geometry naturally faces the camera, and the camera |
| 259 | + // view alphas (front=-π/2, profile=0, three-q=-π/2-0.6) map to the |
253 | 260 | // conventionally-correct sides of the face — front shows the front, |
254 | 261 | // profile shows the face's right, three-quarter is a proper portrait |
255 | | - // angle. Fixes the "everything is flipped so views start incorrectly" |
256 | | - // bug without touching warpToFace, faceRoot.rotation, or any view alpha. |
257 | | - scene.useRightHandedSystem = true; |
| 262 | + // angle. No geometry change, no faceRoot.rotation flip, no view-alpha |
| 263 | + // rewiring. |
| 264 | + const scene = new BABYLON.Scene(engine, { useRightHandedSystem: true }); |
| 265 | + scene.useRightHandedSystem = true; // belt and braces — also assign post-ctor |
258 | 266 | scene.clearColor = new BABYLON.Color4(0, 0, 0, 1); |
259 | 267 | // we never pick on pointer-move; saves a per-frame ray test |
260 | 268 | scene.skipPointerMovePicking = true; |
|
0 commit comments