Rotating a part around a vector

My goal is to rotate a part around a vector as visualized in red in the image below. The transparent part shows it’s initial orientation, and the part on the left is the result I’d like to achieve, while the part on the right is the current result.

As you can see, instead of rotating around,0,0), it rotated around part.CFrame.RightVector. How do I fix this?


My code:

local part = script.Parent

local angle = math.rad(45)
local axis =,0,0)
part.CFrame *= CFrame.fromAxisAngle(axis,angle)
1 Like

part.CFrame = CFrame.fromAxisAngle(axis,angle)*part.CFrame
part.Position = pos

This fixed it, not sure how.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.