Rotating a part relative to a Vector

Hello, I know that an answer to this question is probably on the dev forum already, but I can’t seem to find it. How would I define an axis to rotate a part around? Say I had a line in 3D space, how would I rotate a part relative to that line?

1 Like

can you give a better explanation of what you are doing.

edit: do you mean the direction?

Are you referring to a part rotating around another part (I assume the Vector would just be the other part’s position)?

I assume this would be a door hinge. Can you clarify this?

A door hinge is the perfect analogy. Right now I’m trying to have a plane rotate about an axis.

You could have a model (i.e. a door) with the PrimaryPart set to the hinge. You can then weld the other parts of the door to the hinge, then when you rotate the hinge the main door should rotate.

Well, the movement is going to be similar to a door hinge, but I’m not actually making a door. If I could achieve a similar effect without actually creating the hinge, that would be perfect.

1 Like

You can use the CFrame.fromAxisAngle() constructor. It does exactly what you want.


part.CFrame * CFrame.fromAxisAngle(Vector3 axis, rotation in radians)

Edit: It’s fromAxisAngle()