К основному содержанию
скилл CX Codex

roblox-physics · gamedev-skills — скилл для Claude Code: физика Roblox

Скилл для работы с физикой Roblox: сборки, ограничения, группы столкновений, рейкасты и владение по сети. Пригодится, когда .Touched врёт или механизм дрожит.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill roblox-physics -a claude-code
Открыть на GitHub

Что делает roblox-physics

Скилл помогает агенту разобраться с физической симуляцией в Roblox: сборки BasePart, ограничения, группы столкновений, рейкасты и объёмные запросы, импульсы, силы, масса, движущиеся объекты и владение по сети. Внутри есть таблица выбора механизма под задачу и пошаговый разбор: осмотреть механизм в Studio, задать политику взаимодействия, выбрать симуляцию или запрос, приложить движение на уровне сборки, выставить владельца, ограничить стоимость и время жизни, проверить под нагрузкой и в мультиплеере.

Отдельно разобраны два шаблона. Первый — серверный рейкаст с RaycastParams, фильтром по персонажу стрелка и группой WeaponQuery; результат проверяется игровой логикой, а не принимается на веру. Второй — объёмный запрос через OverlapParams и GetPartBoundsInBox с дедупликацией моделей. Есть таблица частых поломок: например, сварной механизм не двигается, если хоть одна деталь заякорена.

Важная деталь про OverlapParams.RespectCanCollide: этот флаг решает, уважает ли запрос CanCollide или CanQuery, и если его не выставить осознанно, он молча перекроет вашу политику флагов. Клиентское владение ускоряет отклик, но не даёт права на игровой результат: сервер обязан сам проверять попадания, позиции и права. Для стабильности и ощущения от физики скилл советует работать в паре с physics-tuning.

Какие задачи решает

  • поймать попадание серверным рейкастом с фильтрами вместо .Touched
  • настроить группы столкновений и развести CanCollide, CanTouch, CanQuery
  • починить механизм, который не двигается из-за заякоренной детали
  • выставить владение по сети для критичных объектов
  • убрать временные ограничения и слушатели после использования

Примеры запросов агенту

  • Разбери мой механизм на ограничениях: почему он дрожит и как выставить владение по сети
  • Сделай серверный рейкаст для оружия с RaycastParams и группой WeaponQuery
  • Проверь объёмный запрос через OverlapParams: нужно ли выставлять RespectCanCollide

Как установить roblox-physics

1Через Skills CLI (Vercel)

npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill roblox-physics -a claude-code

2Вручную: положить файлы

~/.claude/skills/roblox-physics/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/roblox-physics/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о roblox-physics

Как установить roblox-physics в Claude?

Выполните npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill roblox-physics -a claude-code. Файл скилла окажется по пути ~/.claude/skills/roblox-physics/SKILL.md.

Что делает roblox-physics?

Помогает агенту писать и проверять физику Roblox: сборки, ограничения, группы столкновений, рейкасты и объёмные запросы, импульсы, силы, владение по сети и очистку временных объектов.

Чем этот скилл отличается от physics-tuning?

roblox-physics разбирает конкретные API Roblox и политику взаимодействия, а physics-tuning отвечает за стабильность и ощущение от физики без привязки к движку. Их советуют использовать вместе.

Исходный текст

SKILL.md · Apache-2.0
---
name: roblox-physics
description: >
  Implement Roblox physical simulation and queries with assemblies, anchoring, constraints,
  collision groups, CanCollide/CanTouch/CanQuery, raycasts and overlap queries, mass, impulses,
  forces, velocity, moving assemblies, cleanup, and network ownership. Use for Roblox collisions,
  hit detection, RaycastParams, PhysicsService, projectiles, vehicles, knockback, constraints,
  deprecated BodyMovers, unstable motion, or client-owned physics exploits.
---

# Roblox physics

Choose deliberately between simulation, character control, hit detection, and visual-only motion;
they are different jobs. Targets Roblox's rolling platform APIs. Pair with `physics-tuning` for
engine-neutral stability and feel.

## When to use

- Use for BasePart assemblies, constraints, collision/query policy, ray/overlap queries, forces,
  impulses, moving physical objects, network ownership, or physics cleanup.
- Use when `Touched` is unreliable/security-sensitive, parts tunnel or jitter, a mechanism breaks
  when anchored, or old BodyMover patterns appear.

**When not to use:** ordinary Humanoid lifecycle/control belongs to `roblox-characters`; remote
validation belongs to `roblox-networking`; decorative UI/world motion may only need a tween.

## Decide the system first

| Goal | Mechanism |
|---|---|
| sustained physical interaction | unanchored assembly + modern constraints/forces |
| instantaneous physical change | `ApplyImpulse` / `ApplyAngularImpulse` |
| kinematic platform/path | controlled pivot/transform with an explicit passenger policy |
| character locomotion | Humanoid/custom character controller (`roblox-characters`) |
| authoritative hit test | server raycast/overlap with filters and gameplay validation |
| cosmetic trail/recoil | local visual motion; no gameplay authority |

