I am currently using
Terrain:ReadVoxel() to get the voxels around the player, I then detect the voxels using the material. The only issue i’m having is getting the position of the detected voxel in worldspace.
Current Code for detecting voxels:
local region = Region3.new(C1, C2) -- C1 and C2 are worldspace vectors local materials, voxels = Terrain:ReadVoxels(region, 4) local size = voxels.Size -- Looping through the voxels for x = 1, size.X, 1 do for y = 1, size.Y, 1 do for z = 1, size.Z, 1 do local material, voxel = materials[x][y][z], voxels[x][y][z] if material == Enum.Material.Water then print("Found Voxel") -- Issue: How do I get the position of the voxel return true end end end end
Currently the only things i know is that
material would be the C1 position, i’m just struggling with using that information to convert them all. Any help is greatly appreciated!