mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-07 20:22:27 +02:00
when creating a walking surface collision hull from a flat mesh, ignore triangles with a normal that's not mostly up or down
This commit is contained in:
parent
2ac6304752
commit
6ba135de09
1 changed files with 7 additions and 0 deletions
|
@ -118,6 +118,13 @@ void vhacd::VHACDUtil::fattenMeshes(const FBXMesh& mesh, FBXMesh& result,
|
|||
glm::vec3 p2 = result.vertices[index2];
|
||||
glm::vec3 av = (p0 + p1 + p2) / 3.0f; // center of the triangular face
|
||||
|
||||
glm::vec3 normal = glm::normalize(glm::cross(p1 - p0, p2 - p0));
|
||||
float threshold = 1.0f / sqrtf(3.0f);
|
||||
if (normal.y > -threshold && normal.y < threshold) {
|
||||
// this triangle is more a wall than a floor, skip it.
|
||||
continue;
|
||||
}
|
||||
|
||||
float dropAmount = 0;
|
||||
dropAmount = glm::max(glm::length(p1 - p0), dropAmount);
|
||||
dropAmount = glm::max(glm::length(p2 - p1), dropAmount);
|
||||
|
|
Loading…
Reference in a new issue