roblox-physics
БесплатноБез исполняемых скриптовНе проверенPhysics and spatial queries - Raycast/Blockcast/Spherecast, overlap queries, collision groups, Touched pitfalls, collision summaries (impact…
от EL4CTEO★ 169 звёзд на GitHubОб этом скилле
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. - Newer filters:
params.ExcludeInstances/IncludeInstances(can be combined; exclude wins) supersedeFilterType+FilterDescendantsInstancesfor new code. RespectCanCollide = trueto ignore non-collidable parts;CollisionGroup = "Name"to query as a group.- Shapecasts (October 2026):
params.Margininflates/rounds the cast shape (aRaycastwith a margin acts as a spherecast — use a thin one where rays slip through seams);params.SizeGradientgrows/shrinks it along the cast (0.5ends 50% larger,-1shrinks to nothing) for cones and funnels;workspace:Shapecast(part, direction, params, cframeOverride?, sizeOverride?)casts a part from any pose/size without moving it (placement previews). Debug: Studio Visualization Modes → Physics → Shapecasts. 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("Pa
Установить roblox-physics в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл roblox-physics?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл roblox-physics запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic