Skip to main content

shapes-collision-attachment

How FlatRedBall shapes attach to entities vs. participate in collision — PositionedObject.Children vs ICollidable.Collision. Triggers: SetCollisionFromAnimation, ICollidable, ShapeCollection, AttachTo, animation-driven shapes, bullet-origin/marker shapes.

Ir para a instalação

Informações da origem

Repositório
vchelaru/FlatRedBall
Última atividade na origem
9 de setembro de 2026 às 14:58
Idioma detectado do SKILL.md
inglês
Estrelas
575
Forks
73

Opções de instalação

Por padrão, está selecionado o prompt que primeiro revisa a origem. Você pode mudar para um comando direto ou baixar uma cópia local.

Revise os arquivos de origem

Leia o SKILL.md e os arquivos complementares exibidos pelo SkillsMP antes de decidir se vai instalar.

Exibindo SKILL.md

SKILL.md
Instruções da origem · Visualização somente leitura
name
shapes-collision-attachment
description
How FlatRedBall shapes attach to entities vs. participate in collision — PositionedObject.Children vs ICollidable.Collision. Triggers: SetCollisionFromAnimation, ICollidable, ShapeCollection, AttachTo, animation-driven shapes, bullet-origin/marker shapes.
# Shapes, Collision, and Attachment Two separate things get conflated here. Don't assume one implies the other. 1. **Attachment.** A shape (Circle, AxisAlignedRectangle, Polygon, etc.) is a `PositionedObject`. `AttachTo` makes it move with a parent, same as any other child (`PositionedObject.Children`, `PositionedObject.cs:288`). This works on any entity, `ICollidable` or not. 2. **Collision membership.** `ICollidable` (`Math/Geometry/ICollidable.cs:14`) adds one more thing: a `Collision` `ShapeCollection`. A shape only affects collision detection if it's also added to `.Collision` — being attached doesn't do that on its own. `Sprite.SetCollisionFromAnimation` (`Sprite.cs:2044`) requires `ICollidable` because it writes into `.Collision`, not because reading shapes off an animation frame needs it. Custom code can read `CurrentFrame.ShapeCollectionSave` and use it however it wants on any entity — see `Enemy.GetNewBulletPosition()` in CrankyChibiCthulhu for a non-collision example (a `BulletOrigin` circle used to position bullet spawns). **Landmine:** `createMissingShapes: true` on `SetCollisionFromAnimation` adds *any* unmatched named shape in the current frame to `.Collision`, including one only meant as a position marker. There's currently no way to sync a shape as a child from animation without risking it becoming a live collision shape if that flag is on. Related: `achx-format` skill for how shapes are stored per animation frame.
Ver no GitHub