My player can place objects by clicking on surfaces. I have added an offset for when this is done to floors:
new Vector3(hit.point.x, hit.point.y + (hitObject.GetComponent<Renderer>().bounds.size.y / 2), hit.point.z)
However, this only works on flat floors. Walls and other surfaces are a problem. Even cube objects tend to clip and fall through when this is done with walls or some slopes. They can also stick in ceilings.
I don’t want to write special code for ceilings and walls, so is there a way to always determine which direction I need to offset an object by - just by knowing its bounds and the surface clicked?