Creating an Arc-Generator

Edit: I solved the issue

The past two days I have been trying to learn how to draw arcs with parts in Roblox Studio.

Part Size = 10x4x10

I have made lots of progress yet there is an issue I can’t seem to fix. If the parts size is not congruent on the x and z axis the arc is not continuous, as can be seen bellow

Part Size = 12x4x10

I am having issues getting the leading face of the next part to face in the same direction as the last. In my attempt to fix this I just rotated the part by -90 radians, but then the issue shown above pops up.

My code:

local Angle = 100
local LastPart = workspace.Part0

for Index = 1, 3, 1 do	
	local NewPart = LastPart:Clone()
	NewPart.Name = "Part" .. Index
	
	local Point = NewPart.CFrame * CFrame.new(NewPart.Size.X / 2, 0, NewPart.Size.Z / 2)
	local Offset = CFrame.new(LastPart.Size.X / 2, 0, LastPart.Size.Z / 2)
	
	NewPart.CFrame = (Point * CFrame.Angles(0, math.rad(Angle), 0) * Offset) * CFrame.Angles(0, math.rad(-90), 0)
	
	NewPart.Parent = workspace
	LastPart = NewPart
end

If you know how to fix the issue I would love your help, thanks.

2 Likes

I would edit the title, I almost missed that you solved it.

Fixed code:

local Angle = 100
local LastPart = workspace.Part0

for Index = 1, 3, 1 do	
	local NewPart = LastPart:Clone()
	NewPart.Name = "Part" .. Index
	
	local Point = NewPart.CFrame * CFrame.new(NewPart.Size.X / 2, 0, NewPart.Size.Z / 2)
	local Offset = CFrame.new(LastPart.Size.X / 2, 0, -LastPart.Size.Z / 2)
	
	NewPart.CFrame = (Point * CFrame.Angles(0, math.rad(Angle - 90), 0) * Offset)
	
	NewPart.Parent = workspace
	LastPart = NewPart
end

The rotation for the new parts for some reason kept rotating perpendicularly to the old part. I saw you mitigated that by rotating the end result by 90 degrees, which seemed to break whenever the part was a square.

Thanks for the response, although I solved the issue early.

Any possible way to create arcs combining two X and Y axes? For example creating a coil? Scriptos’s plugin for arcs allows curvature in only a singular axis at a time and it gets a bit frustrating.

I thought of this a few days ago I think. I can try to create that, I have an idea of how it can be done.

1 Like

I’m working on a new version of the plugin that should suit your needs much better than the current version.

2 Likes

That is amazing! I await with excitement :smile: