How to rotate a part around a point while retaining the orientation of the part?

Recently, I’ve been trying to rotate a part around a single point. Roblox has made it easy to do so using the code: Object.CFrame = Point * Rotation * Offset.

I’ve managed to get the part rotating around the point but I’ve also noticed that the part’s orientation turns towards the point (The same face of the part will always look at the point). Is there any way that I would the above?

Here’s a visual representation of what I would like to do:


Image 1: Direction of part rotation.


Image 2: Using Roblox’s built-in CFrame system, the part face always looks at the other part when turning as depicted by the red arrow. The blue part’s orientation seems to be relative to the point.


Image 3: Intended Rotation. Part remains in the same Orientation axis in global space as depicted by red arrow facing northeast.

Does anyone have the solution to this problem?

10 Likes

I would just get the Position from the CFrame created.

Object.Position= (Point * Rotation * Offset).p

23 Likes

Thanks for the answer. I’ve used the concept that you have suggested and made it such that the script uses CFrame to move the part instead.

Here’s what I did:

local rotation = Part.CFrame - Part.CFrame.p --This is a way of giving you the CFrame.Angles of the part since Orientation cannot directly be put with CFrame.Angles.
position = (Point * Rotation * Offset).p -- Let the game calculate out the rotation about the point and just get position of part.
Part.CFrame  = CFrame.new(position) * rotation -- Fit the part's CFrame together with constant rotation.

Basically, @kingdom5’s concept was to let the game calculate out the path of the part as it moves around the point, then just take its position and keep the part’s orientation as a constant. What I did above was the same but using CFrame.

Once again, thank you @kingdom5 for solving this.

22 Likes

I use this a lot lol It is very usefull when using CFrames.

local rotation = Part.CFrame - Part.CFrame.p

Glad I could help.

8 Likes