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
- 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, and CanQuery. These flags are not interchangeable.
- 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.
- 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.
- 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 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.
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
1---2name: roblox-physics3description: 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.4---5
6# Roblox physics
7
8Choose deliberately between simulation, character control, hit detection, and visual-only motion;
9they are different jobs. Targets Roblox's rolling platform APIs. Pair with `physics-tuning` for
10engine-neutral stability and feel.
11
12## When to use
13
14- Use for BasePart assemblies, constraints, collision/query policy, ray/overlap queries, forces,
15 impulses, moving physical objects, network ownership, or physics cleanup.
16- Use when `Touched` is unreliable/security-sensitive, parts tunnel or jitter, a mechanism breaks
17 when anchored, or old BodyMover patterns appear.
18
19**When not to use:** ordinary Humanoid lifecycle/control belongs to `roblox-characters`; remote
20validation belongs to `roblox-networking`; decorative UI/world motion may only need a tween.
21
22## Decide the system first
23
24| Goal | Mechanism |
25|---|---|
26| sustained physical interaction | unanchored assembly + modern constraints/forces |
27| instantaneous physical change | `ApplyImpulse` / `ApplyAngularImpulse` |
28| kinematic platform/path | controlled pivot/transform with an explicit passenger policy |
29| character locomotion | Humanoid/custom character controller (`roblox-characters`) |
30| authoritative hit test | server raycast/overlap with filters and gameplay validation |
31| cosmetic trail/recoil | local visual motion; no gameplay authority |
32
33## Workflow
34
351. **Inspect the mechanism.** In Studio, visualize assemblies, anchors, constraints, collision
36 groups, massless parts, and network owners. Identify the assembly root and intended authority.
372. **Define interaction policy.** Write the collision-group matrix and separately decide
38 `CanCollide`, `CanTouch`, and `CanQuery`. These flags are not interchangeable.
393. **Choose simulation or query.** Do not use `.Touched` as a universal hit detector. Use a ray for
40 a path/line, an overlap query for a volume, and simulation contacts when physical response is
41 actually required.
424. **Apply motion at assembly level.** Forces on a part affect its assembly. Use modern
43 `LinearVelocity`, `AngularVelocity`, `VectorForce`, `AlignPosition`, and `AlignOrientation`
44 constraints as appropriate; migrate deprecated BodyMovers when changing that system.
455. **Set ownership deliberately.** Server-own gameplay-critical loose assemblies when required;
46 client ownership can improve responsiveness but never authorizes gameplay results.
476. **Bound cost and lifetime.** Reuse query parameters, cap query frequency/result count, remove
48 temporary constraints/attachments, and disconnect event listeners.
497. **Verify under load and multiplayer.** Test anchored/unanchored transitions, mass extremes,
50 collision matrix, fast motion, multiple clients, ownership changes, streaming, and cleanup.
51
52## Pattern: filtered server raycast
53
54```lua
55local Workspace = game:GetService("Workspace")
56
57local params = RaycastParams.new()
58params.FilterType = Enum.RaycastFilterType.Exclude
59params.FilterDescendantsInstances = {shooterCharacter}
60params.IgnoreWater = true
61params.CollisionGroup = "WeaponQuery"
62
63local direction = aimDirection.Unit * MAX_RANGE
64local result = Workspace:Raycast(muzzlePosition, direction, params)
65if result then
66 local model = result.Instance:FindFirstAncestorOfClass("Model")
67 local humanoid = model and model:FindFirstChildOfClass("Humanoid")
68 if humanoid and serverCanDamage(shooter, model, result.Position) then
69 humanoid:TakeDamage(serverWeaponDamage(shooter))
70 end
71end
72```
73
74The server must validate the origin/direction against server-known character/weapon state; do not
75accept an arbitrary client origin and treat the raycast itself as validation.
76
77## Pattern: overlap volume with explicit policy
78
79```lua
80local params = OverlapParams.new()
81params.FilterType = Enum.RaycastFilterType.Exclude
82params.FilterDescendantsInstances = {sourceCharacter}
83params.CollisionGroup = "DamageQuery"
84params.MaxParts = 64
85
86local seen: {[Model]: boolean} = {}
87for _, part in Workspace:GetPartBoundsInBox(hitboxCFrame, hitboxSize, params) do
88 local model = part:FindFirstAncestorOfClass("Model")
89 if model and not seen[model] then
90 seen[model] = true
91 validateAndApplyHit(model)
92 end
93end
94```
95
96Bounds queries use bounding boxes and can include multiple parts from one target; deduplicate and
97perform exact/gameplay checks as needed. For exact geometry use `WorldRoot:GetPartsInPart(part, overlapParams)`
98only when its additional cost is justified. Note `OverlapParams.RespectCanCollide` decides whether a
99query honours `CanCollide` or `CanQuery` — set it deliberately, or it silently overrides the flag
100policy below. `OverlapParams.Tolerance` controls contact slop.
101
102## Assemblies, force, and ownership
103
104- Welded parts form one rigid assembly; force, impulse, velocity, mass, and ownership operate on
105 that assembly. Anchoring a part changes simulation/ownership and can make an assembly effectively
106 infinite mass.
107- Apply an impulse for a one-time change; use a force or velocity constraint for sustained control.
108 Setting `AssemblyLinearVelocity` is an immediate state change, not a continuous force model.
109- Prefer attachments plus modern constraints over `BodyPosition`, `BodyVelocity`, `BodyGyro`, and
110 other deprecated BodyMovers when authoring or revising a mechanism.
111- Automatic ownership may move nearby unanchored assemblies to clients. Use
112 `SetNetworkOwner(nil)` conservatively for critical objects, then measure responsiveness/server
113 cost. Visualize network owners in Studio.
114- A client owner can manipulate physical results and `.Touched` observations. The server validates
115 consequential hits, positions, timing, and permissions independently.
116
117## Common failures
118
119| Symptom | Likely cause | Remedy |
120|---|---|---|
121| welded mechanism will not move | one part anchored | inspect full assembly; anchor only intentional world roots |
122| force behaves too strongly/weakly | assembly mass ignored | inspect `AssemblyMass`; tune force/impulse by intended acceleration |
123| hit misses fast projectile | discrete touch sampling/tunneling | swept query — `WorldRoot:Blockcast()`, `Spherecast()`, or `Shapecast()` — plus `physics-tuning`; do not rely only on `.Touched` |
124| ray hits shooter/effects | filters/collision group absent | reuse explicit params and query group |
125| same target damaged many times | overlap returned multiple body parts | deduplicate by target model and enforce attack ID/cooldown |
126| exploit fires impossible touch | client owns relevant physics | server query/context validation; deliberate ownership |
127| invisible trigger blocks or cannot query | three flags conflated | set `CanCollide`, `CanTouch`, `CanQuery` independently |
128| mechanism leaks attachments | temporary constraint lifecycle missing | own and destroy constraints, attachments, and connections together |
129
130## Resources
131
132- Read `references/queries-and-ownership.md` for collision/query matrices, assembly debugging,
133 ownership security, migration choices, and the physics verification matrix.
134
135## Related skills
136
137- `physics-tuning` — timestep, jitter, tunneling, mass ratios, and stability methodology.
138- `roblox-characters` — Humanoid/custom movement and respawn lifecycle.
139- `roblox-networking` — authoritative validation of client-requested physical actions.
140- `roblox-studio-workflow` — visualization, Output, and multi-client verification.
141
142## Primary references
143
144- `https://create.roblox.com/docs/physics/assemblies`
145- `https://create.roblox.com/docs/physics/network-ownership`
146- `https://create.roblox.com/docs/workspace/raycasting`