PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience

Rotate a Part using Vector3

Rotate a Part using Vector3

Jun 23 2018, 10:25 AM PST

Problem

You want to get a part to rotate in a direction.

Solution

Use the BodyAngularVelocity object.

local b = Instance.new('BodyAngularVelocity')
b.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
b.angularvelocity = Vector3.new(0, 10, 0)
b.Parent = Workspace.Part

Discussion

The BodyAngularVelocity object uses its AngularVelocity property to determine speed and rotation. This time instead of using the maxForce property, we used maxTorque which is rotational power.

There is a possibility this object will be phased out. It is currently not marked as deprecated. Use with caution.
Tags:
  • movement
  • vector3