Reference API Roblox

Engine API

Website

Related

Reference API Roblox

LinearVelocity

Applies force on an assembly to maintain a constant linear velocity.

Member index 14

HistoryMember
731ForceLimitMode: ForceLimitMode
731ForceLimitsEnabled: bool
731LineDirection: Vector3
731LineVelocity: float
731MaxAxesForce: Vector3
731MaxForce: float
731MaxPlanarAxesForce: Vector2
731PlaneVelocity: Vector2
731PrimaryTangentAxis: Vector3
731ReactionForceEnabled: bool
731RelativeTo: ActuatorRelativeTo
731SecondaryTangentAxis: Vector3
731VectorVelocity: Vector3
731VelocityConstraintMode: VelocityConstraintMode
inherited from Constraint
731Active: bool
731Attachment0: Attachment
731Attachment1: Attachment
731Color: BrickColor
731Enabled: bool
731Visible: bool
604GetDebugAppliedForce(bodyId: int): Vector3
604GetDebugAppliedTorque(bodyId: int): Vector3
inherited from Instance
731Archivable: bool
731Capabilities: SecurityCapabilities
731IsInSandbox: bool
731Name: string
731Parent: Instance
731PredictionMode: PredictionMode
731Sandboxed: bool
731UniqueId: UniqueId
576AddTag(tag: string): null
573ClearAllChildren(): null
462Clone(): Instance
573Destroy(): null
486FindFirstAncestor(name: string): Instance
486FindFirstAncestorOfClass(className: string): Instance
486FindFirstAncestorWhichIsA(className: string): Instance
486FindFirstChild(name: string, recursive: bool = false): Instance
486FindFirstChildOfClass(className: string): Instance
486FindFirstChildWhichIsA(className: string, recursive: bool = false): Instance
486FindFirstDescendant(name: string): Instance
563GetActor(): Actor
486GetAttribute(attribute: string): Variant
462GetAttributeChangedSignal(attribute: string): RBXScriptSignal
631GetAttributes(): Dictionary
648GetChildren(): Instances
462GetDebugId(scopeLength: int = 4): string
707GetDescendants(): Instances
486GetFullName(): string
706GetStyled(name: string, selector: string?): Variant
657GetStyledPropertyChangedSignal(property: string): RBXScriptSignal
576GetTags(): Array
576HasTag(tag: string): bool
486IsAncestorOf(descendant: Instance): bool
486IsDescendantOf(ancestor: Instance): bool
664IsPropertyModified(property: string): bool
698QueryDescendants(selector: string): Instances
573Remove(): null
576RemoveTag(tag: string): null
664ResetPropertyToDefault(property: string): null
573SetAttribute(attribute: string, value: Variant): null
462WaitForChild(childName: string, timeOut: double): Instance
731children(): Instances
731clone(): Instance
731destroy(): null
731findFirstChild(name: string, recursive: bool = false): Instance
731getChildren(): Instances
731isDescendantOf(ancestor: Instance): bool
731remove(): null
462AncestryChanged(child: Instance, parent: Instance)
462AttributeChanged(attribute: string)
462ChildAdded(child: Instance)
462ChildRemoved(child: Instance)
462DescendantAdded(descendant: Instance)
462DescendantRemoving(descendant: Instance)
500Destroying()
657StyledPropertiesChanged()
731childAdded(child: Instance)
inherited from Object
731ClassName: string
731className: string
647GetPropertyChangedSignal(property: string): RBXScriptSignal
647IsA(className: string): bool
731isA(className: string): bool
647Changed(property: string)

Description

The LinearVelocity constraint applies force on an assembly to maintain a constant linear velocity. It can be set to apply force along a Vector3, line, or 2D plane. Alternatively:

  • If you want to control the amount of force applied, use a VectorForce constraint.
  • If you only need initial linear velocity, set the AssemblyLinearVelocity property directly on the assembly.

When configuring this constraint, it may be helpful to study Roblox Units to understand how Roblox units compare to metric units.

Relativity

