2 min read

Source: Roblox Creator Hub · CC BY 4.0 · View source · Code samples: MIT Imported 2026-10-03. Formatting adapted for this site.

LineForce

Note

For an overview on creating, visualizing, and simulating mover constraints, including LineForce, see mover constraints. Also see Roblox units to understand how Roblox units compare to metric units.

The LineForce constraint applies force along the theoretical line connecting its two Attachments. As the end points (attachments) move, the direction of force will change accordingly.

Force location

By default, force is applied to either parent at its attachment location. If desired, force can be focused at each parent's center of mass by toggling on ApplyAtCenterOfMass.

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-ApplyAtCenterOfMass-False.mp4" alt="Video showing ApplyAtCenterOfMass set to false"></video>

ApplyAtCenterOfMass = false

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-ApplyAtCenterOfMass-True.mp4" alt="Video showing ApplyAtCenterOfMass set to true"></video>

ApplyAtCenterOfMass = true

Inverse square law

When InverseSquareLaw is true, the force magnitude is multiplied by the inverse square of the distance, meaning the force will increase exponentially as the two attachments get closer together, like magnets. When using this setting, it's recommended that you set a MaxForce threshold to prevent infinite force if the attachments align precisely.

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-InverseSquareLaw-False.mp4" alt="Video showing InverseSquareLaw set to false"></video>

InverseSquareLaw = false

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-InverseSquareLaw-True.mp4" alt="Video showing InverseSquareLaw set to true"></video>

InverseSquareLaw = true

Reactionary force

By default, the constraint only applies force to Attachment0, while Attachment1 remains unaffected. However, force can be applied to both attachments in equal and opposite directions by enabling ReactionForceEnabled.

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-ReactionForceEnabled-False.mp4" alt="Video showing ReactionForceEnabled set to false"></video>

ReactionForceEnabled = false

<video controls src="https://prod.docsiteassets.roblox.com/assets/physics/constraints/LineForce-ReactionForceEnabled-True.mp4" alt="Video showing ReactionForceEnabled set to true"></video>

ReactionForceEnabled = true