When using Geometry Shaders option, the generated mesh for the chunks' MeshFilter component has a POINT topology. This means that you cannot get the triangles from the MeshFilter mesh property as they are generated in the shader itself.
However you can get the triangles from the collider.sharedMesh as Voxel Play does generate a normal mesh for collider purposes
Sample code:
if (env.RayCast (ray, out hit, 500f, 15)) {
Voxel voxel = env.GetVoxel (hit.voxelCenter);
Debug.Log ("There's a voxel at " + hit.point.ToString("F6") + " of type " + voxel.type.name);
Debug.Log ("Chunk triangles: " + hit.chunk.mc.sharedMesh.triangles.Length);
}
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article