Command Palette

Search for a command to run...

Назад к скиллам
скилл № 46943

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от 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

  1. Separate spaces strictly: world -> entity/grid local -> sprite/layer local -> screen.
  2. Use paired operations: CreateTransform for forward movement, CreateInverseTransform for reverse movement.
  3. For physics, first select the correct reference frame (usually broadphase/grid), then convert the position and angle.
  4. For rendering, take into account the sprite modifiers (NoRotation, SnapCardinals, layer strategy), and only then calculate the draw-matrix.
  5. For directions, reset the matrix translation (M31/M32 = 0), otherwise you distort the vector ⚠️
  6. Work through system methods (SharedTransformSystem, SharedPhysicsSystem, SpriteSystem), rather than manual calculations.

Patterns

  1. Use Matrix3Helpers.CreateTransform(...) and CreateInverseTransform(...) as a canonical forward/backward transition pair.
  2. In physics, get a relative transform through SharedPhysicsSystem.GetRelativePhysicsTransform(...) instead of manually subtracting the parent chain.
  3. Rebuild SpriteComponent.LocalMatrix when changing Scale/Rotation/Offset through SpriteSystem.SetScale/SetRotation/SetOffset.
  4. In the sprite renderer, prepare separate matrices for layer strategies (Default, NoRotation, SnapToCardinals, UseSpriteStrategy).
  5. In cliques, make a chain world -> entity local -> sprite local -> layer local through matrix inversions.
  6. In the docking composition, use the formula inverse(stationDock) * gridDock, then TransformBox for AABB checking.
  7. In the UI navigation of radars and maps, make an explicit chain grid/world -> shuttle -> view.
  8. In AO/FOV, before querying on trees/tiles, transfer world-bounds to the local space of the tree/grid via GetInvWorldMatrix(...).TransformBox(...).
  9. In FTL/proximity, expand and merge world-AABB via GetWorldMatrix(...).TransformBox(...), rather than mixing world/local boxes directly.
  10. For direction vectors (rays, ricochet), use a matrix without translation (M31/M32 = 0) and normalize after transformation.
  11. For mixed client/server code, keep a single geometric meaning: the same mathematics, but different points of application.
  12. In complex loops, first calculate the base matrices once, then only reuse them in iterations ✅

Anti-patterns

  1. Mix world, grid local, entity local, screen in one expression without an explicit transition.
  2. Convert directions using a complete matrix with translation (you will get the wrong geometry).
  3. Ignore NoRotation and SnapCardinals when calculating the sprite screen matrix.
  4. Bypass system APIs and manually assemble the parent chain of matrices where there are ready-made methods.
  5. Use legacy component wrappers as the main API instead of system methods.
  6. Invert matrices into a tight-loop without caching if the input parameters do not change during the iteration.
  7. Perform broadphase/query in world-space when local tree/grid space is expected.
  8. Glue layer Sprite matrices and physical transforms without understanding their different reference systems.
  9. Draw into this skill general UI/architecture topics without matrix content 🙃

Client/Server

  • Client: clicks, sprite rendering, AO/FOV, navigation UI widgets; here the world -> local -> screen chains are most often needed.
  • Server: docking/FTL/physical checks; Correct relative transforms and TransformBox for 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
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • 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), без исполняемых скриптов.

Похожие скиллы

Сравнить ss14-matrix-transform-physics-sprite с