How do I rotate a part like this using a vector? (Gif)

I am trying to replicate this method of rotation:

I have the angle of rotation figured out as seen in this gif:

What I need to figure out now is how to utilize that angle to rotate the part like in the first gif assumably with the camera’s LookVector. Also note that in the second gif the rotation is locked to the X axis.

Thank you very much in advance!

1 Like

Do u meant diagonally rotating the part?

while true do
	script.Parent.CFrame = script.Parent.CFrame * CFrame.fromEulerAnglesXYZ(0.1,0.1,0)
	wait(0.03)
end

This may help?

I don’t know any other way to express what I mean so I’ll just say it like this lol

Imagine a line that starts from your camera’s position that pierces through the center of the part. Now if you were to rotate the part it could only rotate around that line. That’s basically what I’m trying to achieve.

You can use CFrame.fromAxisAngle.

The axis is the camera lookvector as you have observed.

Also make sure to do the rotation before the part CFrame

part.CFrame = CFrame.fromAxisAngle(camera CFrame.LookVector,0.1)*part.CFrame

This will make the rotation relative to the axis of the axis angle CFrame and not the local current part CFrame.

Otherwise just try playing around with it keeping in mind order is important.