You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? I want to make so that my building system works like build a boat and so that I can position blocks relative to one another and also allow me to build upwards
-
What is the issue? The issue is that idk how I should make it so that I can build on they Y axis
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
No solutions because I have no ideas.
Yes, I have but I couldn’t find a system tat’s similar to my system.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
This is the code that generates the positions (the one that generates parts is just for visualization)
for x = coords.minX, coords.maxX, gridsize do
for z = coords.minZ, coords.maxZ, gridsize do
position = Vector3.new(x,coords.maxY,z)
table.insert(points, position)
end
end
for i, pos in pairs(points) do
position = Vector3.new(pos.X+gridsize/2,pos.Y,pos.Z+gridsize/2)
table.insert(centers,position)
end
local newcenters = {}
for i, pos in pairs(centers) do
if pos.X > coords["maxX"] or pos.X < coords.minX or pos.Z > coords.maxZ or pos.Z < coords.minZ then
continue
else
table.insert(newcenters,pos)
end
end
This is the code that compares the position of the cast to the position table (btw I used furniturepiece because I was working on a furniture placing system, but now I think a system like this would be better)
for i, pos in pairs(centers) do
if not closest then
closest = pos
elseif (cast.Position - pos).Magnitude < (cast.Position - closest).Magnitude then
closest = pos
end
end
furniturepiece.Position = Vector3.new(closest.X,closest.Y+furniturepiece.Size.Y/2,closest.Z)
This is my current building system (I actually haven’t started on the actual placing but right now I don’t know how to build upwards and put blocks on the side of others)
This system compares a cast of your mouse to each of these red parts (not the actual red parts but a table of positions) and then places the block on the closest point.
Should I use another placing mechanic or can I continue using this method?
Thanks for anything!