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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
docs: add sprite-pivot and one-way-platform diagrams (en + zh)
yhh82e7950736d6
diff --git a/docs/astro/src/assets/guides/oneway-platform.svg b/docs/astro/src/assets/guides/oneway-platform.svgnew file mode 100644index 000000000..16ce7e14a--- /dev/null+++ b/docs/astro/src/assets/guides/oneway-platform.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 212" width="448" height="212" role="img"><defs><marker id="g" markerWidth="8" markerHeight="8" refX="6" refY="4" orient="auto"><path d="M0 0 L8 4 L0 8 z" fill="#22c55e"/></marker><marker id="b" markerWidth="8" markerHeight="8" refX="6" refY="4" orient="auto"><path d="M0 0 L8 4 L0 8 z" fill="#8b91a0"/></marker><marker id="r" markerWidth="8" markerHeight="8" refX="6" refY="4" orient="auto"><path d="M0 0 L8 4 L0 8 z" fill="#ef4444"/></marker></defs><text x="224" y="22" fill="#c7cdd8" font-size="13" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">One-way platform — solid from the normal side only</text><rect x="70" y="118" width="308" height="12" rx="3" fill="#3b82f6" fill-opacity="0.28" stroke="#4aa3ff" stroke-width="1.4"/><line x1="224" y1="118" x2="224" y2="88" stroke="#22c55e" stroke-width="1.8" marker-end="url(#g)"/><text x="224" y="80" fill="#5fbf7f" font-size="10" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">normal (solid side)</text><circle cx="130" cy="164" r="12" fill="#4aa3ff" fill-opacity="1" stroke="#0d0e11" stroke-width="1.5" stroke-opacity="1"/><line x1="130" y1="152" x2="130" y2="78" stroke="#8b91a0" stroke-width="1.6" stroke-dasharray="5 3" marker-end="url(#b)"/><circle cx="130" cy="74" r="12" fill="#4aa3ff" fill-opacity="0.28" stroke="#0d0e11" stroke-width="1.5" stroke-opacity="0.28"/><text x="130" y="192" fill="#aeb6c6" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">from below:</text><text x="130" y="208" fill="#8b91a0" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">passes through</text><circle cx="318" cy="72" r="12" fill="#4aa3ff" fill-opacity="1" stroke="#0d0e11" stroke-width="1.5" stroke-opacity="1"/><line x1="318" y1="84" x2="318" y2="112" stroke="#8b91a0" stroke-width="1.6" marker-end="url(#r)"/><line x1="305" y1="117" x2="331" y2="117" stroke="#ef4444" stroke-width="2.4"/><text x="318" y="192" fill="#aeb6c6" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">from above:</text><text x="318" y="208" fill="#d67d7d" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">lands on top</text></svg>\ No newline at end of filediff --git a/docs/astro/src/assets/guides/sprite-pivot.svg b/docs/astro/src/assets/guides/sprite-pivot.svgnew file mode 100644index 000000000..a3d2403f6--- /dev/null+++ b/docs/astro/src/assets/guides/sprite-pivot.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 208" width="600" height="208" role="img"><text x="300" y="20" fill="#c7cdd8" font-size="13" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">The pivot is the point a sprite rotates about</text><polygon points="68.0,66.0 142.0,66.0 142.0,118.0 68.0,118.0" fill="none" stroke="#5b616e" stroke-width="1.2" stroke-dasharray="4 3"/><polygon points="81.8,53.2 149.4,83.3 128.2,130.8 60.6,100.7" fill="#3b82f6" fill-opacity="0.22" stroke="#4aa3ff" stroke-width="1.6"/><circle cx="105" cy="92" r="4.5" fill="#f5c542" stroke="#0d0e11" stroke-width="1.2"/><text x="105" y="176" fill="#e6b93f" font-size="12" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">{0.5, 0.5}</text><text x="105" y="192" fill="#8b91a0" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">center (default)</text><polygon points="300.0,40.0 374.0,40.0 374.0,92.0 300.0,92.0" fill="none" stroke="#5b616e" stroke-width="1.2" stroke-dasharray="4 3"/><polygon points="321.2,44.5 388.8,74.6 367.6,122.1 300.0,92.0" fill="#3b82f6" fill-opacity="0.22" stroke="#4aa3ff" stroke-width="1.6"/><circle cx="300" cy="92" r="4.5" fill="#f5c542" stroke="#0d0e11" stroke-width="1.2"/><text x="300" y="176" fill="#e6b93f" font-size="12" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">{0, 0}</text><text x="300" y="192" fill="#8b91a0" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">bottom-left</text><polygon points="458.0,40.0 532.0,40.0 532.0,92.0 458.0,92.0" fill="none" stroke="#5b616e" stroke-width="1.2" stroke-dasharray="4 3"/><polygon points="482.3,29.4 550.0,59.5 528.8,107.0 461.2,77.0" fill="#3b82f6" fill-opacity="0.22" stroke="#4aa3ff" stroke-width="1.6"/><circle cx="495" cy="92" r="4.5" fill="#f5c542" stroke="#0d0e11" stroke-width="1.2"/><text x="495" y="176" fill="#e6b93f" font-size="12" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">{0.5, 0}</text><text x="495" y="192" fill="#8b91a0" font-size="11" font-weight="600" text-anchor="middle" font-family="ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif">bottom-center</text></svg>\ No newline at end of filediff --git a/docs/astro/src/content/docs/guides/physics.mdx b/docs/astro/src/content/docs/guides/physics.mdxindex bac2dfd86..7a706ed38 100644--- a/docs/astro/src/content/docs/guides/physics.mdx+++ b/docs/astro/src/content/docs/guides/physics.mdx@@ -320,6 +320,8 @@ means "solid top". Set `enabled: false` to turn the platform back into a normalIn the editor, a one-way platform's collider gizmo grows an arrow along the solid-sidenormal, so which way it carries is visible at a glance.++## Mouse / drag jointTo let the player drag a body with the pointer, use the drag-joint API. Box2D v3 has nodiff --git a/docs/astro/src/content/docs/guides/sprites.mdx b/docs/astro/src/content/docs/guides/sprites.mdxindex 7783c75f8..32262f22b 100644--- a/docs/astro/src/content/docs/guides/sprites.mdx+++ b/docs/astro/src/content/docs/guides/sprites.mdx@@ -70,6 +70,8 @@ Scale on the `Transform` multiplies on top of it. `pivot` is the normalized anchbottom-left corner, `{0.5, 0}` pins the bottom-center (handy for characters standing onthe ground).++## Units & coordinatesWorld units are **design pixels**. Dropping a texture into the viewport spawns adiff --git a/docs/astro/src/content/docs/zh-cn/guides/physics.mdx b/docs/astro/src/content/docs/zh-cn/guides/physics.mdxindex e1e426a89..c77409abd 100644--- a/docs/astro/src/content/docs/zh-cn/guides/physics.mdx+++ b/docs/astro/src/content/docs/zh-cn/guides/physics.mdx@@ -303,6 +303,8 @@ world.spawn(让平台恢复为普通实心体。在编辑器里,单向平台的碰撞体 gizmo 会沿实心侧法线多画一支箭头,朝向一眼可辨。++## 鼠标 / 拖拽关节想让玩家用指针拖动刚体,用拖拽关节 API。Box2D v3 没有专门的鼠标关节,这是它的官方替代——一根diff --git a/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx b/docs/astro/src/content/docs/zh-cn/guides/sprites.mdxindex 4da3f610a..3ef9a1fc7 100644--- a/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx+++ b/docs/astro/src/content/docs/zh-cn/guides/sprites.mdx@@ -63,6 +63,8 @@ sprite.color = { r: 1, g: 1, b: 1, a: 0.5 }; // 50% 透明1:1,或设成别的值来缩放。`Transform` 上的缩放会再乘上去。`pivot` 是精灵旋转/缩放所绕的归一化轴心(0–1):`{0.5, 0.5}` 居中,`{0, 0}` 是左下角,`{0.5, 0}` 钉住底部中心(适合站在地面上的角色)。++## 单位与坐标世界单位就是**设计像素**。把纹理拖进视口会生成一个尺寸等于纹理像素尺寸的精灵