360 Secure SkillHub
360 安全技能中心

roblox-physics

提供 Roblox 物理问题排查指南,覆盖布娃娃、尸体、击退、网络所有权、射线检测、碎片和接触成本;包含症状、原因、修复建议与实测限制,并引用引擎文档和社区讨论作为依据。

分类:开发
TabooHarmony
热度 18.54
最近更新 2026-12-01 11:24:38

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add tabooharmony/roblox-brain/roblox-physics
兼容性
通用兼容
联网要求
不联网
数据出网
数据不出本机
Metadata
name
roblox-physics
description
Use when fixing or reviewing Roblox physics: ragdolls, corpses, knockback, network ownership, raycasts that miss, debris and contact cost.
when_to_use
Also when parts fling, jitter, sink through the floor or desync, ragdolls twitch or won't go limp, shots pass through parts, placement rays miss, debris lags, impulses vanish, or bot deaths launch wrong.
last_reviewed
"2026-11-28T00:00:00.000Z"
sources
["original","https://create.roblox.com/docs/reference/engine/classes/AnimationConstraint","https://create.roblox.com/docs/reference/engine/classes/BasePart","https://create.roblox.com/docs/reference/engine/datatypes/RaycastParams","https://raw.githubusercontent.com/Roblox/creator-docs/main/content/en-us/reference/engine/classes/Humanoid.yaml","https://raw.githubusercontent.com/Roblox/creator-docs/main/content/en-us/reference/engine/classes/WorldRoot.yaml","https://raw.githubusercontent.com/Roblox/creator-docs/main/content/en-us/reference/engine/classes/GeometryService.yaml"]

Roblox Physics

When to Load

Fixing or reviewing ragdolls, corpses, knockback, ownership, hit queries or physics cost. Server Authority: roblox-networking.

"Field-measured" = measured in one of the owner's projects; verify on your content.

Traps (symptom -> cause -> fix)

  • Code finds no Motor6D -> new R15 rigs (2026) have none: 15 AnimationConstraint + 14 enabled BallSocketConstraint. Never write C0/C1 (§1).
  • Ragdoll shakes -> sockets added on top of the built-in ones. Remove them.
  • Ragdoll stays stiff -> IsKinematic = false alone holds the pose; also set AngularStrength = 0 (or Enabled = false) (Studio 2026-11).
  • Pelvis twitches while limp -> the animated Root joint (HRP→LowerTorso) still drives it. Weld HRP-LowerTorso during ragdoll; restore Root on get-up (§2).
  • Corpse limbs sink -> R15 limbs default CanCollide = false and a live Humanoid keeps forcing it. Limbs CanCollide = true, destroy Humanoid and HRP.
  • Kill knockback tiny -> pushed on the death frame. Apply one physics step later, once, on AssemblyRootPart.
  • Bot deaths fling randomly -> bots are server-owned, players client-owned. Check owner, impulse once on root scaled by AssemblyMass, Humanoid state (§2).
  • Players can't push bodies -> clients can't push server-owned parts. Hitter ownership: ~67 ms vs ~200 ms reaction at 120 ms ping; mid-flight handoff is a small pop (§3).
  • Impulse works once / body doesn't move -> apply on the owner, on AssemblyRootPart (a massless welded part desynced), reset leftover velocity (§3).
  • Shots pass through / melee hits invisible boxes -> CanQuery = false works only when CanCollide = false (docs); rays hit CanCollide = false parts unless RespectCanCollide = true. Then filters, CollisionGroup (§4).
  • Placement refused, "tool does nothing" -> Include list misses the real colliders; server never told the client why (§4).
  • Physics ms high -> contacts: a free part holds far more than it touches; Motor6D/bones don't help. Read Stats.ContactsCount delta, collision groups, anchor at rest, BulkMoveTo (§5).
  • Head won't fragment -> GeometryService:FragmentAsync fails on the stock head mesh. 240 fragments froze ~221 ms, ~60 was fine (field-measured).

Limits (field-measured)

Case Cost
Free part in a dense map of small parts ~300 contacts while touching ~2
~100 free debris pieces 30k contacts, 30-45 ms physics
Collision group: debris ignores tiny map parts 239 -> 41 contacts per piece
1,750-part fallen piece at rest, unanchored vs anchored 17 ms vs 6 ms per step
5.5k physics parts vs 5k anchored via BulkMoveTo 60-70 ms vs 6-11 ms
Waking a large settled body for an unrelated hit ~41 ms physics for seconds
Client simulation range parts ~1,400 studs away didn't simulate

1. Character rigs: AnimationConstraint (2026-11)

With StarterPlayer.AvatarJointUpgrade on (default for new experiences; a Studio setting, not script-writable), R15 characters spawn with AnimationConstraint joints. Default R15 in Studio, November 2026: 15 AnimationConstraint, 14 enabled BallSocketConstraint, 4 RigidConstraint, no Motor6D.

Motor6D habit On an AnimationConstraint rig
FindFirstChildOfClass("Motor6D"), IsA("Motor6D") Finds nothing. Accept AnimationConstraint, fall back to Motor6D for legacy/custom rigs
Write C0/C1/Part0/Part1 Read-only aliases of the attachments. Don't edit RigAttachment.CFrame either (breaks retargeting)
neck.C0 = base * rot per frame joint.Transform = rot * joint.Transform in RunService.PreSimulation (the Animator overwrites Transform before that); skip frames where Animator.EvaluationThrottled

