Describe the collider and rigidbody picker and Fit to sprite (#222)

admin committed 2026-09-23 18:29:44 +02:00
1 parent 136a73ad5a
commit 408974392d
5 files changed
+23 -11

No files matched your search

+15 -5
@@ -1,11 +1,21 @@
A **collider** is an asset (`shape` box, circle, capsule, polygon or frame collision — see
[Shapes](#shapes)) placed like any
other object — typically as a child of the sprite it belongs to, so its position is the offset
from that *body* and it moves with it. Right-click an object in **Scene objects** → *Add
collider* to get one with one click: a box collider sized like the
sprite, parented at its centre. Colliders can be reused across objects, overridden per instance
and stacked (hitbox + hurtbox on one sprite; colliders of the same body never collide with each
other). They are editor symbols: green outlines in edit mode, invisible in play mode. Three more rows —
from that *body* and it moves with it. Right-click an object in **Scene objects** (or in the scene
view) → *Add collider…*: a second menu offers **Create new collider** — a box collider sized like
the sprite, parented at its centre — and below it every collider of the project, with a search
field on top (#222). Picking one places that asset as it is, no copy made; a collider the object
wears already is greyed out. Colliders can be reused across objects that way, overridden per
instance and stacked (hitbox + hurtbox on one sprite; colliders of the same body never collide
with each other).
**Fit to sprite** (#222) in the menu of a placed collider sizes it like the sprite it sits on and
centres it there — handy after the sprite changed size or the collider was dragged aside. The size
goes into this placement's overrides, so other sprites wearing the same collider keep theirs; a
value equal to the asset's own clears the override instead. The collider's own scale is divided
out, a collider turned by a quarter swaps width and height, and a circle takes the radius that fits
inside. A polygon or frame outline has no size to fit, and a collider that does not sit on a
sprite has nothing to fit to: the entry is greyed out for both. They are editor symbols: green outlines in edit mode, invisible in play mode. Three more rows —
friction, bounciness, density — are the material a rigidbody feels (see [Physics](Physics)).
A collider takes the transform of its body: a box turns and grows with the sprite it sits on, a
+3 -2
@@ -68,8 +68,9 @@ Right-clicking a row offers *Set as active scene*, *Set as start scene* / *Clear
*Create sprite from texture*, *Create animation from texture* and *Delete…*. In
**Scene objects** it offers *Select asset*, *Open asset* (the same as double-clicking the asset
in the asset panel; greyed out for a kind that has no editor of its own, such as a sprite or a
camera), *Add collider*, *Create container*, *Unpack container*, *Unparent*,
*Expand all* / *Collapse all* and *Remove*. The scene view's right-click menu is the same.
camera), *Add collider…* and *Add rigidbody…* (each opens a searchable menu: a new one or one
the project has, see [Colliders](Colliders)), *Fit to sprite* on a collider, *Create container*,
*Unpack container*, *Unparent*, *Expand all* / *Collapse all* and *Remove*. The scene view's right-click menu is the same.
Both menus also offer **one *Open …* entry per asset the values point at** (#221): a sprite
wearing a picture and a shader has *Open texture* and *Open shader*, in the asset panel at the
top, for a placed object right below *Open asset*. They read the object's own values, so an
+1 -1
@@ -14,7 +14,7 @@ npm run build # writes dist/ and regenerates index.html
./build.sh # the same under `set -o pipefail`, for callers that pipe the output
php tools/make-user.php <name> <password> [admin|user] # an account; every tool signs in (see Accounts)
php tests/php/accounts.test.php # the API's account rules, no server needed (CI's gate job)
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1345 editor checks, screenshots in /tmp/gm-e2e-*.png
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1348 editor checks, screenshots in /tmp/gm-e2e-*.png
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
./e2e.sh start [GM_STEPS] # the same run detached, see below
./e2e.sh status # live progress, or the last run's result
+3 -2
@@ -5,8 +5,9 @@ before the engine — see *Without a rigidbody* below.
## The rigidbody
A **rigidbody** is an asset placed as a child of the object it moves, like a collider. Right-click
an object in **Scene objects** → *Add rigidbody*; an object takes one at most, and a collider, a
behavior, a tilemap or another rigidbody takes none. It is drawn as a green ring with an arrow in
an object in **Scene objects** → *Add rigidbody…* and pick **Create new rigidbody** or one the
project has already (searchable, the same as for colliders, #222); an object takes one at most,
and a collider, a behavior, a tilemap or another rigidbody takes none. It is drawn as a green ring with an arrow in
edit mode and not at all in the game. Its rows:
| Row | Default | What it does |
+1 -1
@@ -67,7 +67,7 @@ label in.
Rows with children **fold**: click the chevron (or press ←/→, or double-click the row) to open
and close a subtree, right-click → **Expand all** / **Collapse all** for the whole scene. A
scene opens fully collapsed — which rows are open is view state of the panel, never stored in
the project — and selecting an object anywhere (viewport, `Add collider`, `Create container`)
the project — and selecting an object anywhere (viewport, `Add collider…`, `Create container`)
unfolds the way down to it and scrolls it into view, so a selection is never hidden. In
play mode entities carry the same `parent` link: moving a parent entity moves its subtree,
`Destroy` removes it. `Get position` exposes both the local and the world coordinates.