Aus #193 („Nicht gebaut, nur Idee: Add collider auf einem Sprite, dessen Frame einen Umriss hat, könnte gleich ‚Frame collision‘ wählen. Heute gibt es dort immer eine Box.“).
Befund
Seit #193 gibt es die Collider-Form Frame collision, verknüpft mit den Kollisions-Umrissen eines Frames. Seit #161 erzeugt Generate collision… im Texture-Tab diese Umrisse auf Knopfdruck.
AddColliderCommand (src/core/commands/colliderCommands.ts:49 ff.) legt aber immer eine Box in Sprite-Größe an. Wer die Umrisse gezeichnet hat, muss danach am neuen Collider Shape → Frame collision und den Frame von Hand wählen.
Zu bauen (Vorschlag)
Trägt das Sprite als Bild einen Frame mit mindestens einem Umriss, legt Add collider einen Collider mit Form frame und genau diesem Frame an. Sonst bleibt es bei der Box wie heute.
Die Regel „welche Form bekommt der neue Collider“ als reine Funktion neben dem Command.
Tests: Unit für beide Fälle (Frame mit Umriss → frame, Frame ohne Umriss, ganze Textur oder Vector Art → Box). e2e in Modul 42: Rechtsklick → Add collider auf dem Sprite mit dem Keil-Frame, der Collider hat die Frame-Form.
Offen (mit Vorschlag)
Animierte Sprites (das Bild wechselt den Frame)? Vorschlag: Es zählt der Frame, der beim Anlegen im Inspector steht. Wie #161 schon festhält, baut Rapier den Collider nicht pro Frame um.
Aus #193 („Nicht gebaut, nur Idee: *Add collider* auf einem Sprite, dessen Frame einen Umriss hat, könnte gleich ‚Frame collision‘ wählen. Heute gibt es dort immer eine Box.“).
## Befund
- Seit #193 gibt es die Collider-Form **Frame collision**, verknüpft mit den Kollisions-Umrissen eines Frames. Seit #161 erzeugt *Generate collision…* im Texture-Tab diese Umrisse auf Knopfdruck.
- `AddColliderCommand` (`src/core/commands/colliderCommands.ts:49` ff.) legt aber immer eine Box in Sprite-Größe an. Wer die Umrisse gezeichnet hat, muss danach am neuen Collider *Shape → Frame collision* und den Frame von Hand wählen.
## Zu bauen (Vorschlag)
- Trägt das Sprite als Bild einen Frame mit mindestens einem Umriss, legt *Add collider* einen Collider mit Form `frame` und genau diesem Frame an. Sonst bleibt es bei der Box wie heute.
- Die Regel „welche Form bekommt der neue Collider“ als reine Funktion neben dem Command.
- Tests: Unit für beide Fälle (Frame mit Umriss → `frame`, Frame ohne Umriss, ganze Textur oder Vector Art → Box). e2e in Modul 42: Rechtsklick → *Add collider* auf dem Sprite mit dem Keil-Frame, der Collider hat die Frame-Form.
## Offen (mit Vorschlag)
1. **Animierte Sprites** (das Bild wechselt den Frame)? Vorschlag: Es zählt der Frame, der beim Anlegen im Inspector steht. Wie #161 schon festhält, baut Rapier den Collider nicht pro Frame um.
meleki
added the new label 2026-09-23 07:05:35 +02:00
Done in d39bf83, wiki 21704ca (Colliders, Development).
What changes
"Add collider…" → "Create new collider" on a sprite whose picture is a frame with an outline makes a collider with "Frame collision" and exactly that frame. Anything else keeps the box of the sprite's size.
The frame that counts is the one the sprite shows when the collider is added, also when only this placement overrides it. An animation changing the frame later does not change the collider, as agreed in the issue.
Decided here, the issue says nothing about size
A frame collider is always as big as its frame (one pixel is one unit), and a collider only scales evenly.
Sprite bigger or smaller than the frame, same proportions: the new collider gets Scale set to match (sprite 64 wide, frame 32: scale 2), so the outline covers the picture.
Sprite stretched out of the frame's proportions: it keeps the box, because an outline cannot be stretched in one direction. Taking the outline at its original size instead would be one line.
Under the hood
The rule is the pure function newColliderProps in src/core/commands/colliderCommands.ts, next to the command, as the issue asks. AddColliderCommand.build only assigns what it returns.
It reads the resolved texture of the placement, looks the outline up with frameOutline and compares proportions with matchesAspect.
Three new unit tests in tests/core/collider-parts.test.ts:
a frame with an outline gives frame, and one undo takes collider and asset away again
a bigger sprite gets the scale, and the frame overridden on the placement is read
without an outline, with the whole texture or stretched it stays the box
42e-ii goes through the context menu with a right click. The sprite wearing the wedge frame gets "Frame collision" with scale 2 at the sprite's size, a sprite without a picture gets the box.
Screenshot looked at: the wedge outline covers the sprite, the inspector shows "Frame collision" and scale 2.
Counter-check
Result
Five in the unit tests (on stein2, not in the container)
all work, 1 to 2 tests fail each
Browser: the rule bent, build went through
42e-ii fails with shape: box
The e2e sum of 1617 is calculated (1616 + 1). Neither the full suite nor the smokes ran for this state on melektaus-atx; the CI run for d39bf83 was not waited for.
Vector art has no test of its own. It takes the same branch as a whole texture (the id is not a frame).
Done in `d39bf83`, wiki `21704ca` (*Colliders*, *Development*).
**What changes**
- **"Add collider…" → "Create new collider" on a sprite whose picture is a frame with an outline makes a collider with "Frame collision" and exactly that frame.** Anything else keeps the box of the sprite's size.
- The frame that counts is the one the sprite shows when the collider is added, also when only this placement overrides it. An animation changing the frame later does not change the collider, as agreed in the issue.
**Decided here, the issue says nothing about size**
A frame collider is always as big as its frame (one pixel is one unit), and a collider only scales evenly.
- **Sprite bigger or smaller than the frame, same proportions:** the new collider gets *Scale* set to match (sprite 64 wide, frame 32: scale 2), so the outline covers the picture.
- **Sprite stretched out of the frame's proportions:** it keeps the box, because an outline cannot be stretched in one direction. Taking the outline at its original size instead would be one line.
**Under the hood**
- The rule is the pure function `newColliderProps` in `src/core/commands/colliderCommands.ts`, next to the command, as the issue asks. `AddColliderCommand.build` only assigns what it returns.
- It reads the resolved `texture` of the placement, looks the outline up with `frameOutline` and compares proportions with `matchesAspect`.
**Tests** (on `melektaus-atx`)
```
gate 198 files, 2914 tests, CHECK EXIT 0 (2911 + 3)
e2e 8,42 ALL PASSED - 46 checks (42: +1 for 42e-ii)
```
- Three new unit tests in `tests/core/collider-parts.test.ts`:
- a frame with an outline gives `frame`, and one undo takes collider and asset away again
- a bigger sprite gets the scale, and the frame overridden on the placement is read
- without an outline, with the whole texture or stretched it stays the box
- **42e-ii** goes through the context menu with a right click. The sprite wearing the wedge frame gets "Frame collision" with scale 2 at the sprite's size, a sprite without a picture gets the box.
- Screenshot looked at: the wedge outline covers the sprite, the inspector shows "Frame collision" and scale 2.
| Counter-check | Result |
|---|---|
| Five in the unit tests (on stein2, not in the container) | all work, 1 to 2 tests fail each |
| Browser: the rule bent, build went through | 42e-ii fails with `shape: box` |
- The e2e sum of 1617 is calculated (1616 + 1). Neither the full suite nor the smokes ran for this state on `melektaus-atx`; the CI run for `d39bf83` was not waited for.
- Vector art has no test of its own. It takes the same branch as a whole texture (the id is not a frame).
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Aus #193 („Nicht gebaut, nur Idee: Add collider auf einem Sprite, dessen Frame einen Umriss hat, könnte gleich ‚Frame collision‘ wählen. Heute gibt es dort immer eine Box.“).
Befund
AddColliderCommand(src/core/commands/colliderCommands.ts:49ff.) legt aber immer eine Box in Sprite-Größe an. Wer die Umrisse gezeichnet hat, muss danach am neuen Collider Shape → Frame collision und den Frame von Hand wählen.Zu bauen (Vorschlag)
frameund genau diesem Frame an. Sonst bleibt es bei der Box wie heute.frame, Frame ohne Umriss, ganze Textur oder Vector Art → Box). e2e in Modul 42: Rechtsklick → Add collider auf dem Sprite mit dem Keil-Frame, der Collider hat die Frame-Form.Offen (mit Vorschlag)
vorschlag passt
Done in
d39bf83, wiki21704ca(Colliders, Development).What changes
Decided here, the issue says nothing about size
A frame collider is always as big as its frame (one pixel is one unit), and a collider only scales evenly.
Under the hood
newColliderPropsinsrc/core/commands/colliderCommands.ts, next to the command, as the issue asks.AddColliderCommand.buildonly assigns what it returns.textureof the placement, looks the outline up withframeOutlineand compares proportions withmatchesAspect.Tests (on
melektaus-atx)tests/core/collider-parts.test.ts:frame, and one undo takes collider and asset away againshape: boxmelektaus-atx; the CI run ford39bf83was not waited for.