Hello, I recently faced such a task.
I need to make the rotation of the parts around the center in “3D”, that is, so that each part has its own axis, and it turns around it without colliding with the positions of other parts.
An example of how I created “2D” rotations is in the screenshot
(c = counter, Center = Central position)
I’m not the best with math, but I would usually use CFrames to get my way out of tasks like this.
If you created a CFrame using CFrame.Angles, you could plug in radian values to easily change the direction the CFrame faces. From there, you can take the LookVector of the CFrame and apply that as the position.
I would set a random X and Z value to create the unique axis and then lerp the Y value so the CFrame rotates around its axis, constantly getting the LookVector and plugging it into the part position.
local point = CFrame.new(0,0,0)
local part = -- part you want to rotate
local offset = CFrame.new(0,0,10) -- offset for the part
local inc = 1 -- how much to rotate
while task.wait() do
part.CFrame = point*CFrame.angles(0,math.rad(inc),0)*offset
end
Yeah and you can still use it fine, I just mean you can use the orientation part of a CFrame to create the axis and then get the LookVector of the frame to give you an offset position. From there you can use your existing CFrame. @Qinrir shows it off fairly well.
Instead of getting an extremely accurate version of a vector3 value with trigonometry, you can just orient the part so it’s on the axis you want it to rotate around. Then all you would need to do is get the look vector of the CFrame. You can also multiply it by a vector offset, but for me, LookVectors are more straightforward.