Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check if mesh is a cube that would be accepted as a unreal collision volume
import lx
import lxu
import modo
from math import isclose
mesh, = modo.Scene().selectedByType('mesh')
result = set()
with mesh.geometry as geo:
normals = set()
for polygon in geo.polygons:
for a in normals:
for b in normals:
if a == b: continue
zero = isclose(abs(,b)), 0.0, abs_tol=0.000001)
one = isclose(abs(,b)), 1.0, abs_tol=0.000001)
result.add(zero or one)
if False in result:
print("Not nice box")
print("Beautiful, beautiful box")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment