roblox-physics
Build or debug Roblox vehicles, mechanisms, and moving objects. Use for assemblies, mechanical or mover constraints, network ownership, collision filtering, and simulation performance.
Install
npx skills add https://github.com/nonlooped/roblox-suite/tree/main/roblox-physics
claude plugin marketplace add https://llmmart.ai/marketplace.json && claude plugin install nonlooped-roblox-suite@llmmart
git clone https://github.com/nonlooped/roblox-suite.git
The skills CLI installs just this skill, for any of its supported agents. Claude Code installs the whole nonlooped/roblox-suite collection as a plugin from our marketplace. Git is the plain clone.
Skill manifest
roblox-physics
Official sources:
- https://create.roblox.com/docs/physics
- https://create.roblox.com/docs/physics/assemblies
- https://create.roblox.com/docs/physics/mechanical-constraints
- https://create.roblox.com/docs/physics/mover-constraints
- https://create.roblox.com/docs/physics/network-ownership
- https://create.roblox.com/docs/physics/sleep-system
- https://create.roblox.com/docs/physics/adaptive-timestepping
- https://create.roblox.com/docs/physics/units
- https://create.roblox.com/docs/workspace/collisions
Use mechanical constraints to connect parts and mover constraints to apply forces or velocity targets. For older code, use the BodyMover migration table below.
Core concepts
Assemblies
An assembly is one or more parts connected by rigid welds or movable joints, simulated as a single rigid body.
Key BasePart properties (same for any part in the assembly):
AssemblyLinearVelocity/AssemblyAngularVelocity: prefer constraints orApplyImpulseover direct assignment for realistic motion.AssemblyCenterOfMass: force here produces pure linear acceleration.AssemblyMass: sum of all part masses; infinite if any part is anchored.AssemblyRootPart: automatically chosen root for replication and network ownership.
Root-part priority: anchored > non-massless > higher RootPriority > size/name heuristics.
Anchoring
- Anchoring one part in an assembly makes it the root; the rest are implicitly anchored.
- Anchoring multiple parts in the same assembly splits it.
- To anchor an entire assembly, only anchor the root part.
Collision filtering
Use collision groups (Workspace:RegisterCollisionGroup (inherited from WorldRoot), BasePart.CollisionGroup) or NoCollisionConstraint for part-to-part filtering. CanCollide, CanTouch, and CanQuery control different behaviors; see references/collisions-and-filtering.md.
Mechanical constraints
All mechanical constraints connect one or two Attachments (or Bones), except WeldConstraint and NoCollisionConstraint which use Part0/Part1.
| Constraint | Use case |
|---|---|
WeldConstraint |
Rigidly lock two parts together, same relative transform |
RigidConstraint |
Same as WeldConstraint but attachment-based, supports bones |
HingeConstraint |
Doors, levers, rotating parts; motor/servo optional |
PrismaticConstraint |
Sliding doors, elevators, pistons |
CylindricalConstraint |
Slides + rotates, like hydraulic rams or landing gear |
SpringConstraint |
Springs, shocks, suspension |
TorsionSpringConstraint |
Rotational springs |
BallSocketConstraint |
Shoulders, ball joints |
UniversalConstraint |
Drive shafts, constant-velocity joints |
RopeConstraint |
Cables, winches, maximum length |
RodConstraint |
Fixed separation distance |
PlaneConstraint |
Constrain motion to a plane |
NoCollisionConstraint |
Disable collisions between two specific parts |
See references/mechanical-constraints.md for creation, orientation, motor/servo tuning, and limits.
Mover constraints
Modern replacements for deprecated BodyMovers:
| Legacy | Modern | Use case |
|---|---|---|
BodyPosition |
AlignPosition |
Move attachment to a position or another attachment |
BodyGyro |
AlignOrientation |
Align orientation; LookAtPosition for tracking |
BodyVelocity |
LinearVelocity |
Maintain constant velocity along vector/line/plane |
BodyAngularVelocity |
AngularVelocity |
Maintain constant angular velocity |
BodyForce/BodyThrust |
VectorForce |
Apply constant force |
RocketPropulsion |
LineForce + AlignOrientation |
Follow + face target |
| - | Torque |
Apply constant torque |
| - | LineForce |
Force along line between two attachments |
| - | AnimationConstraint |
Constraint driven by animation/transform |
See references/mover-constraints.md for force modes (Magnitude vs PerAxis), relativity frames, rigidity, and reaction forces.
Network ownership
- The server owns anchored parts.
- Unanchored parts near a player character are automatically owned by that client.
- Set ownership explicitly with
BasePart:SetNetworkOwner(player)(server only). Reset withSetNetworkOwnershipAuto(). - Assign vehicle/driver ownership carefully: the first seated player may own the whole assembly otherwise.
Security: clients can exploit owned parts (teleport, fake collisions). Validate gameplay-critical events server-side. See references/network-ownership.md.
Sleep system
Assemblies stop simulating when still to save performance. They wake on collisions, property changes, impulses, or gravity/wind changes.
- If a slow mechanism falls asleep, increase motion or use actuated joints (motor/servo constraints) which get stricter sleep thresholds.
- Visualize sleep states with Awake parts in Studio's Visualization Options.
Physics stepping method
Workspace.PhysicsSteppingMethod:
- Fixed (default, 240 Hz): best general choice; use for racing, destruction, tanks, or when most parts already solve at 240 Hz.
- Adaptive: assigns assemblies to 60/120/240 Hz islands for up to ~2.5× performance in suitable experiences.
Use the MicroProfiler to check island distribution.
Units quick reference
| Roblox | Metric |
|---|---|
| 1 stud | 28 cm |
| 1 RMU | 21.952 kg |
| 196.2 studs/s² | default "Classic" gravity |
| 35 studs/s² | "Realistic" gravity (≈ 9.8 m/s²) |
See references/units-and-physical-properties.md.
Common mistakes
- Using deprecated
BodyMovers instead of modern constraints. - Setting
CFrameevery frame instead of using forces/constraints. - Anchoring every part in an assembly (splits it and hurts performance).
- Ignoring network ownership on vehicles and then wondering why input lags.
- Trusting
Touchedevents from client-owned parts for damage/authority. - Letting actuated joints fall asleep prematurely.
Scripts
scripts/VehicleController.lua: chassis setup withHingeConstraintsteering and motor drive, with client ownership and server validation.scripts/DoorHinge.lua: motorized/servo door with limits and state machine.scripts/PlatformMover.lua:AlignPosition+AlignOrientationplatform with configurable waypoints.scripts/Suspension.lua: spring-damper suspension usingSpringConstraint.
How to proceed
- Decide if the object is a rigid mechanism (mechanical constraint) or force-driven (mover constraint).
- Plan assemblies, root parts, and anchoring strategy.
- Set network ownership for multiplayer responsiveness.
- Tune forces/velocities using units and physical properties.
- Profile with MicroProfiler and watch sleep/ownership visualizations.
Reference index
- collisions-and-filtering.md: Configure collision groups, touch events, or spatial query filters.
- mechanical-constraints.md: Connect parts with hinges, springs, ropes, or other mechanical constraints.
- mover-constraints.md: Apply forces or velocity targets, or migrate BodyMover code.
- network-ownership.md: Assign physics simulation to the server or a player and debug ownership.
- units-and-physical-properties.md: Tune mass, density, friction, force, or simulation stepping.
Files (roblox-suite)
-
references
-
collisions-and-filtering.md 2.3 KB
--- read_when: "Configure collision groups, touch events, or spatial query filters" last_reviewed: 2026-09-19 --- # Collisions and filtering Official sources: - https://create.roblox.com/docs/workspace/collisions - https://create.roblox.com/docs/reference/engine/classes/WorldRoot - https://create.roblox.com/docs/reference/engine/classes/PhysicsService - https://create.roblox.com/docs/reference/engine/classes/BasePart ## Collision events - `BasePart.Touched`: fires when another part touches. - `BasePart.TouchEnded`: fires when contact ends. - These can fire regardless of `CanCollide`, but both parts must have `CanTouch` enabled. ## Collision filtering ### Collision groups Collision group configuration belongs to each `WorldRoot` (`Workspace` or a `WorldModel`). The current API reference deprecates `PhysicsService` in favor of these methods; existing service calls forward to `Workspace`. Configure the world containing the parts. ```lua local world = workspace for _, name in { "Players", "Projectiles" } do if not world:IsCollisionGroupRegistered(name) then world:RegisterCollisionGroup(name) end end world:CollisionGroupSetCollidable("Players", "Projectiles", false) part.CollisionGroup = "Projectiles" ``` Useful for team-specific collisions, projectile passthrough, etc. ### `NoCollisionConstraint` Disable collisions between two specific parts without managing groups: ```lua local noCollide = Instance.new("NoCollisionConstraint") noCollide.Part0 = partA noCollide.Part1 = partB noCollide.Parent = partA ``` ## `CanCollide`, `CanTouch`, `CanQuery` | Property | Effect | | --- | --- | | `CanCollide` | Physical collision response | | `CanTouch` | Fires `Touched`/`TouchEnded` events | | `CanQuery` | Included in spatial queries (`Raycast`, `GetPartsInPart`, etc.; disabling `CanQuery` takes effect when `CanCollide` is false) | Important: these are **not** confidentiality controls. They affect physics and queries, not replication or rendering. ## Detecting collisions safely For gameplay-critical collisions, prefer server-side checks or Shapecasts/Raycasts over `Touched` events, especially when the touching part is client-owned. ```lua local function onTouched(otherPart) if otherPart:IsDescendantOf(someSafeModel) then return end -- validate distance, ownership, etc. end ``` -
mechanical-constraints.md 4 KB
--- read_when: "Connect parts with hinges, springs, ropes, or other mechanical constraints" last_reviewed: 2026-06-17 --- # Mechanical constraints Official guide: https://create.roblox.com/docs/physics/mechanical-constraints ## Creating constraints Most mechanical constraints require two `Attachment` instances (or `Bone` instances). The constraint's behavior depends on attachment orientation: - **Axis** (yellow arrow) defines primary rotation/translation axes. - **SecondaryAxis** defines secondary orientation. You can create constraints via: 1. Studio **Constraint Picker** in the Model tab. 2. Explorer → insert constraint → link `Attachment0`/`Attachment1` (or `Part0`/`Part1` for Weld/NoCollision). ## Constraint reference ### `WeldConstraint` - Connects `Part0` and `Part1` rigidly. - Maintains relative position and orientation. - Deactivates if parts are anchored into different assemblies. - No attachments needed. ### `RigidConstraint` - Attachment-based rigid connection. - Supports `Bone`s for skinned mesh applications. - Same relative transform behavior as WeldConstraint. ### `HingeConstraint` - Rotates around one shared axis. - **Motor** mode: target `AngularVelocity` with acceleration/torque limits. - **Servo** mode: target `TargetAngle` with speed/torque limits. - `LimitsEnabled` + `LowerAngle`/`UpperAngle`/`Restitution` for swing doors, levers, etc. **Tip:** make sure both attachments' `Axis` properties point the same direction. ### `PrismaticConstraint` - Slides along one axis, no rotation. - Motor/servo modes for elevators, pistons, drawers. - Use `LimitsEnabled` to define slide range. ### `CylindricalConstraint` - Combines prismatic slide + hinge rotation. - Separate linear and angular actuator controls. - Useful for landing gear, hydraulic arms, screw mechanisms. ### `SpringConstraint` - Applies force based on displacement and relative velocity. - `FreeLength` is the rest length. - `Stiffness` and `Damping` tune oscillation. - Optional `MinLength`/`MaxLength`. - Units: stiffness ≈ 0.0456 RMU/s² per N/m; damping ≈ 0.0456 RMU/s per N·s/m. ### `TorsionSpringConstraint` - Applies torque based on angular displacement and velocity. - Useful for torsion bars, rotational return springs. ### `BallSocketConstraint` - Same position, free rotation on all axes. - Optional cone/limit constraints. ### `UniversalConstraint` - Keeps two axes perpendicular. - Common in drive shafts and robotics. ### `RopeConstraint` - Prevents attachments from separating beyond `Length`. - `WinchEnabled` allows motorized length change. ### `RodConstraint` - Maintains fixed separation distance. - Optional tilt limits. ### `PlaneConstraint` - Constrains motion to a plane defined by attachment orientation. ### `NoCollisionConstraint` - Disables collisions between `Part0` and `Part1`. - Both parts still collide with the rest of the world. ## Actuator types Most powered constraints support: - **None**: passive constraint, no force applied. - **Motor**: continuous motion toward a velocity. - **Servo**: moves to and holds a target position/angle. Tuning parameters: - `MaxForce` / `MaxTorque`: caps applied force. - `MotorMaxAcceleration` / `MotorMaxForce`: motor responsiveness. - `Responsiveness`: servo stiffness. - `Restitution`: bounciness at limits. ## Constraint visualization Enable in Studio: - **Show Welds** (`Alt`+`W` / `⌥`+`W`) - **Show Constraint Details** (`Alt`+`D` / `⌥`+`D`) - **Assemblies** / **Mechanisms** in Visualization Options Use these to debug orientation, root parts, and ownership. ## Luau example: powered hinge door ```lua local hinge = script.Parent:WaitForChild("HingeConstraint") -- Open 90 degrees hinge.ActuatorType = Enum.ActuatorType.Servo hinge.ServoMaxTorque = 5000 hinge.AngularSpeed = 2 hinge.TargetAngle = 90 -- Close hinge.TargetAngle = 0 ``` ## Luau example: spring-damper suspension ```lua local spring = script.Parent:WaitForChild("SpringConstraint") spring.Stiffness = 5000 spring.Damping = 500 spring.FreeLength = 3 ``` -
mover-constraints.md 3.9 KB
--- read_when: "Apply forces or velocity targets, or migrate BodyMover code" last_reviewed: 2026-06-17 --- # Mover constraints Official guide: https://create.roblox.com/docs/physics/mover-constraints Mover constraints apply force, velocity, torque, or alignment to assemblies. They are the modern replacement for deprecated `BodyMover` objects. ## Migration table | Deprecated | Modern | Notes | | --- | --- | --- | | `BodyPosition` | `AlignPosition` | Two modes: `Magnitude` and `PerAxis` | | `BodyGyro` | `AlignOrientation` | `LookAtPosition` replaces some look-at logic | | `BodyVelocity` | `LinearVelocity` | Vector/line/plane modes | | `BodyAngularVelocity` | `AngularVelocity` | `RelativeTo` for reference frames | | `BodyForce` / `BodyThrust` | `VectorForce` | Apply constant force relative to world/attachment | | `RocketPropulsion` | `LineForce` + `AlignOrientation` | Follow + face target | ## `AlignPosition` Moves `Attachment0` toward `Attachment1` or a world `Position`. Key properties: - `Mode`: `TwoAttachment` or `OneAttachment`. - `RigidityEnabled`: if `true`, solver does whatever it takes; if `false`, use `MaxForce`, `MaxVelocity`, `Responsiveness`. - `ForceLimitMode`: `Magnitude` (scalar `MaxForce`) or `PerAxis` (vector `MaxAxesForce`). - `ApplyAtCenterOfMass`: apply at CoM instead of attachment point. - `ReactionForceEnabled`: apply equal/opposite force to Attachment1. ## `AlignOrientation` Aligns `Attachment0` orientation with `Attachment1` or a goal orientation. Key properties: - `AlignType`: `PrimaryAxisParallel`, `PrimaryAxisPerpendicular`, or `AllAxes`. - `RigidityEnabled`, `MaxTorque`, `MaxAngularVelocity`, `Responsiveness`. - `LookAtPosition`: separate `Vector3` that points Attachment0's primary axis at a world position (use with `OneAttachment` mode and a target orientation). ## `LinearVelocity` Maintains constant linear velocity on an assembly. - `VelocityConstraintMode`: - `Vector`: 3D velocity vector. - `Line`: velocity along attachment axis. - `Plane`: velocity within a plane. - `RelativeTo`: world, Attachment0, Attachment1. - `ForceLimitMode` / `MaxForce` / `MaxAxesForce`. **Warning:** this applies force to *maintain* velocity. For one-time velocity, use `ApplyImpulse` or set `AssemblyLinearVelocity`. ## `AngularVelocity` Maintains constant angular velocity. - `AngularVelocity` vector in rad/s (relative to `RelativeTo`). - `MaxTorque`. - `RelativeTo`. ## `VectorForce` Applies constant force. - `Force` vector. - `RelativeTo`: world or attachment frame. - Apply at attachment point or CoM depending on setup. ## `Torque` Applies constant torque about the assembly's center of mass. - `Torque` vector. - `RelativeTo`. ## `LineForce` Applies force along the line connecting two attachments. - `InverseSquareLaw`: falloff with distance (like gravity/magnetism). - `Magnitude`. - `ApplyAtCenterOfMass`. ## `AnimationConstraint` Drives attachments by a target CFrame offset. Useful for animation-driven physics. - `IsKinematic`: kinematic or force-based. - `MaxForce` / `MaxTorque`. ## Choosing a mover | Goal | Constraint | | --- | --- | | Move to position | `AlignPosition` | | Face direction / look at target | `AlignOrientation` | | Hover / follow | `AlignPosition` + `AlignOrientation` | | Constant speed car | `LinearVelocity` or `VectorForce` | | Spin propeller | `AngularVelocity` | | Thruster / rocket | `VectorForce` | | Magnet / gravity | `LineForce` | | Guided missile | `LineForce` + `AlignOrientation` | ## Luau example: hover platform ```lua local alignPos = script.Parent:WaitForChild("AlignPosition") local alignOrn = script.Parent:WaitForChild("AlignOrientation") alignPos.RigidityEnabled = false alignPos.MaxForce = 100000 alignPos.MaxVelocity = 50 alignPos.Responsiveness = 50 alignPos.Position = Vector3.new(0, 10, 0) alignOrn.RigidityEnabled = false alignOrn.MaxTorque = 100000 alignOrn.MaxAngularVelocity = 5 alignOrn.Responsiveness = 50 ``` -
network-ownership.md 2.6 KB
--- read_when: "Assign physics simulation to the server or a player and debug ownership" last_reviewed: 2026-06-17 --- # Network ownership Official guide: https://create.roblox.com/docs/physics/network-ownership ## What ownership does Roblox uses distributed physics. Each unanchored assembly is simulated by either the server or a client. The owner simulates locally and replicates state. - **Server-owned**: authoritative, higher latency for clients. - **Client-owned**: responsive for that player, but exploitable. - **Anchored parts** are always server-owned. ## Automatic ownership By default, unanchored parts near a player's character are owned by that client. Ownership can transfer as characters move. ## Manual ownership Server-side only: ```lua part:SetNetworkOwner(player) -- assign to a player part:SetNetworkOwnershipAuto() -- revert to engine defaults part:GetNetworkOwner() -- get current owner ``` Rules: - You can only set ownership on an unanchored assembly root. - Anchoring resets ownership to server. - Setting ownership on one assembly in a mechanism sets ownership for the whole mechanism. ## Common vehicle pattern When a player sits in a `VehicleSeat`, give them ownership so driving feels responsive: ```lua local Players = game:GetService("Players") local vehicleSeat = script.Parent vehicleSeat:GetPropertyChangedSignal("Occupant"):Connect(function() local humanoid = vehicleSeat.Occupant if humanoid then local player = Players:GetPlayerFromCharacter(humanoid.Parent) if player then vehicleSeat:SetNetworkOwner(player) end else vehicleSeat:SetNetworkOwnershipAuto() end end) ``` Also assign ownership of loose parts on the vehicle (e.g., cargo) to the same driver. ## Security implications - Clients can teleport or warp owned parts. - `Touched` events fired by client-owned parts can be faked. - Do not use client-owned physics for authoritative damage, scoring, or checkpoints. - Validate important gameplay events on the server using position/distance/time checks. ## Visualization Enable **Network owners** in Visualization Options. Colors are shown per-assembly: - Blue: the local player owns the assembly. - Green: another client owns the assembly. - Red: buffer zone, pending transfer. - White/grey: server owns the assembly. - Black: no owner (not simulated). ## Debugging tips - If a vehicle feels laggy for the driver, check that the driver owns it. - If a mechanism jitters, ensure all connected assemblies share the same owner. - If a part is black, it may be massless with no owner; anchor it or give it physical significance. -
units-and-physical-properties.md 1.7 KB
--- read_when: "Tune mass, density, friction, force, or simulation stepping" last_reviewed: 2026-06-17 --- # Units and physical properties Official guide: https://create.roblox.com/docs/physics/units ## Primary units | Unit | Roblox | Metric | | --- | --- | --- | | Time | 1 second | 1 second | | Length | 1 stud | 28 cm | | Mass | 1 RMU | 21.952 kg | ## Derived units | Quantity | Metric | Roblox | | --- | --- | --- | | Water density | 1 g/cm³ | 1 RMU/stud³ | | Air density (sea level) | 0.00129 g/cm³ | 0.00129 RMU/stud³ | | Spring stiffness | 1 N/m | 0.0456 RMU/s² | | Spring damping | 1 N·s/m | 0.0456 RMU/s | | Velocity | 1 m/s | 3.57 studs/s | | Force | 1 N | 0.163 Rowtons (RMU·stud/s²) | | Torque | 1 N·m | 0.581 Rowton·studs (RMU·stud²/s²) | ## Gravity presets | Preset | Roblox | Metric | | --- | --- | --- | | Classic (default) | 196.2 studs/s² | 54.936 m/s² | | Realistic | 35 studs/s² | 9.8 m/s² | | Action | 75 studs/s² | 21 m/s² | ## Physical property limits | Property | Min | Max | | --- | --- | --- | | Density | 0.0001 | 100 RMU/stud³ | | Friction | 0.0 | 2.0 | | FrictionWeight | 0.0 | 100 | | Elasticity | 0.0 | 1.0 | | ElasticityWeight | 0.0 | 100 | ## Consistency Use standard Roblox units throughout an experience. Custom interpretations (e.g., 1 stud = 1 foot) require recalibrating all physics constants and can break compatibility with default character controllers. ## Custom physical properties ```lua local props = PhysicalProperties.new( 0.7, -- density 0.3, -- friction 0.5, -- elasticity 1.0, -- frictionWeight 1.0 -- elasticityWeight ) part.CustomPhysicalProperties = props ``` Set `CustomPhysicalProperties = nil` to revert to material defaults.
-
-
scripts
-
DoorHinge.lua 2.1 KB · in bundle
-
PlatformMover.lua 4.3 KB · in bundle
-
Suspension.lua 1.3 KB · in bundle
-
VehicleController.lua 6 KB · in bundle
-
-
SKILL.md 7.8 KB
--- name: roblox-physics description: "Build or debug Roblox vehicles, mechanisms, and moving objects. Use for assemblies, mechanical or mover constraints, network ownership, collision filtering, and simulation performance." last_reviewed: 2026-06-17 --- # roblox-physics **Official sources:** - https://create.roblox.com/docs/physics - https://create.roblox.com/docs/physics/assemblies - https://create.roblox.com/docs/physics/mechanical-constraints - https://create.roblox.com/docs/physics/mover-constraints - https://create.roblox.com/docs/physics/network-ownership - https://create.roblox.com/docs/physics/sleep-system - https://create.roblox.com/docs/physics/adaptive-timestepping - https://create.roblox.com/docs/physics/units - https://create.roblox.com/docs/workspace/collisions Use mechanical constraints to connect parts and mover constraints to apply forces or velocity targets. For older code, use the BodyMover migration table below. ## Core concepts ### Assemblies An **assembly** is one or more parts connected by rigid welds or movable joints, simulated as a single rigid body. Key `BasePart` properties (same for any part in the assembly): - `AssemblyLinearVelocity` / `AssemblyAngularVelocity`: prefer constraints or `ApplyImpulse` over direct assignment for realistic motion. - `AssemblyCenterOfMass`: force here produces pure linear acceleration. - `AssemblyMass`: sum of all part masses; infinite if any part is anchored. - `AssemblyRootPart`: automatically chosen root for replication and network ownership. Root-part priority: anchored > non-massless > higher `RootPriority` > size/name heuristics. ### Anchoring - Anchoring one part in an assembly makes it the root; the rest are implicitly anchored. - Anchoring multiple parts in the same assembly **splits** it. - To anchor an entire assembly, only anchor the root part. ### Collision filtering Use collision groups (`Workspace:RegisterCollisionGroup` (inherited from `WorldRoot`), `BasePart.CollisionGroup`) or `NoCollisionConstraint` for part-to-part filtering. `CanCollide`, `CanTouch`, and `CanQuery` control different behaviors; see [references/collisions-and-filtering.md](references/collisions-and-filtering.md). ## Mechanical constraints All mechanical constraints connect one or two `Attachment`s (or `Bone`s), except `WeldConstraint` and `NoCollisionConstraint` which use `Part0`/`Part1`. | Constraint | Use case | | --- | --- | | `WeldConstraint` | Rigidly lock two parts together, same relative transform | | `RigidConstraint` | Same as WeldConstraint but attachment-based, supports bones | | `HingeConstraint` | Doors, levers, rotating parts; motor/servo optional | | `PrismaticConstraint` | Sliding doors, elevators, pistons | | `CylindricalConstraint` | Slides + rotates, like hydraulic rams or landing gear | | `SpringConstraint` | Springs, shocks, suspension | | `TorsionSpringConstraint` | Rotational springs | | `BallSocketConstraint` | Shoulders, ball joints | | `UniversalConstraint` | Drive shafts, constant-velocity joints | | `RopeConstraint` | Cables, winches, maximum length | | `RodConstraint` | Fixed separation distance | | `PlaneConstraint` | Constrain motion to a plane | | `NoCollisionConstraint` | Disable collisions between two specific parts | See [references/mechanical-constraints.md](references/mechanical-constraints.md) for creation, orientation, motor/servo tuning, and limits. ## Mover constraints Modern replacements for deprecated `BodyMover`s: | Legacy | Modern | Use case | | --- | --- | --- | | `BodyPosition` | `AlignPosition` | Move attachment to a position or another attachment | | `BodyGyro` | `AlignOrientation` | Align orientation; `LookAtPosition` for tracking | | `BodyVelocity` | `LinearVelocity` | Maintain constant velocity along vector/line/plane | | `BodyAngularVelocity` | `AngularVelocity` | Maintain constant angular velocity | | `BodyForce`/`BodyThrust` | `VectorForce` | Apply constant force | | `RocketPropulsion` | `LineForce` + `AlignOrientation` | Follow + face target | | - | `Torque` | Apply constant torque | | - | `LineForce` | Force along line between two attachments | | - | `AnimationConstraint` | Constraint driven by animation/transform | See [references/mover-constraints.md](references/mover-constraints.md) for force modes (`Magnitude` vs `PerAxis`), relativity frames, rigidity, and reaction forces. ## Network ownership - The server owns anchored parts. - Unanchored parts near a player character are automatically owned by that client. - Set ownership explicitly with `BasePart:SetNetworkOwner(player)` (server only). Reset with `SetNetworkOwnershipAuto()`. - Assign vehicle/driver ownership carefully: the first seated player may own the whole assembly otherwise. **Security:** clients can exploit owned parts (teleport, fake collisions). Validate gameplay-critical events server-side. See [references/network-ownership.md](references/network-ownership.md). ## Sleep system Assemblies stop simulating when still to save performance. They wake on collisions, property changes, impulses, or gravity/wind changes. - If a slow mechanism falls asleep, increase motion or use actuated joints (motor/servo constraints) which get stricter sleep thresholds. - Visualize sleep states with **Awake parts** in Studio's Visualization Options. ## Physics stepping method Workspace.PhysicsSteppingMethod: - **Fixed** (default, 240 Hz): best general choice; use for racing, destruction, tanks, or when most parts already solve at 240 Hz. - **Adaptive**: assigns assemblies to 60/120/240 Hz islands for up to ~2.5× performance in suitable experiences. Use the MicroProfiler to check island distribution. ## Units quick reference | Roblox | Metric | | --- | --- | | 1 stud | 28 cm | | 1 RMU | 21.952 kg | | 196.2 studs/s² | default "Classic" gravity | | 35 studs/s² | "Realistic" gravity (≈ 9.8 m/s²) | See [references/units-and-physical-properties.md](references/units-and-physical-properties.md). ## Common mistakes - Using deprecated `BodyMover`s instead of modern constraints. - Setting `CFrame` every frame instead of using forces/constraints. - Anchoring every part in an assembly (splits it and hurts performance). - Ignoring network ownership on vehicles and then wondering why input lags. - Trusting `Touched` events from client-owned parts for damage/authority. - Letting actuated joints fall asleep prematurely. ## Scripts - `scripts/VehicleController.lua`: chassis setup with `HingeConstraint` steering and motor drive, with client ownership and server validation. - `scripts/DoorHinge.lua`: motorized/servo door with limits and state machine. - `scripts/PlatformMover.lua`: `AlignPosition` + `AlignOrientation` platform with configurable waypoints. - `scripts/Suspension.lua`: spring-damper suspension using `SpringConstraint`. ## How to proceed 1. Decide if the object is a rigid mechanism (mechanical constraint) or force-driven (mover constraint). 2. Plan assemblies, root parts, and anchoring strategy. 3. Set network ownership for multiplayer responsiveness. 4. Tune forces/velocities using units and physical properties. 5. Profile with MicroProfiler and watch sleep/ownership visualizations. <!-- catalog:references:start --> ## Reference index - [collisions-and-filtering.md](references/collisions-and-filtering.md): Configure collision groups, touch events, or spatial query filters. - [mechanical-constraints.md](references/mechanical-constraints.md): Connect parts with hinges, springs, ropes, or other mechanical constraints. - [mover-constraints.md](references/mover-constraints.md): Apply forces or velocity targets, or migrate BodyMover code. - [network-ownership.md](references/network-ownership.md): Assign physics simulation to the server or a player and debug ownership. - [units-and-physical-properties.md](references/units-and-physical-properties.md): Tune mass, density, friction, force, or simulation stepping. <!-- catalog:references:end -->
Comments (0)
Sign in to join the conversation.
Reviews (0)
No reviews yet.
No comments yet.