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.

feat(editor): the transform tools work on the running game too

yhh569ac86640e1
diff --git a/desktop/src/engine/PlayRealm.ts b/desktop/src/engine/PlayRealm.ts
index 714ac720f..bda8044ad 100644
--- a/desktop/src/engine/PlayRealm.ts
+++ b/desktop/src/engine/PlayRealm.ts
@@ -393,6 +393,11 @@ export class PlayRealmInstance {
this.post({ type: 'estella:play:dragTo', entityId, x, y, ...(axis ? { axis } : {}) });
}
+ /** Turn / resize a running entity by a relative amount (reverts on Stop). */
+ transformBy(entityId: number, delta: { rotateBy?: number; scaleBy?: { x: number; y: number } }): void {
+ this.post({ type: 'estella:play:transformBy', entityId, ...delta });
+ }
+
/** Live-edit a field of a running entity (debug; reverts on Stop). */
setField(entityId: number, comp: string, key: string, value: unknown): void {
this.post({ type: 'estella:play:setField', entityId, comp, key, value });
diff --git a/desktop/src/engine/entityOps.ts b/desktop/src/engine/entityOps.ts
index 3f5681231..861c8caae 100644
--- a/desktop/src/engine/entityOps.ts
+++ b/desktop/src/engine/entityOps.ts
@@ -19,6 +19,8 @@ import { SceneCommands, toModelValue } from './SceneCommands';
import { PlayInspect } from './PlayInspect';
import { PlayRealm } from './PlayRealm';
import { srcIdOf, type EntityRef } from './entityRef';
+import { SceneQuery } from './SceneQuery';
+import { turnQuat2D, scaleVecBy } from './viewportMath';
import { PlayEdits } from './playEdits';
/** The value vocabulary every inspector control commits in. */
@@ -90,6 +92,45 @@ export const EntityOps = {
SceneCommands.setEntityXY(src, point.world.x, point.world.y);
return 'document';
},
+
+ /**
+ * Turn `ref` by an angle, or resize it by a factor — relative, because both
+ * mean the same thing under any camera and so need no projection at all.
+ *
+ * Document-side they are ordinary field writes on the transform the editor's
+ * own gizmos already drive; live they are one message the realm composes.
+ */
+ turnBy(ref: EntityRef, radians: number): OpWorld {
+ if (radians === 0) return EntityOps.worldFor(ref);
+ if (liveNow()) {
+ const live = PlayInspect.liveIdOf(ref);
+ if (live == null) return null;
+ PlayRealm.transformBy(live, { rotateBy: radians });
+ PlayEdits.record(ref, 'Transform', 'rotation');
+ return 'live';
+ }
+ const src = srcIdOf(ref);
+ if (src == null) return null;
+ const q = SceneQuery.getFieldValue(src, 'Transform', 'rotation') as { z?: number; w?: number } | null;
+ SceneCommands.setFieldValue(src, 'Transform', 'rotation', turnQuat2D(q ?? undefined, radians));
+ return 'document';
+ },
+
+ resizeBy(ref: EntityRef, factor: { x: number; y: number }): OpWorld {
+ if (factor.x === 1 && factor.y === 1) return EntityOps.worldFor(ref);
+ if (liveNow()) {
+ const live = PlayInspect.liveIdOf(ref);
+ if (live == null) return null;
+ PlayRealm.transformBy(live, { scaleBy: factor });
+ PlayEdits.record(ref, 'Transform', 'scale');
+ return 'live';
+ }
+ const src = srcIdOf(ref);
+ if (src == null) return null;
+ const sc = SceneQuery.getFieldValue(src, 'Transform', 'scale') as { x?: number; y?: number; z?: number } | null;
+ SceneCommands.setFieldValue(src, 'Transform', 'scale', scaleVecBy(sc ?? undefined, factor));
+ return 'document';
+ },
} as const;
/** The realm id a ref names right now — for callers that must speak to the realm
diff --git a/desktop/src/engine/playProtocol.ts b/desktop/src/engine/playProtocol.ts
index bf9c3544c..6c3c6a967 100644
--- a/desktop/src/engine/playProtocol.ts
+++ b/desktop/src/engine/playProtocol.ts
@@ -18,7 +18,7 @@ import type { SceneData, PhysicsPluginConfig, AudioProjectConfig, ThemeOverrides
* compares it against its own and refuses a mismatch (P1) rather than failing
* obscurely on a shape it doesn't understand. Bump on any incompatible message change.
*/
-export const PLAY_PROTOCOL_VERSION = 5;
+export const PLAY_PROTOCOL_VERSION = 6;
/**
* The handshake check: `null` if the realm's reported protocol version is compatible
@@ -226,7 +226,15 @@ export type PlayOutbound =
* world position, and to the parent-local write a Transform holds, happens
* where the camera is. The axis lock resolves after it, in world space.
*/
- | { type: 'estella:play:dragTo'; entityId: number; x: number; y: number; axis?: 'x' | 'y' };
+ | { type: 'estella:play:dragTo'; entityId: number; x: number; y: number; axis?: 'x' | 'y' }
+ /**
+ * Turn or resize a running entity by a RELATIVE amount.
+ *
+ * Neither needs the camera the way a move does: an angle about the origin and
+ * a ratio of two distances mean the same under any pan, zoom or roll. The
+ * editor computes them; the realm composes them onto the transform.
+ */
+ | { type: 'estella:play:transformBy'; entityId: number; rotateBy?: number; scaleBy?: { x: number; y: number } };
/** realm → editor. Discriminated by `type`. */
export type PlayInbound =
diff --git a/desktop/src/engine/viewportMath.ts b/desktop/src/engine/viewportMath.ts
index 517da984c..260e5b815 100644
--- a/desktop/src/engine/viewportMath.ts
+++ b/desktop/src/engine/viewportMath.ts
@@ -120,3 +120,22 @@ export function rankPickCandidates<T>(candidates: ReadonlyArray<PickCandidate<T>
.sort((a, b) => compareDrawRank(b.rank, a.rank) || b.index - a.index)
.map((c) => c.entity);
}
+
+/** A 2D rotation quaternion turned by `radians`. */
+export function turnQuat2D(q: { z?: number; w?: number } | undefined, radians: number): { x: number; y: number; z: number; w: number } {
+ const angle = quatAngleZ2D(q) + radians;
+ return { x: 0, y: 0, z: Math.sin(angle / 2), w: Math.cos(angle / 2) };
+}
+
+/** The Z angle of a 2D rotation quaternion; 0 for one that isn't there. */
+export function quatAngleZ2D(q: { z?: number; w?: number } | undefined): number {
+ return 2 * Math.atan2(q?.z ?? 0, q?.w ?? 1);
+}
+
+/** A scale vector multiplied by a per-axis factor, keeping z. */
+export function scaleVecBy(
+ s: { x?: number; y?: number; z?: number } | undefined,
+ factor: { x: number; y: number },
+): { x: number; y: number; z: number } {
+ return { x: (s?.x ?? 1) * factor.x, y: (s?.y ?? 1) * factor.y, z: s?.z ?? 1 };
+}
diff --git a/desktop/src/panels/PlayOverlay.tsx b/desktop/src/panels/PlayOverlay.tsx
index dacb9e567..f15627400 100644
--- a/desktop/src/panels/PlayOverlay.tsx
+++ b/desktop/src/panels/PlayOverlay.tsx
@@ -9,6 +9,11 @@
* about the frame — where a thing is, what is at a point, where a drag lands —
* goes to the side holding the camera.
*
+ * Move needs that camera and is sent as a point for the realm to convert. Turn
+ * and resize do not: an angle about the origin and a ratio of two distances mean
+ * the same thing under any pan, zoom or roll, so they are computed here and sent
+ * as deltas.
+ *
* Pointer events belong to the game by default; a running game you cannot click
* is not a running game. `interactive` is the editor taking them, for as long as
* the user asks for it.
@@ -18,12 +23,15 @@ import { PlayInspect } from '@/engine/PlayInspect';
import { PlayRealm } from '@/engine/PlayRealm';
import { EntityOps } from '@/engine/entityOps';
import { useSelection } from '@/store/selectionStore';
+import { useEditorStore } from '@/store/editorStore';
import type { CanvasPoint, PlayOverlayBox } from '@/engine/playProtocol';
/** Half-size of the origin handle, in CSS px. */
const HANDLE = 5;
/** Pointer travel before a press becomes a drag rather than a click-to-select. */
const DRAG_SLOP = 3;
+/** Axis arm length / ring radius, in CSS px. */
+const ARM = 44;
interface Props {
/** Whether the editor, rather than the game, receives pointer events here. */
@@ -53,15 +61,22 @@ function grabbed(box: PlayOverlayBox, p: CanvasPoint, size: { w: number; h: numb
export function PlayOverlay({ interactive }: Props) {
const overlay = useSyncExternalStore(PlayInspect.subscribe, PlayInspect.getOverlay);
const selectedRef = useSelection((s) => s.selectedRef);
+ const tool = useEditorStore((s) => s.tool);
const hostRef = useRef<HTMLDivElement>(null);
const [size, setSize] = useState({ w: 0, h: 0 });
// The grab offset in normalized canvas units, so the thing does not jump its
- // origin to the cursor the moment it is picked up.
+ // origin to the cursor the moment it is picked up; turn and resize instead
+ // remember where the gesture started, because both are relative to that.
const drag = useRef<{
dx: number; dy: number; axis?: 'x' | 'y'; moved: boolean;
/** The press did not land on the selection, so it can only end in a pick. */
pickOnly: boolean;
from: { x: number; y: number };
+ /** Pointer angle / distance about the origin when the gesture began (px). */
+ startAngle: number;
+ startDist: number;
+ lastAngle: number;
+ lastDist: number;
} | null>(null);
useEffect(() => {
@@ -79,40 +94,64 @@ export function PlayOverlay({ interactive }: Props) {
if (!box || box.width === 0 || box.height === 0) return { x: 0, y: 0 };
return { x: (e.clientX - box.left) / box.width, y: (e.clientY - box.top) / box.height };
};
+ /** Pointer angle + distance about the selection's origin, in CSS px. */
+ const polarOf = (p: CanvasPoint): { angle: number; dist: number } => {
+ if (!overlay) return { angle: 0, dist: 0 };
+ const [ox, oy] = toPx(overlay.origin, size.w, size.h);
+ const [px, py] = toPx(p, size.w, size.h);
+ // Screen y grows downward and world y upward, so the angle is negated to
+ // turn the way the pointer does.
+ return { angle: -Math.atan2(py - oy, px - ox), dist: Math.hypot(px - ox, py - oy) };
+ };
const onPointerDown = (e: React.PointerEvent) => {
if (!interactive || e.button !== 0) return;
e.preventDefault();
(e.target as Element).setPointerCapture?.(e.pointerId);
const p = pointOf(e);
- const axis = (e.target as HTMLElement).dataset?.axis as 'x' | 'y' | undefined;
- // A press only picks the selection UP if it landed on it — on a handle, or
- // inside the outline. Anywhere else is a click that selects something new,
- // not an invisible grip on whatever happened to be selected.
- const onIt = axis != null || (overlay != null && grabbed(overlay, p, size));
- if (!onIt) {
- drag.current = { dx: 0, dy: 0, moved: false, pickOnly: true, from: { x: e.clientX, y: e.clientY } };
- return;
- }
+ const data = (e.target as HTMLElement).dataset;
+ const axis = data?.axis as 'x' | 'y' | undefined;
+ // A press grabs the selection only on a HANDLE or inside the outline; a
+ // handle says so itself, because a rotate ring sits well outside the thing
+ // it turns. Anywhere else selects whatever is under the pointer.
+ const onIt = data?.grab != null || axis != null || (overlay != null && grabbed(overlay, p, size));
+ const polar = polarOf(p);
drag.current = {
dx: overlay ? overlay.origin.x - p.x : 0,
dy: overlay ? overlay.origin.y - p.y : 0,
axis,
moved: false,
- pickOnly: false,
+ pickOnly: !onIt,
from: { x: e.clientX, y: e.clientY },
+ startAngle: polar.angle,
+ startDist: polar.dist,
+ lastAngle: polar.angle,
+ lastDist: polar.dist,
};
};
const onPointerMove = (e: React.PointerEvent) => {
const d = drag.current;
- if (!interactive || !d || d.pickOnly) return;
+ if (!interactive || !d || d.pickOnly || selectedRef == null) return;
if (!d.moved) {
if (Math.hypot(e.clientX - d.from.x, e.clientY - d.from.y) < DRAG_SLOP) return;
d.moved = true;
}
- if (selectedRef == null) return;
const p = pointOf(e);
+ if (tool === 'rotate' || tool === 'scale') {
+ // Sent as the step since the last event, so the realm composes rather than
+ // needing a gesture-start value it was never told.
+ const { angle, dist } = polarOf(p);
+ if (tool === 'rotate') {
+ EntityOps.turnBy(selectedRef, angle - d.lastAngle);
+ } else if (d.lastDist > 1) {
+ const k = Math.max(0.05, dist / d.lastDist);
+ EntityOps.resizeBy(selectedRef, { x: k, y: k });
+ }
+ d.lastAngle = angle;
+ d.lastDist = dist;
+ return;
+ }
EntityOps.moveToPoint(selectedRef, { canvas: { x: p.x + d.dx, y: p.y + d.dy } }, d.axis);
};
@@ -149,16 +188,28 @@ export function PlayOverlay({ interactive }: Props) {
{origin && (
<svg className="play-ov__svg" width={size.w} height={size.h} aria-hidden="true">
{outline && <polygon className="play-ov__box" points={outline} />}
- {interactive && (
+ {interactive && tool === 'move' && (
+ <>
+ <line className="play-ov__axis x" x1={origin[0]} y1={origin[1]} x2={origin[0] + ARM} y2={origin[1]} />
+ <line className="play-ov__axis y" x1={origin[0]} y1={origin[1]} x2={origin[0]} y2={origin[1] - ARM} />
+ <rect className="play-ov__grab x" data-grab="move" data-axis="x" x={origin[0] + ARM - 14} y={origin[1] - 6} width={16} height={12} />
+ <rect className="play-ov__grab y" data-grab="move" data-axis="y" x={origin[0] - 6} y={origin[1] - ARM - 2} width={12} height={16} />
+ </>
+ )}
+ {interactive && tool === 'rotate' && (
+ <circle className="play-ov__ring" data-grab="rotate" cx={origin[0]} cy={origin[1]} r={ARM} />
+ )}
+ {interactive && tool === 'scale' && (
<>
- <line className="play-ov__axis x" x1={origin[0]} y1={origin[1]} x2={origin[0] + 44} y2={origin[1]} />
- <line className="play-ov__axis y" x1={origin[0]} y1={origin[1]} x2={origin[0]} y2={origin[1] - 44} />
- <rect className="play-ov__grab x" data-axis="x" x={origin[0] + 30} y={origin[1] - 6} width={16} height={12} />
- <rect className="play-ov__grab y" data-axis="y" x={origin[0] - 6} y={origin[1] - 46} width={12} height={16} />
+ <line className="play-ov__axis x" x1={origin[0]} y1={origin[1]} x2={origin[0] + ARM} y2={origin[1]} />
+ <line className="play-ov__axis y" x1={origin[0]} y1={origin[1]} x2={origin[0]} y2={origin[1] - ARM} />
+ <rect className="play-ov__box-end x" data-grab="scale" x={origin[0] + ARM - 5} y={origin[1] - 5} width={10} height={10} />
+ <rect className="play-ov__box-end y" data-grab="scale" x={origin[0] - 5} y={origin[1] - ARM - 5} width={10} height={10} />
</>
)}
<rect
className="play-ov__origin"
+ data-grab="move"
x={origin[0] - HANDLE}
y={origin[1] - HANDLE}
width={HANDLE * 2}
diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsx
index abdd9043f..a86e15945 100644
--- a/desktop/src/panels/Viewport.tsx
+++ b/desktop/src/panels/Viewport.tsx
@@ -2082,7 +2082,7 @@ export function Viewport() {
};
return (
- <div className={`viewport${playInViewport ? ' viewport--play' : ''}${playInViewport && isPaused ? ' viewport--paused' : ''}`}>
+ <div className={`viewport${playInViewport ? ' viewport--play' : ''}${playInViewport && isPaused ? ' viewport--paused' : ''}${inspectPlay ? ' viewport--inspect' : ''}`}>
{/* Docked scene toolbar under the panel tabs — view menus + display controls
on the left, quick display toggles pinned right. Tool selection lives in the
floating palette over the canvas (.ov-left). */}
diff --git a/desktop/src/playHost.ts b/desktop/src/playHost.ts
index a176f829f..e3c2335ee 100644
--- a/desktop/src/playHost.ts
+++ b/desktop/src/playHost.ts
@@ -20,7 +20,7 @@ import type { ESEngineModule } from 'esengine/wasm';
import { PLAY_PROTOCOL_VERSION } from './engine/playProtocol';
import type { PlayOutbound, PlayInbound, LiveVisibility, CanvasPoint, PlayOverlayBox } from './engine/playProtocol';
import { translateAssetHandles, projectRelative } from './engine/liveAssetRefs';
-import { pointInOBB, rankPickCandidates, worldToLocal2D, type PickCandidate } from '@/engine/viewportMath';
+import { pointInOBB, rankPickCandidates, worldToLocal2D, turnQuat2D, scaleVecBy, type PickCandidate } from '@/engine/viewportMath';
import {
inspectEntity, findEntities, readResources, readSystems,
type Realm, type EntityFilter,
@@ -255,6 +255,18 @@ function pickAt(world: App['world'], nx: number, ny: number): number | null {
return rankPickCandidates(hits)[0] ?? null;
}
+/** Turn / resize a running entity by a relative amount, composed onto what it
+ * already has. Local, because rotation and scale are inherited multiplicatively
+ * and a delta on the local value is the delta a person sees on the world one. */
+function transformBy(world: App['world'], entity: number, rotateBy?: number, scaleBy?: { x: number; y: number }): void {
+ const transformDef = getComponent('Transform');
+ if (!transformDef || !world.valid(entity as never)) return;
+ const data = { ...(world.get(entity as never, transformDef) as Record<string, unknown>) };
+ if (rotateBy) data.rotation = turnQuat2D(data.rotation as { z?: number; w?: number } | undefined, rotateBy);
+ if (scaleBy) data.scale = scaleVecBy(data.scale as { x?: number; y?: number } | undefined, scaleBy);
+ world.set(entity as never, transformDef, data as never);
+}
+
/**
* Put an entity's origin at a canvas point. `Transform.position` is
* parent-local, so a parented entity's world target is re-expressed in its
@@ -1107,6 +1119,9 @@ window.addEventListener('message', (e: MessageEvent) => {
case 'estella:play:dragTo':
if (app && data.entityId != null) dragTo(app.world, data.entityId, data.x, data.y, data.axis);
break;
+ case 'estella:play:transformBy':
+ if (app && data.entityId != null) transformBy(app.world, data.entityId, data.rotateBy, data.scaleBy);
+ break;
}
});
diff --git a/desktop/src/theme/viewport.css b/desktop/src/theme/viewport.css
index 28fab7e29..f3b8ef619 100644
--- a/desktop/src/theme/viewport.css
+++ b/desktop/src/theme/viewport.css
@@ -304,6 +304,10 @@
.play-ov__axis { stroke-width: 2.5; }
.play-ov__axis.x { stroke: var(--error); }
.play-ov__axis.y { stroke: var(--run); }
+.play-ov__ring { fill: none; stroke: var(--run); stroke-width: 2.5; cursor: grab; pointer-events: stroke; }
+.play-ov__box-end { stroke: rgba(0, 0, 0, 0.6); stroke-width: 1; cursor: nwse-resize; }
+.play-ov__box-end.x { fill: var(--error); }
+.play-ov__box-end.y { fill: var(--run); }
.play-ov__grab { fill: transparent; cursor: move; }
.play-ov.interactive .play-ov__grab.x { fill: var(--error); }
.play-ov.interactive .play-ov__grab.y { fill: var(--run); }
@@ -366,6 +370,10 @@
.viewport--play .ov-left {
display: none;
}
+/* …except the transform tools while the editor holds the pointer: picking a
+ tool is how you say which gizmo you want, and Inspect mode is where it acts.
+ Above the play layer, or it is only clickable by something that isn't looking. */
+.viewport--play.viewport--inspect .ov-left { display: block; z-index: 8; }
/* "This viewport is live" reads as a soft accent ring around the frame — not a
pill over the game. Non-interactive, above the play iframe (z 7, matching the old
diff --git a/desktop/tests/entity-ops.test.ts b/desktop/tests/entity-ops.test.ts
index ec9792c5d..3fcddb991 100644
--- a/desktop/tests/entity-ops.test.ts
+++ b/desktop/tests/entity-ops.test.ts
@@ -13,13 +13,14 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
vi.mock('@/engine/SceneCommands', () => ({
SceneCommands: {
setField: vi.fn(),
+ setFieldValue: vi.fn(),
setEntityVisible: vi.fn(),
setEntityXY: vi.fn(),
},
toModelValue: (_cur: unknown, _type: unknown, _key: string, value: unknown) => value,
}));
vi.mock('@/engine/PlayRealm', () => ({
- PlayRealm: { setField: vi.fn(), setVisible: vi.fn(), dragTo: vi.fn(), snapshot: vi.fn() },
+ PlayRealm: { setField: vi.fn(), setVisible: vi.fn(), dragTo: vi.fn(), transformBy: vi.fn(), snapshot: vi.fn() },
}));
import { EntityOps } from '@/engine/entityOps';
@@ -28,6 +29,7 @@ import { PlayRealm } from '@/engine/PlayRealm';
import { PlayInspect } from '@/engine/PlayInspect';
import { useEditorStore } from '@/store/editorStore';
import { authoredRef, spawnedRef } from '@/engine/entityRef';
+import { SceneQuery } from '@/engine/SceneQuery';
/** Play, with the realm holding runtime 900 for document row 3 and nothing else. */
function playingWith(pairs: Array<{ live: number; src?: number }>) {
@@ -105,3 +107,38 @@ describe('while playing', () => {
expect(PlayRealm.setField).not.toHaveBeenCalled();
});
});
+
+describe('turning and resizing', () => {
+ it('composes onto what the document already has', () => {
+ const q = Math.SQRT1_2; // a quarter turn
+ vi.spyOn(SceneQuery, 'getFieldValue').mockReturnValue({ z: q, w: q } as never);
+ expect(EntityOps.turnBy(authoredRef(3), Math.PI / 2)).toBe('document');
+ const [, , , value] = vi.mocked(SceneCommands.setFieldValue).mock.calls[0];
+ // Quarter + quarter = half: z 1, w 0.
+ expect((value as { z: number }).z).toBeCloseTo(1);
+ expect((value as { w: number }).w).toBeCloseTo(0);
+ });
+
+ it('multiplies a resize rather than replacing it', () => {
+ vi.spyOn(SceneQuery, 'getFieldValue').mockReturnValue({ x: 2, y: 3, z: 1 } as never);
+ EntityOps.resizeBy(authoredRef(3), { x: 2, y: 0.5 });
+ const [, , , value] = vi.mocked(SceneCommands.setFieldValue).mock.calls[0];
+ expect(value).toEqual({ x: 4, y: 1.5, z: 1 });
+ });
+
+ it('sends a relative delta to the realm, never a projected point', () => {
+ playingWith([{ live: 900, src: 3 }]);
+ EntityOps.turnBy(authoredRef(3), 0.25);
+ EntityOps.resizeBy(authoredRef(3), { x: 1.1, y: 1.1 });
+ // A delta needs no camera, which is why these two ops have no canvas point.
+ expect(PlayRealm.transformBy).toHaveBeenCalledWith(900, { rotateBy: 0.25 });
+ expect(PlayRealm.transformBy).toHaveBeenCalledWith(900, { scaleBy: { x: 1.1, y: 1.1 } });
+ });
+
+ it('does nothing at all for a zero delta', () => {
+ playingWith([{ live: 900, src: 3 }]);
+ EntityOps.turnBy(authoredRef(3), 0);
+ EntityOps.resizeBy(authoredRef(3), { x: 1, y: 1 });
+ expect(PlayRealm.transformBy).not.toHaveBeenCalled();
+ });
+});
diff --git a/docs/astro/src/content/docs/editor/play.mdx b/docs/astro/src/content/docs/editor/play.mdx
index 83e7bdc99..11e25ce15 100644
--- a/docs/astro/src/content/docs/editor/play.mdx
+++ b/docs/astro/src/content/docs/editor/play.mdx
@@ -33,8 +33,9 @@ fold and hide rows, but not rename, reparent, create or delete.
The selected entity is outlined on the running frame. Turn on **Inspect** (above the
game) and the pointer belongs to the editor instead of the game: click to select what is
-under it, drag the entity to move it, or drag an axis handle to move it along one. It is
-off by default, because a game you cannot click is not a game.
+under it, then move, turn or resize it with the transform tools, which appear beside the
+frame while Inspect is on and answer to the same **W / E / R** keys they do when
+editing. It is off by default, because a game you cannot click is not a game.
The running world is what answers all of this — where the entity is drawn, what is under
the pointer, where a drag lands — so it is the game's own camera doing the projection,
diff --git a/docs/astro/src/content/docs/zh-cn/editor/play.mdx b/docs/astro/src/content/docs/zh-cn/editor/play.mdx
index b15115cfe..acc49c224 100644
--- a/docs/astro/src/content/docs/zh-cn/editor/play.mdx
+++ b/docs/astro/src/content/docs/zh-cn/editor/play.mdx
@@ -24,7 +24,8 @@ description: "在隔离 realm 里于编辑器内运行游戏、运行模式选
## 运行中移动实体
选中的实体会在运行画面上被描边。打开画面上方的**检视**,指针就归编辑器而不是游戏:点击选中
-指针下的东西,拖拽移动它,或拖某根轴手柄让它只沿那根轴走。默认关闭——点不动的游戏不算游戏。
+指针下的东西,然后用变换工具移动、旋转、缩放它——检视开启时工具栏会出现在画面旁边,和编辑时
+一样认 **W / E / R**。默认关闭——点不动的游戏不算游戏。
这些问题全部由运行中的世界回答——实体画在哪、指针下是谁、拖拽落到哪——用的是游戏自己的
相机做投影,所以移动后的位置就是游戏接下来会画的位置。和任何运行期修改一样,它到停止为止。