I’ve made an equation that will help decide if an item is placed out of bounds. However, you can’t place items in the corners, and around the edges. It will think its out of bounds.
I’ve already written what I thought would work, I might have messed up something but it should be working.
tempitem:SetPrimaryPartCFrame(location)
local extentsCheck
local hitbox = tempitem.PrimaryPart -- hitbox object
local pos = location.p -- placement position
local extents = {}
extents.x = pos - (hitbox.Size / 2)
extents.z = pos + (hitbox.Size / 2)
extents.bx = truebase.Position - (truebase.Size / 2)
extents.bz = truebase.Position + (truebase.Size / 2)
if (extents.x.x < extents.bx.x) or (extents.x.x > (extents.bx.x + truebase.Size.X)) or (extents.z.z > extents.bz.z) or (extents.z.z < (extents.bz.z - truebase.Size.Z)) then
extentsCheck = true -- outside of bounds
end
The orientation of the base is (0,0,0) so its not a problem with rotation. I can’t seem to figure out what the problem is, so if you see it please let me know.