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

Rotating Parts with Vector3 Values

Rotating Parts with Vector3 Values

Jun 14 2019, 4:47 PM 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
  • script
  • coding