Roblox Physics

TabooHarmony/roblox-brain/skills/gameplay/roblox-physics

作者 TabooHarmony38826be57ee37bcf023e9c2b85681bea3909281c無授權條款收錄於 2026年10月9日更新於 2026年10月9日

Use when building Roblox vehicles, ragdolls, projectiles, elevators, constraints, forces, or other physics-driven gameplay.

AI 產生的概覽

關於使用約束、力、載具、布娃娃和網路所有權來打造 Roblox 物理玩法的參考。

功能
提供 Roblox 物理驅動玩法的快速參考,涵蓋機械、運動與彈簧/繩索類約束、Attachment 模式以及致動器設定。它提供載具、將 Motor6D 轉換為 BallSocketConstraint 的布娃娃做法、網路所有權與伺服器權威選擇,以及常見陷阱的指引。references/full.md 中有包含程式碼範例、API 表格和邊界情況的完整參考。
適用情境
適用於打造 Roblox 載具、布娃娃、拋射物、電梯、擺動平台、機械裝置或其他由約束和力驅動的玩法。也適合在伺服器所有與用戶端所有的物理模擬之間做選擇時使用。
執行需求
沒有指令碼,僅為說明文件。需要 Roblox 開發環境,並需存取隨附的 references/full.md 以取得完整參考。

Roblox Physics

When to Load

Use this skill when building physics-driven gameplay: vehicles, ragdolls, projectiles, mechanical contraptions, elevators, swinging platforms, or anything using constraints and forces.

Quick Reference

Constraint Types

Mechanical: HingeConstraint, PrismaticConstraint, CylindricalConstraint, BallSocketConstraint, UniversalConstraint, WeldConstraint/RigidConstraint Motion: AlignPosition, AlignOrientation, LinearVelocity, AngularVelocity, VectorForce, Torque Spring/Rope: SpringConstraint, RopeConstraint, RodConstraint

Attachment Pattern

Constraints connect via Attachment objects. Create one on each part, set Attachment0/Attachment1, and parent the constraint to part0. Actuator types include None, Motor, and Servo.

Vehicles

Vehicles: use motorized HingeConstraint wheels, SpringConstraint suspension, servo steering, and CustomPhysicalProperties for friction tuning.

Ragdoll

Replace Motor6Ds with BallSocketConstraint: create Attachments from motor.C0/C1, set LimitsEnabled=true, UpperAngle=45. Keep Root Motor6D for HRP. Set humanoid state to Physics. On recovery, destroy only the instances ragdoll created and restore only the motors it disabled (track both at enable time).

Authority and Network Ownership

Classic projects: automatic ownership can give an unanchored assembly to a nearby player. SetNetworkOwner(nil) keeps it server-owned; SetNetworkOwner(player) gives a player simulation ownership. Treat player-owned physics as untrusted and validate gameplay outcomes.

Server Authority: set Workspace.AuthorityMode = Server with its required settings. Core objects can remain server-owned while prediction keeps controls responsive, so the classic secure-but-laggy trade-off does not apply. SetNetworkOwner() is not a substitute.

Rule: choose the model first. Keep NPC and gameplay-critical objects authoritative; give client ownership to non-critical physics only when the resulting behavior is acceptable and tested.

Common Gotchas

  • Constraints do nothing on Anchored parts
  • Both Attachment0 AND Attachment1 required (missing one = silent fail)
  • Over-constraining = jitter. Tune mass with CustomPhysicalProperties
  • Use Raycast for hitscan, Touched only for slow physics projectiles
  • Always set lifetime on physics projectiles (forgotten ones kill perf) Need more detail? Load references/full.md for the complete reference with code examples, API tables, and edge cases.

來源與署名

來源:TabooHarmony/roblox-brain位於skills/gameplay/roblox-physics提交38826be

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架