Fixed bug that caused crash when object was entirely below platform

This commit is contained in:
Jaime van Kessel 2015-08-13 13:35:51 +02:00
parent a63d08288a
commit ddc34eaa3a
3 changed files with 9 additions and 8 deletions

View file

@ -30,14 +30,14 @@ class ConvexHullNode(SceneNode):
self._hull = hull
hull_points = self._hull.getPoints()
center = (hull_points.min(0) + hull_points.max(0)) / 2.0
mesh = MeshData()
mesh.addVertex(center[0], 0.1, center[1])
if len(hull_points) > 3:
center = (hull_points.min(0) + hull_points.max(0)) / 2.0
mesh.addVertex(center[0], 0.1, center[1])
else: #Hull has not enough points
return
for point in hull_points:
mesh.addVertex(point[0], 0.1, point[1])
indices = []
for i in range(len(hull_points) - 1):
indices.append([0, i + 1, i + 2])