Application of velocity can be controlled through the constraint's RelativeTo property. If set to World, force will be applied in world coordinates, independent of the parent or attachment orientations. If set to Attachment0 or Attachment1, force will be applied relative to Attachment0 or Attachment1 respectively.

History 53

Members 14

ForceLimitMode

TypeDefault
ForceLimitModeMagnitude

Determines how the constraint force will be limited. When set to Magnitude, the constraint force will have a magnitude less than MaxForce. When set to PerAxis, the force along each axis will be less than the corresponding value in MaxAxesForce when VelocityConstraintMode is Vector or the corresponding value in MaxPlanarAxesForce when VelocityConstraintMode is Plane. Only used when ForceLimitsEnabled is true.

History 3

ForceLimitsEnabled

TypeDefault
booltrue

Determines if the constraint force will be limited or if the physics solver can apply an unlimited force to achieve the target velocity. When enabled, the constraint force is limited based on ForceLimitMode. When disabled, the physics solver will always apply a force that is large enough to achieve the target velocity.

History 3

LineDirection

TypeDefault
Vector31, 0, 0

The normalized Vector3 direction for constraining the velocity along a line, when VelocityConstraintMode is set to Line.

History 4

LineVelocity

TypeDefault
float-0

Float value of the velocity when VelocityConstraintMode is set to Line.

History 4

MaxAxesForce

TypeDefault
Vector31000, 1000, 1000

Maximum force along each axis that the constraint can apply to achieve the target velocity. Only used if ForceLimitsEnabled is true, ForceLimitMode is PerAxis, and VelocityConstraintMode is Vector. The axes used to apply the limit correspond to the RelativeTo property.

History 3

MaxForce

TypeDefault
float1000

Maximum magnitude of the force vector the constraint can apply. Only used if ForceLimitsEnabled is true and ForceLimitMode is Magnitude.

History 4

MaxPlanarAxesForce

TypeDefault
Vector21000, 1000

Maximum force along each axis that the constraint can apply to achieve the plane velocity. Only used if ForceLimitsEnabled is true, ForceLimitMode is PerAxis, and VelocityConstraintMode is Plane. The axes used to apply the limit correspond to the RelativeTo property.

History 3

PlaneVelocity

TypeDefault
Vector20, 0

Vector2 value of the velocity in each tangent direction of the plane, when VelocityConstraintMode is set to Plane.

History 4

PrimaryTangentAxis

TypeDefault
Vector31, 0, 0

The primary axis in the plane, when VelocityConstraintMode is set to Plane. Value depends on the value of RelativeTo as follows:

History 4

ReactionForceEnabled

TypeDefault
booltrue

Determines whether the constraint applies an equal and opposite reaction force to the assembly of Attachment1. Defaults to true. This reaction force is relevant when RelativeTo is ActuatorRelativeTo.Attachment1 — the mode in which the constraint drives the Attachment0 assembly's velocity relative to the Attachment1 assembly. Because RelativeTo defaults to ActuatorRelativeTo.World, this property is typically only meaningful once RelativeTo is set to Attachment1.

When enabled in that mode, the constraint applies the reaction force to the Attachment1 assembly, coupling the two assemblies. When disabled, the constraint applies force only to the Attachment0 assembly; the Attachment1 assembly receives no reaction force, though its pose and velocity are still read as the reference frame for the target velocity.

History 3

RelativeTo

TypeDefault
ActuatorRelativeToWorld

Sets the ActuatorRelativeTo property for the constraint.

History 4

SecondaryTangentAxis

TypeDefault
Vector30, 1, 0

The secondary axis in the plane, when VelocityConstraintMode is set to Plane. Value depends on the value of RelativeTo as follows:

History 4

VectorVelocity

TypeDefault
Vector30, 0, 0

Vector3 velocity value when VelocityConstraintMode is set to Vector.

History 4

VelocityConstraintMode

TypeDefault
VelocityConstraintModeVector

The mode of the constraint: Line, Plane, or Vector. Default is Vector.

History 4

Settings