ss14-matrix-transform-physics-sprite
Highly specialized skill in matrix transformations in SS14: world/grid/local/screen conversions, Sprite render matrices, broadphase-space physics queries…
от makura-games★ 74 звезды на GitHub
Установить ss14-matrix-transform-physics-sprite в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Matrices for Transform/Physics/Sprite in SS14
Use this skill when the task involves matrices and coordinate space conversion :)
Focus only on the matrix part of Transform/Physics/Sprite without duplicating common topics from other skills.
When to use
Use skill if necessary:
- transfer data between
world/grid/local/screen; - correctly build/invert matrices for physics and rendering;
- convert bounds (
TransformBox) for broadphase, AO/FOV, docking, UI navigation; - resolve client/server differences in matrix chains.
Mental model of matrices
- Separate spaces strictly:
world->entity/grid local->sprite/layer local->screen. - Use paired operations:
CreateTransformfor forward movement,CreateInverseTransformfor reverse movement. - For physics, first select the correct
reference frame(usually broadphase/grid), then convert the position and angle. - For rendering, take into account the sprite modifiers (
NoRotation,SnapCardinals, layer strategy), and only then calculate the draw-matrix. - For directions, reset the matrix translation (
M31/M32 = 0), otherwise you distort the vector ⚠️ - Work through system methods (
SharedTransformSystem,SharedPhysicsSystem,SpriteSystem), rather than manual calculations.
Patterns
- Use
Matrix3Helpers.CreateTransform(...)andCreateInverseTransform(...)as a canonical forward/backward transition pair. - In physics, get a relative transform through
SharedPhysicsSystem.GetRelativePhysicsTransform(...)instead of manually subtracting the parent chain. - Rebuild
SpriteComponent.LocalMatrixwhen changingScale/Rotation/OffsetthroughSpriteSystem.SetScale/SetRotation/SetOffset. - In the sprite renderer, prepare separate matrices for layer strategies (
Default,NoRotation,SnapToCardinals,UseSpriteStrategy). - In cliques, make a chain
world -> entity local -> sprite local -> layer localthrough matrix inversions. - In the docking composition, use the formula
inverse(stationDock) * gridDock, thenTransformBoxfor AABB checking. - In the UI navigation of radars and maps, make an explicit chain
grid/world -> shuttle -> view. - In AO/FOV, before querying on trees/tiles, transfer world-bounds to the local space of the tree/grid via
GetInvWorldMatrix(...).TransformBox(...). - In FTL/proximity, expand and merge world-AABB via
GetWorldMatrix(...).TransformBox(...), rather than mixing world/local boxes directly. - For direction vectors (rays, ricochet), use a matrix without translation (
M31/M32 = 0) and normalize after transformation. - For mixed client/server code, keep a single geometric meaning: the same mathematics, but different points of application.
- In complex loops, first calculate the base matrices once, then only reuse them in iterations ✅
Anti-patterns
- Mix
world,grid local,entity local,screenin one expression without an explicit transition. - Convert directions using a complete matrix with translation (you will get the wrong geometry).
- Ignore
NoRotationandSnapCardinalswhen calculating the sprite screen matrix. - Bypass system APIs and manually assemble the parent chain of matrices where there are ready-made methods.
- Use legacy component wrappers as the main API instead of system methods.
- Invert matrices into a tight-loop without caching if the input parameters do not change during the iteration.
- Perform broadphase/query in world-space when local tree/grid space is expected.
- Glue layer
Spritematrices and physical transforms without understanding their different reference systems. - Draw into this skill general UI/architecture topics without matrix content 🙃
Client/Server
Client: clicks, sprite rendering, AO/FOV, navigation UI widgets; here theworld -> local -> screenchains are most often needed.Server: docking/FTL/physical checks; Correct relative transforms andTransformBoxfor collision/query are critical here.Shared: basic matrix helpers and geometry unification (CreateTransform,CreateInverseTransform, relative-physics transform).- Keep it invariant: mathematics coincides between layers, only the context of application diverges.
Code examples
1) Engine: Matrix3Helpers.CreateTransform + CreateInverseTransform
// Direct transition: local -> world.
var worldMatrix = Matrix3Helpers.CreateTransform(position, angle, scale);
// Reverse transition: world -> local space of the same entity.
var invWorldMatrix = Matrix3Helpers.CreateInverseTransform(position, angle, scale);
// Example: we transfer a point from the world to local.
var localPoint = Vector2.Transform(worldPoint, invWorldMatrix);
2) Engine: SharedPhysicsSystem.GetRelativePhysicsTransform(...)
// We get a broadphase-oriented transform, rather than counting it manually through the parent chain.
var (_, broadphaseRot, _, broadphaseInv) = _transform.GetWorldPositionRotationMatrixWithInv(relativeXfo
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- references/docs-context.md
- references/fresh-pattern-catalog.md
- references/rejected-snippets.md
FAQ
Что делает скилл ss14-matrix-transform-physics-sprite?
Highly specialized skill in matrix transformations in SS14: world/grid/local/screen conversions, Sprite render matrices, broadphase-space physics queries, Transform/Physics/Sprite client and server chains.
Как установить скилл ss14-matrix-transform-physics-sprite?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ss14-matrix-transform-physics-sprite запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…