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.

fix(examples): the character-rig hero and knight stand where the scene puts them

esenginef9ad3e72141d
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e9d9d8c1d..5476a36ff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -34,6 +34,9 @@ published separately; it ships inside the editor.
### Fixed
+- **Retargeting works: one character's clips play on another's skeleton.** A controller's `avatar` — the rig its clips were authored on — was never loaded, so no retarget ever ran and a second rig played the clips' raw values. It is loaded with the controller now, and the retarget carries each joint's turn through the two rigs' own spaces, so skeletons that stand on different axes (one Z-up under a turned root, one Y-up) read a clip alike, and a clip that moves the hips moves them from the target's own rest, scaled by the rigs' sizes. An avatar states this in two new optional fields, `space` and `restPosition`.
+- **A prefab instance's override that names no entity of its prefab is reported.** It was applied nowhere and said nothing; loading a scene now warns which instance and which entity, and `check-prefab-overrides` holds every shipped scene to it.
+- **The `character-rig` example shows what it is for.** Its hero's position and Animator were overridden on an entity the prefab does not have, so the hero stood at the origin in its bind pose; and without the retarget its knight lay on its back with its head at the camera. Both now stand side by side, both animated, and the camera frames them.
- **A hard shadow's edge is a clean line, not a row of stair-steps.** Its four samples of the shadow map were weighted equally, so the edge moved in whole texels of the map, and wherever the shadow crossed the map's grid at an angle — which is almost everywhere — its edge showed the grid as dotted steps. It is now filtered over the 3×3 texels around each point, weighted by where it falls among them: on a shadow at 30° to the map the edge strays 0.05 px from a straight line, where it strayed 0.25.
- **A drawn sky is the panorama you imported, not a blur of it.** The sky was drawn from the environment's reflection atlas — the whole sphere in 128 texels a side, laid out so a straight horizon became a staircase and a round sun an oval, and filtered in its encoded form, which blotted every sharp edge. Importing a `.hdr` now also writes the panorama at its own resolution (up to 2048 wide; `skyWidth` in the import settings, 0 for none), the sky is drawn from it, and a package carries it. Environments imported before draw their sky from the atlas as they did. The `lighting-3d` example draws its sky, from a panorama generated at 1024×512.
- **A drawn sky no longer vanishes, or half-vanishes, as the view turns.** The sky was a quad on the far plane, and where rounding put it a hair past that plane it was clipped: in the editor, with its distant far plane, more than half the angles showed black behind the grid, or a sky cut along a diagonal. It now sits inside the view volume and fills the frame from every angle, in the editor and in the game.
diff --git a/examples/character-rig/assets/scenes/main.esscene b/examples/character-rig/assets/scenes/main.esscene
index edfda74a5..69aad412c 100644
--- a/examples/character-rig/assets/scenes/main.esscene
+++ b/examples/character-rig/assets/scenes/main.esscene
@@ -14,8 +14,8 @@
"data": {
"position": {
"x": 0,
- "y": 95,
- "z": 330
+ "y": 105,
+ "z": 450
}
}
},
@@ -76,7 +76,7 @@
"prefab": "assets/models/hero.esprefab",
"overrides": [
{
- "prefabEntityId": "n54",
+ "prefabEntityId": "n24",
"type": "property",
"componentType": "Transform",
"propertyName": "position",
@@ -87,7 +87,7 @@
}
},
{
- "prefabEntityId": "n54",
+ "prefabEntityId": "n24",
"type": "component_added",
"componentType": "Animator",
"componentData": {
diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjs
index 8832bc0a4..4113a0412 100644
--- a/tools/goldenProjects.mjs
+++ b/tools/goldenProjects.mjs
@@ -738,6 +738,15 @@ export const GOLDEN = [
// Measured on a runner of its own: 26 of 30 settle frames inside the 30 s
// default. Beside two other launches it had been getting three times that.
launchTimeoutMs: 180_000,
+ // The hero left of centre only through its instance's override, the knight
+ // upright only through the retarget: without it the hero's clips lay the
+ // knight on its back, helmet and boots nowhere near these points.
+ webPixels: [
+ { what: 'the hero stands where its override puts it', x: 0.372, y: 0.406, rgb: [166, 81, 17], tol: 28 },
+ { what: 'the knight\'s helmet is at the top of it', x: 0.610, y: 0.228, rgb: [123, 129, 123], tol: 24 },
+ { what: 'its belt at the middle', x: 0.616, y: 0.638, rgb: [139, 85, 63], tol: 24 },
+ { what: 'its boots on the ground', x: 0.573, y: 0.758, rgb: [61, 64, 61], tol: 24 },
+ ],
},
{
id: 'third-person-3d',
diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjs
index 1a99556d6..621024ef7 100644
--- a/tools/releaseNotes.mjs
+++ b/tools/releaseNotes.mjs
@@ -988,6 +988,12 @@ export const NOTED = {
{ note: 'A frame can be captured draw call by draw call, and replayed up to any one of them.' },
'feat(render): a frame capture lists every texture a draw bound':
{ note: 'A frame can be captured draw call by draw call, and replayed up to any one of them.' },
+ 'fix(animation): a controller loads the avatar its clips were authored on, and retargets through each rig\'s space':
+ { note: 'Retargeting works: one character\'s clips play on another\'s skeleton.' },
+ 'fix(prefab): an override that names no entity of its prefab is reported':
+ { note: 'A prefab instance\'s override that names no entity of its prefab is reported.' },
+ 'fix(examples): the character-rig hero and knight stand where the scene puts them':
+ { note: 'The `character-rig` example shows what it is for.' },
'feat(render): a directional light\'s source is the sun\'s size by default':
{ note: 'A Directional light\'s source is the sun\'s size by default, so its shadows have a penumbra.' },
'fix(render): a hard shadow\'s edge is filtered, not stepped along the shadow map\'s grid':