mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-10 11:33:23 +02:00
Merge pull request #5466 from sethalves/vhacd-improvements
vhacd tool -- make the height of the tetrahedrons in 'fatten' mode less tall.
This commit is contained in:
commit
761f638ce3
1 changed files with 5 additions and 1 deletions
|
@ -12,6 +12,8 @@
|
|||
#include <QVector>
|
||||
#include "VHACDUtil.h"
|
||||
|
||||
const float COLLISION_TETRAHEDRON_SCALE = 0.25f;
|
||||
|
||||
|
||||
// FBXReader jumbles the order of the meshes by reading them back out of a hashtable. This will put
|
||||
// them back in the order in which they appeared in the file.
|
||||
|
@ -127,12 +129,14 @@ void vhacd::VHACDUtil::fattenMeshes(const FBXMesh& mesh, FBXMesh& result,
|
|||
continue;
|
||||
}
|
||||
|
||||
// from the middle of the triangle, pull a point down to form a tetrahedron.
|
||||
float dropAmount = 0;
|
||||
dropAmount = glm::max(glm::length(p1 - p0), dropAmount);
|
||||
dropAmount = glm::max(glm::length(p2 - p1), dropAmount);
|
||||
dropAmount = glm::max(glm::length(p0 - p2), dropAmount);
|
||||
dropAmount *= COLLISION_TETRAHEDRON_SCALE;
|
||||
|
||||
glm::vec3 p3 = av - glm::vec3(0, dropAmount, 0); // a point 1 meter below the average of this triangle's points
|
||||
glm::vec3 p3 = av - glm::vec3(0.0f, dropAmount, 0.0f);
|
||||
int index3 = result.vertices.size();
|
||||
result.vertices << p3; // add the new point to the result mesh
|
||||
|
||||
|
|
Loading…
Reference in a new issue