Help with rotation on my placement system

I’m creating a placement system but I do not know how to add rotation for wall objects, basically, the rotation that player can add with “R” just makes the model go inside the wall object

Using this I got something decent but doesn’t work on rotated parts

    local relativeVector = target.CFrame:VectorToObjectSpace(normal)
    relativeVector = model.PrimaryPart.CFrame:VectorToObjectSpace(relativeVector)

This is far I got

I use this to calculate the size

local function getModelSize()
    local primary = model.PrimaryPart:Clone()
    primary.Name = "fake_primarypart"
    primary.Transparency = 1
    primary.Parent = model

    local primaryPartCFrame = model:GetPrimaryPartCFrame()
    primary.CFrame =
    local _, size = model:GetBoundingBox()
    --size = model.PrimaryPart.CFrame:VectorToObjectSpace(size)
    return size

If you need more info just ask in the replies section.

1 Like

Perhaps you need to add a collision detector to check if the rotation you are attempting causes a hit and if there is one don’t do the that rotation.