## Workflow

1. **Inspect the mechanism.** In Studio, visualize assemblies, anchors, constraints, collision
   groups, massless parts, and network owners. Identify the assembly root and intended authority.
2. **Define interaction policy.** Write the collision-group matrix and separately decide
   `CanCollide`, `CanTouch`, and `CanQuery`. These flags are not interchangeable. Register groups
   in the Studio Collision Groups editor or with `Workspace:RegisterCollisionGroup()` and
   `Workspace:CollisionGroupSetCollidable()`; the `PhysicsService` collision-group methods are
   deprecated and forward to `Workspace`.
3. **Choose simulation or query.** Do not use `.Touched` as a universal hit detector. Use a ray for
   a path/line, an overlap query for a volume, and simulation contacts when physical response is
   actually required.
4. **Apply motion at assembly level.** Forces on a part affect its assembly. Use modern
   `LinearVelocity`, `AngularVelocity`, `VectorForce`, `AlignPosition`, and `AlignOrientation`
   constraints as appropriate; migrate deprecated BodyMovers when changing that system.
5. **Set ownership deliberately.** Server-own gameplay-critical loose assemblies when required;
   client ownership can improve responsiveness but never authorizes gameplay results.
6. **Bound cost and lifetime.** Reuse query parameters, cap query frequency/result count, remove
   temporary constraints/attachments, and disconnect event listeners.
7. **Verify under load and multiplayer.** Test anchored/unanchored transitions, mass extremes,
   collision matrix, fast motion, multiple clients, ownership changes, streaming, and cleanup.

## Pattern: filtered server raycast

```lua
local Workspace = game:GetService("Workspace")

local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {shooterCharacter}
params.IgnoreWater = true
params.CollisionGroup = "WeaponQuery"

local direction = aimDirection.Unit * MAX_RANGE
local result = Workspace:Raycast(muzzlePosition, direction, params)
if result then
    local model = result.Instance:FindFirstAncestorOfClass("Model")
    local humanoid = model and model:FindFirstChildOfClass("Humanoid")
    if humanoid and serverCanDamage(shooter, model, result.Position) then
        humanoid:TakeDamage(serverWeaponDamage(shooter))
    end
end
```

The server must validate the origin/direction against server-known character/weapon state; do not
accept an arbitrary client origin and treat the raycast itself as validation.

## Pattern: overlap volume with explicit policy

```lua
local params = OverlapParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {sourceCharacter}
params.CollisionGroup = "DamageQuery"
params.MaxParts = 64

local seen: {[Model]: boolean} = {}
for _, part in Workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize, params) do
    local model = part:FindFirstAncestorOfClass("Model")
    if model and not seen[model] then
        seen[model] = true
        validateAndApplyHit(model)
    end
end
```

Bounds queries use bounding boxes and can include multiple parts from one target; deduplicate and
perform exact/gameplay checks as needed. For exact geometry use `WorldRoot:GetPartsInPart(part, overlapParams)`
only when its additional cost is justified. Note `OverlapParams.RespectCanCollide` decides whether a
query honours `CanCollide` or `CanQuery` — set it deliberately, or it silently overrides the flag
policy below. `OverlapParams.Tolerance` controls contact slop.

## Assemblies, force, and ownership

- Welded parts form one rigid assembly; force, impulse, velocity, mass, and ownership operate on
  that assembly. Anchoring a part changes simulation/ownership and can make an assembly effectively
  infinite mass.
- Apply an impulse for a one-time change; use a force or velocity constraint for sustained control.
  Setting `AssemblyLinearVelocity` is an immediate state change, not a continuous force model.
- Prefer attachments plus modern constraints over `BodyPosition`, `BodyVelocity`, `BodyGyro`, and
  other deprecated BodyMovers when authoring or revising a mechanism.
- Automatic ownership may move nearby unanchored assemblies to clients. Use
  `SetNetworkOwner(nil)` conservatively for critical objects, then measure responsiveness/server
  cost. Visualize network owners in Studio.
- A client owner can manipulate physical results and `.Touched` observations. The server validates
  consequential hits, positions, timing, and permissions independently.
- If `Workspace.AuthorityMode` is `Server`, the server owns simulation and clients predict parts
  near their own character with rollback (`RunService:SetPredictionMode()`, client-only, overrides
  per instance). Drive
  predicted forces and constraints from `RunService:BindToSimulation()` on both sides rather than
  from `Heartbeat` or client-only scripts; custom physics scripts need adapting when a place
  switches modes. See `roblox-networking`.

## Common failures

