Hi there! I’m here again with another doubt as to if we were talking about Region3, I want to create a cube out of two positions, so I just give Point A and Point B to make a cube out of those, I know how to put the cube between the two points but not how to change its size properly.
Did you not make it so that the cube calculations auto scale based on any two points? Instead of hard coding the cube, why not make it completely based on the two points no matter their values?
So how are you doing it currently - or what’s your idea on how to do this at the moment?
I did that exactly, the whole problem was that I just was taking the difference between the two points no matter what, and of course, I got a plane, cause I just forgot to determine which value was the min and which one was the max so I just used math.min and math.max to determine it, and now it works pretty well!
local x0 = math.min(pointA.X,pointB.X)
local y0 = math.min(pointA.Y,pointB.Y)
local z0 = math.min(pointA.Z,pointB.Z)
local min = Vector3.new(x0,y0,z0)
local x1 = math.max(pointA.X,pointB.X)
local y1 = math.max(pointA.Y,pointB.Y)
local z1 = math.max(pointA.Z,pointB.Z)
local max = Vector3.new(x1,y1,z1)
local draw = Instance.new("Part")
draw.Size = max - min
1 Like
