Fix T43674: Smoke collision does not detect obstacles reliably.

The smoke obstacle detection was using a maximum distance for BVH
checks to find mesh elements that define boundary cells in the grid.
This BVH test was using an arbitrary value of 0.6 cell units. It should
be `sqrt(3)*0.5` to account for the maximum possible distance of mesh
elements inside a cell. Otherwise some cells that should form the
boundary are not detected as such (no closest mesh element found inside
the radius), so you get gaps in the smoke obstacle.
This commit is contained in:
Lukas Tönne 2015-03-09 15:15:47 +01:00
parent b14e2876a7
commit 219937fc5d
Notes: blender-bot 2023-02-14 09:29:38 +01:00
Referenced by issue #43674, smoke collision fails
1 changed files with 2 additions and 1 deletions

View File

@ -730,7 +730,8 @@ static void obstacles_from_derivedmesh(Object *coll_ob, SmokeDomainSettings *sds
BVHTreeFromMesh treeData = {NULL};
int numverts, i, z;
float surface_distance = 0.6;
/* slightly rounded-up sqrt(3 * (0.5)^2) == max. distance of cell boundary along the diagonal */
const float surface_distance = 0.867f;
float *vert_vel = NULL;
int has_velocity = 0;