Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

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

Asked by 6 years ago

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

Log in to vote
1
Answered by
Goulstem 8144 Badge of Merit Moderation Voter Administrator Community Moderator
6 years ago
Edited 6 years ago
  • 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)
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. Bellyrium 310 — 6y
0
Oh I didn't even see the picture Goulstem 8144 — 6y
0
xDDDDDDDdd ^^ greatneil80 2647 — 6y
Ad

Answer this question