Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Create another part on the side of an existing part even if rotated?

I'm trying to automatically generate paths for my roads however on curves the parts created clip with the road.

local paths = Instance.new("Model",game.Workspace)
paths.Name = "paths"

for i,v in pairs (game.Workspace.roads:getChildren()) do
	local oldCFrame = v.CFrame
	local oldSize = v.Size
	local vClone = v:Clone()
	vClone.Size = Vector3.new(oldSize.x,oldSize.y,10)
	vClone.CFrame = oldCFrame + Vector3.new(31,0,0)
	vClone.Parent = paths
end

Here's an image of the issue http://prntscr.com/fq4jgo

1 answer

  • CFrame_1 * CFrame_2

CFrame_2 is offsetted in relative object space by CFrame_1.

  • CFrame_1 + Vector_1

CFrame_1 is translated in world space by Vector_1


Use the CFrame * CFrame constructor for relative positioning - matching oldCFrame's orientation.

 vClone.CFrame = oldCFrame * CFrame.new(31,0,0)

3 comments

1

In that picture though, it seems more like he wanted angles at the ends. In that case, he will need to but some trigonometry to use.

0

Oh I didn't even see the picture

0

xDDDDDDDdd ^^

This discussion is preserved as it was. New answers, comments, and votes are closed.