World.getDominantMaterialInCapsule

Finds the dominant voxel material inside a capsule volume.

Kind: Function

Environments: Game

Game

world:getDominantMaterialInCapsule( position, radius, height )

Open the full Game reference

Parameters:

Name Type Description
world World The world to look in.
position Vec3 The center position of the capsule.
radius number The radius of the capsule.
height number The height of the cylindrical part of the capsule (Z-axis aligned, excluding hemispherical caps).

Returns:

Type Description
integer The dominant material index value. (returns nil if no voxel was found)
integer The highest single-voxel density of the dominant material.
Vec3 The weighted average world position of the dominant material (biased toward dense, nearby voxels)