Hello i am creating a grid, based on the parent part…
My parts spawn on top of the main part but now i cant get it to account for rotation…
this is original
this is oritented…
function CreateGrid()
local gridSizeX = math.ceil(v.Size.X / nodeDiameter)
local gridSizeZ = math.ceil(v.Size.Z / nodeDiameter)
part.Size = Vector3.new(nodeDiameter, part.Size.Y, nodeDiameter)
local bottomLeft = Vector3.new(v.Position.X-(v.Size.X/2), v.Position.Y, (v.Position.Z-(v.Size.Z/2)))
for x = 1,gridSizeX, 1 do
Grid[x] = {}
for z = 1, gridSizeZ, 1 do
local WorldPoint = bottomLeft + Vector3.new(1,0,0) * (x * nodeDiameter + nodeRadius) + Vector3.new(0,0,1) * (z * nodeDiameter + nodeRadius) - part.Size
local min = WorldPoint - (((nodeDiameter + nodeRadius)) * part.Size)
local max = WorldPoint + (((nodeDiameter + nodeRadius)) * part.Size)
local mypart = part:Clone()
mypart.Position = Vector3.new(WorldPoint.X, v.Position.Y + 5, WorldPoint.Z)
mypart.Parent = workspace
end
end
end
Was wondering if someone could give me some small support.
Seems i am using the larger box for the filling of position…
What you want to do is use CFrame instead of Position to orient the grid parts. This accounts for rotation instead of just positions based off of the part’s size.
I kind of undertand what CFrames are and how to use them just a little bit.
I read that up tbh, I’ve had some experience with CFrames, clearly not enough to apply it to what i need here. Appreciate the attention, I feel the parts beign created for the grid is using the outer box of the bounds to calculate its position, im not sure how to use that to apply cframe math