Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

docs(changelog): a viewport that says which way it faces

esenginee95a986606f1
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7c6613fd8..95642fe8d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,19 @@ published separately; it ships inside the editor.
### Fixed
+- **The zoom readout lied about a turned view.** It measured the scale by
+ projecting the world x axis onto the screen, so an eye looking down that axis
+ read as 1% — nothing about the zoom had moved. It now divides the canvas height
+ by the extent the view sees, which is what zoom means in either projection.
+
+- **The reset affordance only appeared after a drag.** Whether the eye was turned
+ was a flag every path had to remember to set, and only Alt-drag did: turning the
+ view from a command or from the automation door left the way back hidden. The
+ viewport polls the view itself, alongside the zoom readout that already
+ reconciles the same way. The automation door also grew the read half of
+ `setViewOrbit` — without it a driver can turn the view but can only judge the
+ result by eye.
+
- **A mesh could not be clicked in the viewport.** The editor's box for an entity
came from its Sprite size, and anything else fell back to the square it draws
for a camera or a light — 24 world units. So an imported model, however large,
@@ -143,6 +156,22 @@ published separately; it ships inside the editor.
### Added
+- **The viewport says which way it faces.** Alt-drag turns the editor's eye, and
+ nothing said where it had ended up — a reset button was the whole vocabulary,
+ so "which way am I looking" and "put me square-on to that side" had no answer.
+ The indicator is the navigation gizmo a DCC puts in a viewport corner: the world
+ axes as they point on screen, each end a click that stands the eye on that axis
+ and looks back down it. An axis leaning toward the eye draws short, which is the
+ cue that says how far the view has turned.
+
+ Where they point is read off the very basis the camera is built from, not from a
+ second copy of the rotation, and the gate holds that against where the camera
+ actually projects those axes — one scale factor for all three, so direction and
+ foreshortening are both asserted. The eye is allowed onto the poles here, unlike
+ a drag: looking straight down IS a standard view, and the view basis has its own
+ pole branch for it. The indicator appears only once the eye can see depth, since
+ a square-on orthographic view is the 2D editor.
+
- **A mesh can hide another one.** Nothing an imported model carried said it was
solid, so two of them resolved by paint order — which cannot draw two surfaces
that pass through each other, however their z is sorted. `Mesh2D.opaque` says
diff --git a/desktop/src/engine/viewportMath.ts b/desktop/src/engine/viewportMath.ts
index 147b4afe0..5a88b7019 100644
--- a/desktop/src/engine/viewportMath.ts
+++ b/desktop/src/engine/viewportMath.ts
@@ -154,12 +154,10 @@ export function axisEndKey(axis: 'x' | 'y' | 'z', sign: 1 | -1): string {
}
/**
- * The six ends of the view-axis indicator, ordered far to near.
- *
- * Screen offsets are the axis direction UNNORMALIZED: an axis leaning toward the
- * eye draws short, which is the foreshortening that tells a user how far the view
- * has turned. The order is the painter's — the caller reinserts the elements in
- * it, so a near knob covers a far one.
+ * The six ends of the view-axis indicator, in painter order (far first, so a near
+ * knob covers a far one). Offsets are the axis direction UNNORMALIZED: an axis
+ * leaning at the eye draws short, and that foreshortening is what tells a user
+ * how far the view has turned.
*/
export function axisIndicatorEnds(
axes: { x: ScreenAxis; y: ScreenAxis; z: ScreenAxis },