Command Palette

Search for a command to run...

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

SS14 Physics System Core

Deep practical guide to PhysicsSystem in Space Station 14: simulation device (broadphase, contacts, islands, solver), connection with…

БесплатноБез исполняемых скриптов
makura-gamesот makura-games★ 74 звезды на GitHub

Установить SS14 Physics System Core в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

PhysicsSystem: Core

This skill covers the architecture and mental model of PhysicsSystem :) For the full directory of the public API, see the separate skill SS14 Physics System API.

Mental model

Physics in SS14 is convenient to think of as a pipeline of 6 layers:

  1. PhysicsComponent
  • Body state: BodyType, CanCollide, speed, damping, mass, sleep, etc.
  1. FixturesComponent
  • Set of physical body shapes (hitboxes/sensors), their layer/mask/hard, material parameters.
  1. Broadphase
  • Proxy trees on maps/grids, quick search for potential pairs.
  1. Contacts
  • Nodes of fixture-vs-fixture pairs, lifecycle Start/Touching/End.
  1. Islands + Solver
  • Body/contact/joint graphs, solved in batches and partially in parallel.
  1. Sync with Transform
  • After solve, the position/rotation is put back into the transform tree.

Key idea:

  • Game logic should almost always change physics through system methods (Set*, Apply*, RegenerateContacts, WakeBody), and not through direct component fields ✅

How the tick of physics really works

Typical step (including substeps):

  1. PhysicsUpdateBeforeSolveEvent.
  2. Search for new potential pairs (FindNewContacts).
  3. Update contacts (CollideContacts) and events Start/EndCollide.
  4. Solve islands (Step -> integration of speeds -> constraints -> positions).
  5. PhysicsUpdateAfterSolveEvent.
  6. Finalization/lerp data on the last substep.

Practical conclusion:

  • Everything that should act “in the same physical step” must be placed before solve (usually in controller systems or before-solve events).

Connection with Transform, Anchoring and Containers

PhysicsSystem is tightly connected to the transform hierarchy:

  • When parent-change occurs, the behavior of the body is recalculated and the map speed is saved.
  • Anchor/unanchor changes not only the transform status, but also the physical mode (through the system flow).
  • In a container, the body is usually transferred to CanCollide = false, the speeds are reset to zero.

Consequence:

  • Any operations “inserted into container”, “dropped parent”, “anchored/unanchored” cannot be considered only visual; this is a full-fledged physical transition ⚠️

Client and server

General:

  • Both the server and the client use a common physical layer and the same key invariants.

Differences:

  • The server is authoritative.
  • The client additionally controls the prediction flag of entities and carefully recalculates the touching state of contacts when resetting the state in order to reduce mispredict effects.

Short decision tree

  1. Need a one-time push/jerk?
  • ApplyLinearImpulse / ApplyAngularImpulse.
  1. Do you need constant thrust/torque?
  • ApplyForce / ApplyTorque.
  1. Do you need to switch the physical mode of an object?
  • SetBodyType (+ if necessary SetCanCollide, SetFixedRotation, SetSleepingAllowed).
  1. Do you need to change collision behavior without changing your body type?
  • SetCanCollide or fixture-API (SetCollisionMask/Layer, SetHard).
  1. Do you need to reassemble the current contacts after a sudden change of collision/fixtures?
  • RegenerateContacts.
  1. Do you need geometry and distances based on real hitboxes?
  • TryGetNearest*, GetWorldAABB, GetHardAABB, ray/intersection query API.

Optimization when using PhysicsSystem :)

1) Component optimizations (the cheapest and most effective)

  • CollisionWake: automatically turns off CanCollide for sleeping bodies on the grid (if there are no joints/critical contacts), and turns it back on when waking up.
  • CollideOnAnchor: Binds CanCollide to the anchor/unanchor state.
  • These two approaches are usually better than manually "pulling" SetCanCollide in 100 places.
# Underground/pipe entity: collision is automatically synchronized with anchoring.
components:
- type: Physics
  canCollide: false
- type: CollideOnAnchor
# Massive small items: collision wake saves updates on the grid.
components:
- type: Physics
- type: CollisionWake

2) Sleep/wake and frequent speed updates

  • For objects with frequent velocity updates, use SetLinearVelocity(..., wakeBody: false), if you don’t need to force wake up every tick.
  • Turn on SetSleepingAllowed(true) where the body can consistently “fall asleep”.
  • Call WakeBody only before a real action (push, sharp maneuver, turning on a mechanism).
// The controller updates velocity every tick, but an extra wake at every step is not needed.
PhysicsSystem.SetAngularVelocity(uid, angularVelocity);
PhysicsSystem.SetLinearVelocity(uid, velocity, wakeBody: false);

3) Cheap query/contact patterns

  • For contact logic, use GetContacts/ContactEnumerator (minimum allocations).
  • For intersection checks where perfect accuracy is not needed, use approximate = true.
  • Ray/query filter through a mask in advance, rather than post-filtering a huge result.
// Quick broadphase screening: where appropriate, leave appr
Полный SKILL.md на GitHub

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

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

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

FAQ

Что делает скилл SS14 Physics System Core?

Deep practical guide to PhysicsSystem in Space Station 14: simulation device (broadphase, contacts, islands, solver), connection with Transform/Container/Anchoring, client prediction part and working application patterns. Use it when you need to understand how physics actually works and where it is safe to embed game logic.

Как установить скилл SS14 Physics System Core?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл SS14 Physics System Core запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить SS14 Physics System Core с