Currently I’m making a furniture placement system where on key pressed a clone of the model is created and follows the mouse position.
However the problem is the model seems to clip into parts pictured below.
I had initially played with the idea of adding the floors y size to the tables CFrame but that only raises the part by one stud, not to mention it wouldn’t work if the floor was very thick.
CreatedFurniture = true
if CreatedFurniture then
for i, v in pairs(Table:GetChildren()) do -- Table is the furniture model
if v.Name ~= "GridPart" then -- Gridpart is the primary part
v.Transparency = 0
SnapFurniture() -- "Snaps" furniture to grid
mouse.TargetFilter = Table
local floor = mouse.Target
Table:SetPrimaryPartCFrame(CFrame.new(Vector3.new(posX, posY, posZ))) -- Pos values from SnapFurniture function
raycast down from each table leg to get the height of the table. Also do a raycast from each corner to the center to see if’s intersecting anything or do #hitbox:GetTouchingParts()>ThatAmountOfPartsThatWouldNormallyBeInTheHitBox
You’ll need to find the height of the model. Usually what I do is have a transparent part that covers the entire model and acts as its collision box, and then you can find the height by simply finding the Y component of this parts size. Then, you just add half of this height to the Y component of your CFrame. That would be done in this part: