This is kind of hard to explain, so I will do my best to explain this issue. If you guys want me to elaborate more on the issue I will be happy to reply.
I have recently been working on a building system that involves the rotation and placing of builds. It works great! But there’s 1 problem I’m trying to fix.
My initial problem is that the buildings would phase inside of each other, instead of actually offsetting to make building easier.
I (kind of not really) fixed it with these lines of code
if Mouse.TargetSurface == Enum.NormalId.Right then
BuildPreview:SetPrimaryPartCFrame(BuildPreview.PrimaryPart.CFrame * CFrame.new(BuildPreview.BoundingBox.Size.X/2,0,0))
end
if Mouse.TargetSurface == Enum.NormalId.Left then
BuildPreview:SetPrimaryPartCFrame(BuildPreview.PrimaryPart.CFrame * CFrame.new((BuildPreview.BoundingBox.Size.X/2) * -1,0,0))
end
if Mouse.TargetSurface == Enum.NormalId.Front then
BuildPreview:SetPrimaryPartCFrame(BuildPreview.PrimaryPart.CFrame * CFrame.new(0,0,(BuildPreview.BoundingBox.Size.Z/2) * -1))
end
if Mouse.TargetSurface == Enum.NormalId.Back then
BuildPreview:SetPrimaryPartCFrame(BuildPreview.PrimaryPart.CFrame * CFrame.new(0,0,BuildPreview.BoundingBox.Size.Z/2))
end
This makes it to where the builds actually do offset instead of phasing inside of each other. But it doesn’t work when I rotate the part.
Problem:
To restate, I want to make it offset no matter what the rotation is. But in my case it just simply does not work.
I’m gonna be honest, I’m not that great at math at all, but does anyone know any way I could fix this issue?