Does CFrame have a formula?

Hello there, fellow developers. I’d want to know whether there is a formula to utilize in this screenshot.
image
I’d want to do that, but I’m not sure how to rotate their orientation, when I summon similar into that, their orientation is always the same, and I’ve tried angles, but it’s not working. I’m hoping you people will help me out and appreciate my illogical stuff.

1 Like

What do you want the final product to look like? I don’t really get what you mean sorry :sweat: I’m not the best with math and Cframe but I’ll try to help
Edit: Oh I see now

Thank you for the correction, for more information, I’m working on something similar to the screenshot above, when I summon my creation, it looks like this. image
I add angles to orientation, but I think I’m following the wrong “formula” if there is one for solving my problem.

Instead of using angles and other stuff have you tried CFrame:ToWorldSpace?

1 Like

I never tried using them. :slightly_frowning_face:

1 Like

Try it, I think it will help you on the right path. You can read more on it here or here
Good Luck

3 Likes

If you want to get another part’s relative CFrame, use CFrame:ToObjectSpace(cf) with the first cframe being your torus and cf being the other part.

1 Like

If you wan’t them to all face outwards/inwards you can use CFrame.lookAt and CFrame.Angles

CFrame.lookAt(part.Position, startPosition) * CFrame.Angles(0, math.rad(45), 0)

startPosition is the middle basically

1 Like

I think this is more easier than, CFrame:ToWorldSpace Thank you very much!

Oh yes!, I am also looking for this thank you so much for the help!

Do you want to code this in? You could just premake it yourself, put it in ServerStorage, clone it, and put it in the workspace, and modify it when you need it. Looks like they’re using the new Pivot Points system. You can customise parts pivot points, the point at which they rotate at. A really useful tool for building. Not sure if there’s a way to code pivot points in, haven’t checked.

:open_mouth:, Alsoo I wanna code it in, I don’t want to clone them as I want to learn more about scripting to CFrame, Also can you give me a link for me to read this “Pivot Points”. This caught my attention.

Article: Pivot Points - Studio Beta Update: Handle Summoning

Now as for coding this in, I think this would most likely work would :ToObjectSpace, orientation relative to the local part rather than the worlds position. I think I have an idea but I’d rather confirm it that give false information.

You could read up about CFrame and find out if there’s a specific method that could help.

CFrame Article: CFrames | Roblox Creator Documentation

1 Like

There’s no example for :ToObjectSpace but I will try this method rather not being stuck for too long and not doing anything about what I wanna achieve.

1 Like
-- original part model
local BASE_PART = Instance.new("Part")
BASE_PART.Anchored = true
-- origin of the ring
local ORIGIN = CFrame.new(15, 0, 30)
-- radius of ring
local RADIUS = 8
-- number of ring segments
local SEGMENTS = 8

for i = 0, SEGMENTS - 1 do
	local part = BASE_PART:Clone()
	local theta = math.pi * 2 / SEGMENTS * i
    local offset = Vector3.new(math.cos(theta), 0, math.sin(theta)) * RADIUS
    local cf = CFrame.lookAt(offset, Vector3.new())
	part.CFrame = ORIGIN:ToWorldSpace(cf)
	part.Parent = workspace
end

image

this gets 8 points around the origin with the proper radius, creates a new CFrame at the location looking at the origin, at finally converts it to world space which moves it to face towards the proper location at the proper angle

(edited to work with WorldSpace)

1 Like

Thank you for the help, I manage to made them!

1 Like