LinearVelocity
LinearVelocity : Constraint
Overview
A physics constraint instance used to move an Object at a constant linear velocity.
The reference for applying force depends on whether the RelativeTo property is set to World or Attachment.
Properties
ForceLimitsEnabled
bool
Determines whether the force is limited.
When enabled, the force is capped by MaxForce; when disabled, the physics engine can freely apply unlimited force to achieve the target velocity.
Code Samples
local LinearVelocity = script.Parent
LinearVelocity.ForceLimitsEnabled = false
LineDirection
Vector3
When VelocityConstraintMode is Line, restricts velocity to a linear direction.
Code Samples
LineVelocity
number
When VelocityConstraintMode is Line, sets the velocity in the linear movement direction.
Code Samples
local LinearVelocity = script.Parent
LinearVelocity.LineDirection = Vector3.new(-1, 0, 0)
MaxAxesForce
Vector3
Currently not supported.
Code Samples
MaxForce
number
When ForceLimitsEnabled is true, sets the maximum force magnitude that can be applied.
Code Samples
local LinearVelocity = script.Parent
LinearVelocity.MaxForce = 10
PlaneVelocity
Vector2
When VelocityConstraintMode is Plane, sets the velocity for the two directions (X, Y) on the plane.
Code Samples
RelativeTo
Enum.ActuatorRelativeTo
Sets the reference coordinate system for applying force.
Code Samples
local LinearVelocity = script.Parent
LinearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
PrimaryTangentAxis
Vector3
Currently not supported.
Code Samples
SecondaryTangentAxis
Vector3
Currently not supported.
Code Samples
VectorVelocity
Vector3
When VelocityConstraintMode is Vector, sets the velocity in the direction of the Vector.
Code Samples
local Part = script.Parent
local Attachment = Part.Attachment
local LinearVelocity = Instance.new("LinearVelocity")
LinearVelocity.Attachment0 = Attachment
LinearVelocity.RelativeTo = Enum.ActuatorRelativeTo.World
LinearVelocity.VectorVelocity = Vector3.new(1000, 0, 0)
LinearVelocity.MaxForce = 10
LinearVelocity.Parent = Part
VelocityConstraintMode
Enum.VelocityConstranumberMode
Sets how velocity is restricted.
Line: Linear movement.
Plane: Movement within a specified plane.
Vector: Movement in vector3 direction (default).
Code Samples
Methods
Events
See also
PhysicsLast updated