void UpdateDebugInfo() { sbDebug.Length = 0; if (env.playerGameObject != null) { Vector3 pos = env.playerGameObject.transform.position; sbDebug.Append("Player Position: X="); AppendValueDebug(pos.x.ToString("F2")); sbDebug.Append(", Y="); AppendValueDebug(pos.y.ToString("F2")); sbDebug.Append(", Z="); AppendValueDebug(pos.z.ToString("F2")); } VoxelChunk currentChunk = env.GetCurrentChunk(); if (currentChunk != null) { sbDebug.AppendLine(); sbDebug.Append("Current Chunk: X="); AppendValueDebug(currentChunk.position.x); sbDebug.Append(", Y="); AppendValueDebug(currentChunk.position.y); sbDebug.Append(", Z="); AppendValueDebug(currentChunk.position.z); } VoxelChunk hitChunk = env.lastHitInfo.chunk; if (hitChunk != null) { int voxelIndex = env.lastHitInfo.voxelIndex; sbDebug.AppendLine(); sbDebug.Append("Last Chunk Hit: X="); AppendValueDebug(hitChunk.position.x); sbDebug.Append(", Y="); AppendValueDebug(hitChunk.position.y); sbDebug.Append(", Z="); AppendValueDebug(hitChunk.position.z); sbDebug.Append(", AboveTerrain="); AppendValueDebug(hitChunk.isAboveSurface); int px, py, pz; env.GetVoxelChunkCoordinates(voxelIndex, out px, out py, out pz); sbDebug.AppendLine(); sbDebug.Append("Last Voxel Hit: X="); AppendValueDebug(px); sbDebug.Append(", Y="); AppendValueDebug(py); sbDebug.Append(", Z="); AppendValueDebug(pz); sbDebug.Append(", Index="); AppendValueDebug(env.lastHitInfo.voxelIndex); sbDebug.Append(", Light="); AppendValueDebug(env.lastHitInfo.voxel.lightMesh); if (env.lastHitInfo.voxel.typeIndex != 0) { sbDebug.Append(", Type="); AppendValueDebug(env.lastHitInfo.voxel.type.name); sbDebug.AppendLine(); sbDebug.Append(" Voxel Pos: X="); Vector3 v = env.GetVoxelPosition(hitChunk.position, px, py, pz); AppendValueDebug(v.x); sbDebug.Append(", Y="); AppendValueDebug(v.y); sbDebug.Append(", Z="); AppendValueDebug(v.z); } } debugText.text = sbDebug.ToString(); }