Browse Source

Force flat-ish convex hulls to triangle mesh.

These crash the engine, so don't export them.
pull/336/head
Adam Johnson 2 years ago
parent
commit
ec37d4e650
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 9
      korman/exporter/physics.py

9
korman/exporter/physics.py

@ -281,6 +281,15 @@ class PhysicsConverter:
# bake them to convex hulls. Specifically, Windows 32-bit w/PhysX 2.6. Everything else just
# needs to have us provide some friendlier data...
with bmesh_from_object(bo) as mesh:
# Don't export flat planes as convex hulls - force them to triangle meshes.
volume = mesh.calc_volume()
if volume < 0.001:
self._report.warn(
"{}: Physical wants to be a convex hull but appears to be flat (volume={}), forcing to triangle mesh...",
bo.name, volume, indent=2
)
self._export_trimesh(bo, physical, local_space, mat)
if local_space:
physical.pos = hsVector3(*mat.to_translation())
physical.rot = utils.quaternion(mat.to_quaternion())

Loading…
Cancel
Save