I am working on a level editor where you can build with blocks basically. But I am having some troubles with getting the blocks to appear on the hit objects normals.
So currently I only have a raycast that shoots out from the mouse position and gets a hit position. Then I round that hit position to a full or half number. But this sometimes results in the block appearing in the hit object. So I added that it should add the hit.normal to it but that results in the block moving up one space when there is nothing there or simply just floating 1 meter above/next to the hit object.
So here’s my code for the hit position stuff.
hitPos = hit.point + hit.normal; hitPos.x = Mathf.Round(hitPos.x / 1) * 1; hitPos.y = Mathf.Round(hitPos.y / 1) * 1; hitPos.z = Mathf.Round(hitPos.z / 1) * 1;
Any help with this is greatly appreciated! I also need help with this ASAP since I have a tight deadline so the faster the better!
Thanks in advance!