Cast a ray from the camera into the voxel world to find which block the player is looking at.
Maximum ray distance in blocks (default 7)
Raycast result with hit status, block position, adjacent position, and block type
const ray = sg.voxelRaycast();if (ray.hit) { sg.setBlock(ray.x, ray.y, ray.z, sg.BLOCKS.AIR); } Copy
const ray = sg.voxelRaycast();if (ray.hit) { sg.setBlock(ray.x, ray.y, ray.z, sg.BLOCKS.AIR); }
Cast a ray from the camera into the voxel world to find which block the player is looking at.