VoxelRaycastResult

Inherits: RefCounted

Result of a raycast performed with VoxelTool.raycast

Properties:

Type Name Default
float distance 0.0
Vector3 normal Vector3(0, 0, 0)
Vector3i position Vector3i(0, 0, 0)
Vector3i previous_position Vector3i(0, 0, 0)

Property Descriptions

float distance = 0.0

Distance between the origin of the ray and the surface of the cube representing the hit voxel.

Vector3 normal = Vector3(0, 0, 0)

Unit vector pointing away from the surface that was hit.

This is only available if VoxelTool was configured to compute normals. See VoxelTool.set_raycast_normal_enabled.

With blocky voxels, this normal will be based on collision boxes rather than the mesh.

Vector3i position = Vector3i(0, 0, 0)

Integer position of the voxel that was hit. In a blocky game, this would be the position of the voxel to interact with.

Vector3i previous_position = Vector3i(0, 0, 0)

Integer position of the previous voxel along the ray before the final hit. In a blocky game, this would be the position of the voxel to place on top of the pointed one.

Generated on Jan 26, 2026