so i have a placement system, and it is using mouse.hit.position, the problem is, when i go onto walls, it has nothing to stop it half clipping through the wall,
for the ceiling it is even worse, because i added the extra half of the object to the object so the whole thing stays above ground.
First recommendation to raycast to the mouse position, like with bullet holes, you then change the CFrame the part based on the normal of the raycast, If it’s still clipping, you might wanna change from where the part pivots, so that you can get that difference to add to the position.
hmm, the mesh i am doing is not complex at all, so i think this might work, i am not great at the math though, heres what i have so far:
if surface.Name == "Top" then
pos = circle.Position + Vector3.new(circle.Size.Y)
--too lazy to do the rest but you get the idea
elseif surface.Name == "Bottom" then
pos = Vector3.new(0,-4,0)
elseif surface.Name == "Front" then
pos = Vector3.new(0,0,-4)
elseif surface.Name == "Back" then
pos = Vector3.new(0,0,4)
elseif surface.Name == "Left" then
pos = Vector3.new(-4,0,0)
elseif surface.Name == "Right" then
pos = Vector3.new(4,0,0)
end
If anything is rotated (not aligned to any particular axis like in minecraft) then I’m afraid it won’t.
The surface is in objectspace and it needs to be transformed into worldspace.
Their offsets are in objectspace and they also need to be transformed into worldspace.
If you’re going to go through the hassle of fixing that, then you should just use raycasts to begin with. It’s much easier to do these kind of things with raycasts; don’t let it intimidate you.