| Symptom | Likely cause | Remedy |
|---|---|---|
| welded mechanism will not move | one part anchored | inspect full assembly; anchor only intentional world roots |
| force behaves too strongly/weakly | assembly mass ignored | inspect `AssemblyMass`; tune force/impulse by intended acceleration |
| hit misses fast projectile | discrete touch sampling/tunneling | swept query — `WorldRoot:Blockcast()`, `Spherecast()`, or `Shapecast()` — plus `physics-tuning`; do not rely only on `.Touched` |
| ray hits shooter/effects | filters/collision group absent | reuse explicit params and query group |
| same target damaged many times | overlap returned multiple body parts | deduplicate by target model and enforce attack ID/cooldown |
| exploit fires impossible touch | client owns relevant physics | server query/context validation; deliberate ownership |
| invisible trigger blocks or cannot query | three flags conflated | set `CanCollide`, `CanTouch`, `CanQuery` independently |
| mechanism leaks attachments | temporary constraint lifecycle missing | own and destroy constraints, attachments, and connections together |

## Resources

- Read `references/queries-and-ownership.md` for collision/query matrices, assembly debugging,
  ownership security, migration choices, and the physics verification matrix.

## Related skills

- `physics-tuning` — timestep, jitter, tunneling, mass ratios, and stability methodology.
- `roblox-characters` — Humanoid/custom movement and respawn lifecycle.
- `roblox-networking` — authoritative validation of client-requested physical actions.
- `roblox-studio-workflow` — visualization, Output, and multi-client verification.

## Primary references

- `https://create.roblox.com/docs/physics/assemblies`
- `https://create.roblox.com/docs/physics/network-ownership`
- `https://create.roblox.com/docs/workspace/raycasting`

© gamedev-skills · Apache-2.0 · gamedev-skills/awesome-gamedev-agent-skills

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

Всё по теме «Геймдев и 3D: Unity, Unreal, Godot, Blender» →

Сначала — roblox-physics от других авторов.

roblox-physics TabooHarmony Помогает настраивать физику в Roblox: связки констрейнтов, рэгдоллы, транспорт, сетевое владение и поведение снарядов при багах симуляции. CX Codex +1 1 900установок roblox-building TabooHarmony Скилл для сборки геометрии, карт и пропов в Roblox Studio через MCP или Luau. Помогает не угадывать координаты и доводить модель до проверяемого результата. CX Codex +1 2 400установок roblox-lighting TabooHarmony Скилл для настройки освещения, атмосферы, смены дня и ночи и пост-обработки в Roblox. Пригодится, когда сцена выглядит плоской или пересвеченной. CX Codex +1 2 200установок roblox-animation nonlooped Скилл для анимаций персонажей Roblox: треки, IK-позы, события по маркерам и твины интерфейса. Пригодится, когда нужно собрать локомоцию или эмоцию и не сломать приоритеты. CX Codex +1 392установок roblox-mcp nonlooped Скилл подключает ИИ-клиент к Roblox Studio по MCP: агент читает дерево игры, правит скрипты, запускает Luau и плейтест. CX Codex +1 317установок roblox-game-development greedychipmunk Скилл для разработки игр на Roblox: помогает писать скрипты на Luau, собирать игровые системы и готовить проект к релизу. CX Codex +1 2 200установок godot-physics-3d thedivergentai Задаёт правила и готовые паттерны для 3D-физики в Godot. Помогает настроить рэгдоллы, суставы, перемещение по лестницам и быстрые снаряды без багов симуляции. CX Codex +1 418установок

Из того же набора77

ai-behavior-trees-utility-ai Помогает реализовать деревья поведений и систему Utility AI для игровых NPC. Пригодится при создании логики ботов в Unity или Godot за пределами обычного FSM. CX Codex +1 4 900установок roblox-ui Скилл для сборки интерфейсов Roblox: жизненный цикл ScreenGui, адаптивные UDim2-раскладки, ввод с геймпада и тача. Пригодится, когда UI обрезается или сбрасывается после респавна. CX Codex +1 3 800установок roblox-studio-workflow Скилл задаёт порядок правок в существующих проектах Roblox Studio: от осмотра структуры до проверки в Studio и очистки тестовых объектов. CX Codex +1 3 700установок roblox-networking Скилл для проектирования и защиты клиент-серверной сети в Roblox: RemoteEvent, RemoteFunction, UnreliableRemoteEvent, проверки и лимиты. CX Codex +1 3 500установок roblox-characters Помогает строить системы персонажей в Roblox так, чтобы скрипты не ломались после респавна и не держали устаревшие ссылки на Humanoid. CX Codex +1 3 600установок godot-gdscript-headless-testing Скилл помогает настроить запуск тестов GDScript в Godot 4 через консоль с флагом --headless. Он нужен для проверки логики в CI без запуска графического редактора. CX Codex +1 3 100установок ebitengine-game Скилл для агентного кодинга, который помогает собирать, отлаживать и упаковывать 2D-игры на Go с Ebitengine. Пригодится, когда нужен рабочий игровой цикл, а не один удачный скриншот. CX Codex +1 659установок defold-core Помогает собирать и отлаживать игры на Defold: настраивать game.project, связывать скрипты на Lua, передавать сообщения и проверять сборку через Bob. CX Codex +1 623установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой