VectorForce

VectorForce : Constraint

Overview

A physics constraint instance used to apply continuous force and acceleration to an Object.

As this constraint causes acceleration to accumulate continuously, Objects can move extremely fast without opposing forces. Therefore, LinearVelocity constraint is preferred for maintaining constant velocity.

The reference for applying force depends on whether the RelativeTo property is set to World or Attachment.

Properties

Force

Vector3

Sets the magnitude and direction of the force.

Code Samples

local Part = script.Parent
local Attachment = Part.Attachment

local VectorForce = Instance.new("VectorForce")
VectorForce.Attachment0 = Attachment
VectorForce.RelativeTo = Enum.ActuatorRelativeTo.World 
VectorForce.Force = Vector3.new(500000, 0, 0) 
VectorForce.Parent = Part

RelativeTo

Enum.ActuatorRelativeTo

Sets the reference coordinate system for applying force.

Code Samples

local VectorForce = script.Parent

VectorForce.RelativeTo = Enum.ActuatorRelativeTo.World

ApplyAtCenterOfMass

bool

Sets where the force is applied.

When disabled, the force is applied to the Object's center (center of mass). When enabled, the force is applied at Attachment0's position, which may cause rotation if not at the center.

Code Samples

Methods

Events

See also

Physics

Last updated