roblox-physics
できること
Robloxの部品を、落下、衝突、発射体による衝撃など、物理的に振る舞わせる方法を説明します。乗り物、発射体、動くオブジェクトを作る開発者向けです。
使う場面
- ✓Robloxで、部品を落下させたり、跳ねさせたり、衝突させたり、力で動かしたりする必要があるとき。
- ✓Touchedに頼らずに、発射体や衝撃の検出を確実に働かせたいとき。
- ✓古いBodyMoverのスクリプトや、拘束されたオブジェクトが壊れていて不安定なとき。
スキルのリンク
https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/other-engines/roblox-physics/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“Robloxの発射体が壁をすり抜けます。確実に当たるようにするにはどうすればよいですか。”
毎週5つの新しいスキル。1分で読めます。
仕組み
スキルは、エージェントが各目標に合ったしくみを選ぶよう手助けします。たとえば、物理のシミュレーション、瞬間的な衝撃、サーバーでの当たり判定などです。そして、設計に合うように衝突とクエリのルールを設定します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
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
Touchedis 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
- Inspect the mechanism. In Studio, visualize assemblies, anchors, constraints, collision groups, massless parts, and network owners. Identify the assembly root and intended authority.
- Define interaction policy. Write the collision-group matrix and separately decide
CanCollide,CanTouch, andCanQuery. These flags are not interchangeable. Register groups in the Studio Collision Groups editor or withWorkspace:RegisterCollisionGroup()andWorkspace:CollisionGroupSetCollidable(); thePhysicsServicecollision-group methods are deprecated and forward toWorkspace. - Choose simulation or query. Do not use
.Touchedas 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. - Apply motion at assembly level. Forces on a part affect its assembly. Use modern
LinearVelocity,AngularVelocity,VectorForce,AlignPosition, andAlignOrientationconstraints as appropriate; migrate deprecated BodyMovers when changing that system. - Set ownership deliberately. Server-own gameplay-critical loose assemblies when required; client ownership can improve responsiveness but never authorizes gameplay results.
- Bound cost and lifetime. Reuse query parameters, cap query frequency/result count, remove temporary constraints/attachments, and disconnect event listeners.
- 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
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
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 ta
よくある質問
当たり判定にTouchedを使わないのはなぜですか?
スキルは、Touchedは信頼性が低く、悪用されやすいことがあるため、サーバーのレイキャストやオーバーラップの確認を優先すると説明しています。
キャラクターの移動も扱いますか?
いいえ。ヒューマノイドの移動は、別のRobloxのキャラクターのスキルで扱われます。
物理の感触の調整も扱いますか?
一部だけです。エンジンに依存しない調整は、別の物理調整のスキルで扱われます。
詳細
作者による元の説明
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.
人気
- GitHubのスター
- 6.6k
- ランキング
- #13840
- ライセンス
- Apache-2.0
- 更新日
- 2026/10/28
コメント
- …
このリポジトリの他のスキル
router
6.6kエージェントが、エンジンとタスクの種類を見分けて、依頼に合ったゲーム開発のスキルを選べるよう支援します。
ai-behavior-trees-utility-ai
6.6kエージェントが、優先度と点数によって行動を選ぶ、ゲームの敵やキャラクター向けのビヘイビアツリーとユーティリティAIのシステムを作れるよう支援します。
audio-design
6.6kエージェントが、オーディオバス、デシベルでの音量、会話中の音の抑え込み(ダッキング)、適応型の音楽、効果音のバリエーションなど、ゲームのサウンドのミキシングを教えます。
camera-systems
6.6kエージェントが、なめらかに追従し、レベルの内側に収まり、3Dで周回したり見回したりできるゲームのカメラを作れるよう支援します。
似ているスキル
diffs
394k編集内容の実際の共有可能な差分を、手書きの要約ではなく、ビューアーのリンクや画像ファイルとして作成するようエージェントを支援します。
coding-agent
394kCodex、Claude Code、OpenCodeに大きめのコーディング作業をバックグラウンドのワーカーとして渡し、その進捗を確認するようエージェントを支援します。
gh-issues
394kGitHubのイシューを探し、取り組むものを選び、修正を含むプルリクエストを開くようエージェントを支援します。レビューコメントへの対応も含みます。