Entities are spawned by prefab name on their Voxel coordinates (Integer positions). In most of my entities there is a script attached that realigns them to ground via single raycast.
The PolyVox mesh is used for colision as MeshCollider
Code:
void alignToGround()
{
float dist = 1;
transform.position = hitPoint; //We start from here!
transform.position += new Vector3(0, dist, 0);
RaycastHit hit;
bool hasGround = Physics.Raycast(new Ray(transform.position, Vector3.down), out hit, 2);
if (!hasGround)
{
//revert
transform.position -= new Vector3(0, dist, 0);
}
else
{
transform.position = hit.point + (hit.normal * groundOffset);
if (orientateToGround)
{
transform.up = hit.normal;
transform.Rotate(Vector3.up, angle + Random.Range(-angleDeviation, +angleDeviation));
}
}
}