
roblox-physics
Physics and spatial queries - Raycast/Blockcast/Spherecast, overlap queries, collision groups, Touched pitfalls, collision summaries (impact point/normal/speed), assemblies and welds, mover constraints replacing BodyMovers, mechanical constraints, network ownership, CFrame math, vehicles/projectiles, and server authority (BindToSimulation, prediction, rollback). Use when moving parts, detecting hits, building vehicles or projectiles, or fixing jitter, flinging, or ownership bugs.
- Installs
- 438
- Last 24h
- +22
- Trending rank
- #5600
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/el4cteo/roblox-skills --skill roblox-physics- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads roblox-physics automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Roblox physics and spatial queries
Spatial queries (use these, not Touched, for gameplay decisions)
--!strict
local params = RaycastParams.new()
params.FilterType = Enum.RaycastFilterType.Exclude
params.FilterDescendantsInstances = {} -- e.g. { character } of the shooter
params.IgnoreWater = true
local function castRay(origin: Vector3, direction: Vector3): RaycastResult?
-- direction's length is the max distance
return workspace:Raycast(origin, direction, params)
end
local result = castRay(Vector3.new(0, 50, 0), Vector3.new(0, -100, 0))
if result then
print(result.Instance, result.Position, result.Normal, result.Material, result.Distance)
end
-- Swept volumes: thick bullets, melee arcs, ground checks with width.
local sphereHit = workspace:Spherecast(Vector3.new(0, 10, 0), 2, Vector3.new(0, 0, 50), params)
local boxHit = workspace:Blockcast(CFrame.new(0, 10, 0), Vector3.new(4, 4, 4), Vector3.new(0, 0, 50), params)
-- Volume overlap: explosions, hitboxes, zone checks.
local overlap = OverlapParams.new()
overlap.FilterType = Enum.RaycastFilterType.Exclude
overlap.MaxParts = 50
local partsInBox = workspace:GetPartBoundsInBox(CFrame.new(0, 5, 0), Vector3.new(10, 10, 10), overlap)
local partsInSphere = workspace:GetPartBoundsInRadius(Vector3.zero, 15, overlap)
print(sphereHit, boxHit, #partsInBox, #partsInSphere)
- Reuse params objects; update
FilterDescendantsInstances(orparams:AddToFilter(instance)) instead of allocating per call. RespectCanCollide = trueto ignore non-collidable parts;CollisionGroup = "Name"to query as a group.GetPartsInPart(part, params)does exact geometry overlap (costlier);GetPartBoundsIn*use bounding boxes.- Deprecated:
FindPartOnRay*,Ray.new,FindPartsInRegion3*→ use the APIs above. - Client queries only see streamed-in parts; authoritative checks run on the server.
Touched: know its limits
Touched fires from the physics engine, only for parts that physically contact, is fired by whoever
simulates the part (clients can spoof or suppress it for parts they own), and can fire many times per
contact. Use it for triggers (pads, pickups) with a debounce and server-side validation; use spatial
queries for hit detection and zones.
--!strict
local Players = game:GetService("Players")
local pad = Instance.new("Part")
pad.Anchored = true
pad.Parent = workspace
local recently: { [Player]: boolean } = {}
pad.Touched:Connect(function(hit)
local character = hit:FindFirstAncestorOfClass("Model")
local player = character and Players:GetPlayerFromCharacter(character)
if not player or recently[player] then
return
end
recently[player] = true
print(`{player.Name} stepped on the pad`)
task.delay(1, function()
recently[player] = nil
end)
end)
Collision summaries (impact data)
For how parts hit (impact FX, impact audio, damage by impact speed), use
BasePart:BindToCollisionSummaries(callback) instead of Touched. Once per frame after the physics step,
the callback gets every contact of that part: Part0 (the bound part), Part1, Point, Normal (points
away from Part0), RelativeVelocity (before the solver resolves the hit), Area, and Time.
- Fires only where the part is simulated (its network owner); nothing replicates. Send what others need through your own remote, validated on the server.
- No summaries for
CanCollide = falseparts or between two sleeping parts; non-convex parts can produce several summaries per pair. Cost scales with bound parts, not total collisions.
--!strict
local function bindImpacts(part: BasePart, onImpact: (point: Vector3, speed: number) -> ()): RBXScriptConnection
return part:BindToCollisionSummaries(function(summaries: { any })
for _, summary in summaries do
local speed = math.abs(summary.RelativeVelocity:Dot(summary.Normal)) -- head-on impact speed
if speed > 10 then
onImpact(summary.Point, speed)
end
end
end)
end
return bindImpacts
Collision groups
--!strict
-- Collision group APIs now live on WorldRoot (workspace); the PhysicsService versions are superseded.
workspace:RegisterCollisionGroup("Players")
workspace:RegisterCollisionGroup("Ghosts")
workspace:CollisionGroupSetCollidable("Players", "Ghosts", false)
local ghost = Instance.new("Part")
ghost.CollisionGroup = "Ghosts" -- assign by name (CollisionGroupId/SetPartCollisionGroup are deprecated)
ghost.Parent = workspace
Register groups once at server start (max 32, see workspace:GetMaxCollisionGroups()). CanCollide = false removes all collisions;
CanQuery = false hides a part from raycasts; CanTouch = false disables Touched (saves CPU);
NoCollisionConstraint disables collision between two specific parts.
MeshPart collision shape: CollisionFidelity Box/Hull (cheap), Default, PreciseConvexDecomposition
(costly), or Tunable with a CollisionPrecision slider (set in Studio; scripts can't write it) to trade
precision for performance per mesh.
Assemblies and joints
- An assembly = parts rigidly connected (welds,
WeldConstraint,Motor6D, rigid constraints). It simulates as one body; the root part (part.AssemblyRootPart) determines network ownership. - Anchor static geometry. Unanchored + welded to an anchored part = anchored assembly.
- Weld at edit time with
WeldConstraint(keeps current offset); in code setPart0/Part1and parent. - Move whole models with
model:PivotTo(cframe). Moving many parts at once:workspace:BulkMoveTo. - Read/set physics via
AssemblyLinearVelocity/AssemblyAngularVelocity,part:ApplyImpulse(),ApplyAngularImpulse(),AssemblyMass.Velocity/RotVelocityare deprecated. CustomPhysicalProperties = PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight).- Units: 1 stud ≈ 0.28 m,
workspace.Gravitydefault 196.2 studs/s².
Mover constraints (replace BodyMovers)
| Goal | Constraint | Replaces |
|---|---|---|
| Hold/drive a velocity | LinearVelocity (VelocityConstraintMode Vector/Plane/Line) | BodyVelocity |
| Move toward a position | AlignPosition (Mode = OneAttachment + Position, Responsiveness, MaxForce) | BodyPosition |
| Rotate toward an orientation | AlignOrientation (CFrame/LookAtPosition) | BodyGyro |
| Constant force | VectorForce (RelativeTo = World) | BodyForce, BodyThrust |
| Spin | AngularVelocity | BodyAngularVelocity |
| Pull toward point | LineForce | RocketPropulsion |
| Torque | Torque | — |
All need an Attachment (Attachment0). Set MaxForce/MaxTorque realistically (not math.huge
unless intended) or objects fling. Mechanical constraints: HingeConstraint (Motor/Servo actuators for
wheels, doors), PrismaticConstraint (sliders, elevators), SpringConstraint (suspension),
RopeConstraint, RodConstraint, BallSocketConstraint, CylindricalConstraint (wheel + steering),
UniversalConstraint, RigidConstraint.
Vehicle and projectile recipes, CFrame cookbook: references/recipes.md.
Network ownership
- The server auto-assigns ownership of unanchored assemblies to a nearby client (smooth for that client, exploitable by it). Characters are owned by their player.
part:SetNetworkOwner(nil)= server simulates (secure, laggier for players);SetNetworkOwner(player)for a vehicle driver;SetNetworkOwnershipAuto()to restore. Call on the root part, server-side, after the assembly is inWorkspace. Anchored parts have no owner.- Ownership changes cause hitches; don't flip it every frame. Visualize with the viewport's Visualization options → Network owners toggle.
Server authority (competitive games)
Workspace AuthorityMode = Server makes the server simulate everything while clients predict a few
frames ahead and roll back/resimulate on mispredictions. Requirements: NextGenerationReplication,
PlayerScriptsUseInputActionSystem, SignalBehavior = Deferred, UseFixedSimulation, StreamingEnabled
(setting AuthorityMode sets these). Core rules:
- Game logic lives in functions bound with
RunService:BindToSimulation(fn)inside a ModuleScript required by both server and client. - Clients affect the game only through Input Actions (InputContexts parented under the
Player), notUserInputServiceevents. - Sync custom state through attributes on predicted instances, written only inside simulation callbacks.
- Don't cache
AnimationTracks; queryAnimator:GetTrackByAnimationId()each step. - Read a player's camera on the server with
player:GetCameraState()(CFrame,FieldOfView,ViewportSize); the old cameraInputActionreplication no longer syncs.
Fully released (opt-in) since July 2026. Details and patterns: references/server-authority.md.
Stability tips
- Jitter: conflicting ownership, constraints fighting, huge mass ratios (> 1:100), or setting CFrame on unanchored parts every frame (use constraints instead).
- Flinging:
MaxForce = math.hugeon light parts, overlapping collisions at spawn, NaN/huge velocities. - Sleeping assemblies stop simulating until disturbed — wake with a small impulse if needed.
- Adaptive timestepping (
Workspace.PhysicsSteppingMethod = Adaptive) saves CPU; use fixed for precise mechanisms.
Related skills
roblox-security (ownership exploits), roblox-characters-animation, roblox-networking,
roblox-performance, roblox-input.
FAQ
What does the roblox-physics skill do?
Physics and spatial queries - Raycast/Blockcast/Spherecast, overlap queries, collision groups, Touched pitfalls, collision summaries (impact point/normal/speed), assemblies and welds, mover constraints replacing BodyMovers, mechanical constraints, network ownership, CFrame math, vehicles/projectiles, and server authority (BindToSimulation, prediction, rollback). Use when moving parts, detecting hits, building vehicles or projectiles, or fixing jitter, flinging, or ownership bugs.
How do I install roblox-physics?
Run npx skills add https://github.com/el4cteo/roblox-skills --skill roblox-physics in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/roblox-physics/ (personal) or .claude/skills/roblox-physics/ (project).
Which AI agents can use roblox-physics?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is roblox-physics safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains roblox-physics?
It is published by el4cteo in el4cteo/roblox-skills. It has 438 recorded installs.
More from el4cteo/roblox-skills
roblox-world-building
el4cteo/roblox-skills
Building worlds with code - parts, models and pivots, materials, Lighting (LightingStyle, Atmosphere, post-processing), day/night, Terrain API, in-game CSG and destruction (GeometryService Subtract/Union/Fragment), ProceduralModel, EditableMesh/EditableImage, particles/beams/trails/highlights. Use when creating maps, environments, lighting, destructible objects, procedural levels, or visual effects.
roblox-ui
el4cteo/roblox-skills
Responsive cross-platform UI - ScreenGui and safe areas (ScreenInsets), Scale vs Offset, UIListLayout flex/UIFlexItem, constraints, StyleSheets/tokens/themes, RichText, gamepad/touch navigation, UIDragDetector, CanvasGroup, tweens, BillboardGui/SurfaceGui, React-lua/Fusion/Vide. Use when building HUDs, menus, shops, inventories, or fixing UI that breaks on mobile, console, or other screen sizes.
roblox-luau
el4cteo/roblox-skills
Modern, type-safe Luau for Roblox, covering --!strict and the new type solver, generics, string interpolation, if-expressions, task library, require-by-string, module/OOP patterns, error handling with retries, buffer/vector, and legacy APIs to avoid. Use when writing, refactoring, or explaining any Roblox script, fixing type errors, or modernizing old Lua code.
roblox-testing
el4cteo/roblox-skills
Open the skill to read its SKILL.md instructions.
roblox-game-systems
el4cteo/roblox-skills
Recipes for common systems built on server authority - currency service and leaderstats, XP/levels, round loops with intermission and teams, validated melee/ranged combat, inventory and tools, soft-currency shops, obby checkpoints, daily rewards, pets. Use when implementing or reviewing gameplay systems such as rounds, combat, weapons, inventories, shops, currencies, or progression.
roblox-security
el4cteo/roblox-skills
Anti-exploit design - never trust the client, validate every remote argument (NaN, spoofed instances, strings), rate limiting, ProximityPrompt/ClickDetector abuse, network ownership, movement and hit validation, economy/trade duplication, code confidentiality, secure teleports, heuristics, Ban API. Use when writing server handlers for client input, combat/economy/trading, or reviewing for exploits.
Popular education & science skills
teach
mattpocock/skills
Teach the user a new skill or concept, within this workspace.
scaffold-exercises
mattpocock/skills
Create exercise directory structures with sections, problems, solutions, and explainers that pass linting. Use when user wants to scaffold exercises, create exercise stubs, or set up a new course section.
paper-context-resolver
lllllllama/rigorpilot-skills
Rigor Paper Context helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacing README guidance by default.
caveman-learn
juliusbrussee/caveman
Act on a Caveman learn report - review the ranked token sinks, apply cost-lowering fixes with per-edit consent, and report what those fixes returned. Use when asked to lower an agent's token cost, what caveman has saved, to trim a heavy CLAUDE.md, or to offload re-pasted context into cavemem.
gsap-plugins
greensock/gsap-skills
Official GSAP skill for GSAP plugins — registration, ScrollToPlugin, ScrollSmoother, Flip, Draggable, Inertia, Observer, SplitText, ScrambleText, SVG and physics plugins, CustomEase, EasePack, CustomWiggle, CustomBounce, GSDevTools. Use when the user asks about a GSAP plugin, scroll-to, flip animations, draggable, SVG drawing, or plugin registration.
teach-impeccable
pbakaus/impeccable
DEPRECATED: Use /impeccable teach instead. This command has been folded into the impeccable skill.