# Roblox Rotate Part

Posted on

Roblox Part object means the physical object, when it is in the workspace, this one will move and interact with the other Parts. This thing is able to have bonds formed with the other Parts, so that the two Parts stay in the same relative position.

Apparently, all the Parts are the basic building blocks of any Roblox place. Usually called as bricks, you will be able to see those the most often of any other objects as almost each place is built out of those. It is said that it is possible to stretch the Par to very large sixes and use them for baseplates, or make them very small and use them to create the cool looking tool.

How can you rotate Part? There are some methods. If you want to rotate the part toward another part, you are able to use the second CFrame argument to rotate in that direction.

1. local part = Instance.new(‘Part’)

2. part.Parent = Workspace

3. part.Anchored = true

4. part.CFrame = CFrame.new(Vector3.new(0, 0, 0), Workspace.pointAtPart.Position)

Basically, you are setting part.CFrame to the new CFrame that is at the position of (0, 0, 0), and is rotated at the part pointAtPart. You can use the pointAtPart.Position. the main reason behind it is because you want to point at the Vector3 value that is returned by the Position property or CFrame.p.

If you want to rotate the part in degrees. You can use the CFrame.Angles function and multiply it by the CFrame position using the math.rad function to convert degrees to radians.

1. local part = Instance.new(‘Part’)

2. part.Parent = Workspace

3. part.Anchored = true

4. part.CFrame = part.CFrame * CFrame.Angles(0, math.rad(5), 0)

You set the part.CFrame to the same position part.CFrame and multiply it by CFrame.Angles but with the math.rad(5) as the Y-axis rotation. Then, the math.rad function will convert degrees to radians. In this case, you are converting 5 degrees to radians and passing it to CFrame.Angles. the other times you might see CFrame.fromEulerAnglesXYZ. The function that you have been using CFrame.Angles is just the shortcut function for CFrame.fromEulerAnglesXYZ. Do not use the old name as it is too long, but if you see it in code, you will no longer be confused.

If you want to rotate the part using Vector3, you can use the BodyAngularVelocity object. In fact, the BodyAngularVelocity object uses its AngularVelocity property to determine the speed and the rotation. For this time, instead of using the maxForce property, you use the maxTorque that is rotational power. Please take a note that there is the possibility the object will be phased out. This one is currently not marked as deprecated. You can use it with caution.

For more information about the method of how to rotate part, you can visit the official website of Roblox Developer. If you have the hard time, do not hesitate to contact the representative of Roblox through Roblox Support. You can also seek a help from the members of the Roblox community.