Method WorldToVoxelIndexInclusive
| Edit this page View SourceWorldToVoxelIndexInclusive(Vector3, Vector3)
Converts world position to voxel grid index for bounding box maximum coordinates. Use for inclusive bounds.
Declaration
public static (int x, int y, int z) WorldToVoxelIndexInclusive(Vector3 worldPosition, Vector3 voxelSize)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | worldPosition | The world position to convert (typically a bounding box maximum) |
| Vector3 | voxelSize | The size of each voxel in world units |
Returns
| Type | Description |
|---|---|
| (int x, int y, int z) | The (x, y, z) grid indices of the voxel containing the position |
WorldToVoxelIndexInclusive(Vector3, Vector3, Vector3)
Converts world position to voxel grid index for bounding box maximum coordinates with custom grid origin. Use for inclusive bounds.
Declaration
public static (int x, int y, int z) WorldToVoxelIndexInclusive(Vector3 worldPosition, Vector3 voxelSize, Vector3 gridOrigin)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | worldPosition | The world position to convert (typically a bounding box maximum) |
| Vector3 | voxelSize | The size of each voxel in world units |
| Vector3 | gridOrigin | The world position of the grid's origin (minimum corner of voxel (0,0,0)) |
Returns
| Type | Description |
|---|---|
| (int x, int y, int z) | The (x, y, z) grid indices of the voxel containing the position |