IsKinematic = false makes a joint chase Transform with force: LinearStrength/AngularStrength are normalized frequency (f / 60; 0 = no force; well above 1 goes unstable), *Damping 1 = critical.

2. Ragdolls, corpses, death launches

Limp test (Studio 2026-11, default R15, mean joint deviation after 4 s): IsKinematic = true 0.0°; IsKinematic = false with defaults (AngularStrength = 1) 2.1°, holds pose; plus AngularStrength = 0 44.5°, limp; Enabled = false 44.3°. Hand-built sockets doubled 14 to 28 and shook: list the rig's constraints by class first.

  • Recover by restoring recorded values (don't rebuild joints), then GettingUp, then return ownership. Stacked stun/ragdoll effects need one recovery owner, or the second snapshots modified joints as "original".

Pelvis twitch (field-measured): the cause is the Root joint, not the waist joint or torso collisions. Disable Root and hold HRP to LowerTorso with a WeldConstraint for the ragdoll; on get-up destroy the weld and re-enable Root.

Corpses:

  • Keep any root collision box no wider than the body.
  • Settle: anchor once every part moved under ~0.25 studs and 5° for 0.3 s, never in the air; wake on a hit; cap the count, fade oldest first.
  • Client-simulated death copies must drop rig attachments or their Humanoid rebuilds joints.
  • FragmentAsync worked on R15 torso and limbs; for heads use a custom mesh or pre-made pieces.

Kill knockback (field-measured): death-frame pushes moved bodies ~3 studs while survivors flew; apply after the next PostSimulation/Heartbeat. A disabled Dead state prevents Humanoid.Died; keep bot-only corpse workarounds off real players.

3. Ownership, velocity, assemblies

  • Responsive hits on shared bodies: give ownership to the hitter with hysteresis (last hitter for a few seconds, else nearest player in a radius); damage stays on the server.
  • Anchoring a character root to freeze it gives infinite assembly mass: mass-scaled forces become infinite and position goes NaN on unanchor. Freeze with zero walk/jump.
  • Player-owned physics is not a security boundary. Server Authority (Workspace.AuthorityMode = Server) keeps core objects server-owned with prediction; SetNetworkOwner() is not a substitute. Continuous input goes through RunService:BindToSimulation() (needs Workspace.UseFixedSimulation); make hit transitions idempotent across resimulation. Movers and BodyMovers may need rework (DevForum 2026-07). Details: roblox-networking.

Field-measured:

  • Judge a launch by AssemblyCenterOfMass/AssemblyLinearVelocity, not one part (a tipping plate raised a corner 88 studs at zero velocity).
  • Overlapping client copies launched up to 330 studs/s despite NoCollisionConstraints; cap rise, speed and spin in Heartbeat.
  • Dash momentum dies when LinearVelocity is disabled (the Humanoid zeroes sideways speed): keep it on, aimed at current velocity minus Gravity * dt on Y.
  • IKControl on arms flipped 120-180° per frame when a hand crossed the chest or went overhead. Use analytic two-bone IK into Transform in PreSimulation, elbow bent toward a fixed pole.

4. Raycasts and spatial queries

  • Invisible colliding boxes caught every close melee ray despite CanQuery = false. Visual MeshPart floor (CanCollide off) over an invisible collider: decide RespectCanCollide deliberately.
  • ExcludeInstances/IncludeInstances combine; exclusion wins. IncludeInstances = nil = everything, {} = nothing. Legacy FilterDescendantsInstances + FilterType still works.
  • Include only hits descendants of the listed instances: colliders outside the arena folder made placement rays miss real floors. Send the player a visible refusal reason.
  • New (2026-11): RaycastParams.Margin (>= 0) expands the cast shape, so non-zero on Raycast is a sphere cast (counts toward the size limit). RaycastParams.SizeGradient (>= -1) scales the shape over the cast (1 ends twice as large), for cone melee sweeps. WorldRoot:Shapecast(part, dir, params?, cframeOverride?, sizeOverride?) casts a part's geometry from another pose without moving it; it ignores parts initially intersecting (use GetPartsInPart), max 1024 studs, throws on Terrain.

5. Contacts and debris

  • Cost is contacts, not which machine simulates. Cheap debris = anchored, non-colliding parts moved by your own sim with one workspace:BulkMoveTo per frame and raycasts for landing, or one invisible physics proxy per chunk carrying anchored visuals.
  • Stats.ContactsCount is scene-wide: price an object by reading it before and after adding it. GetTouchingParts won't show the hidden contacts.
  • Anchor big resting debris after ~1 s still; client piles below ~0.5 studs/s and 0.3 rad/s held 0.5 s. Settle loot only when slow ~0.15 s and grounded (lowest point within ~0.25 studs of a down-ray hit); first-slow-frame anchoring caught 9 of 22 mid-bounce. Wake settled bodies only for events that can remove their support.
  • BasePart:BindToCollisionSummaries (2026-10): per-frame callback after simulation with Point, Normal, RelativeVelocity, Area, Part1 per contact patch. Nothing for sleeping-on-sleeping or CanCollide = false. Nothing replicates: subscribe on the owner (the server read ~5 for a 19 studs/s client throw). Impact speed = math.abs(s.RelativeVelocity:Dot(s.Normal)). Validate damage on the server.
  • Enum.CollisionFidelity.Tunable (2026-10) exposes CollisionPrecision (0-1, set in Studio, not by game scripts; default from mesh size). Cheaper: Box, Hull.
  • A November 2026 wedge collision fix also changed block collisions and broke obby techniques (thread): re-test collision shapes after engine updates.