Skip to content

Commit

Permalink
Merge pull request godotengine#245 from Jason0214/fix_concave_collision
Browse files Browse the repository at this point in the history
Generate concave shapes has godot does
  • Loading branch information
Jason0214 committed Aug 4, 2019
2 parents 2783097 + 89f07c6 commit 9c4d187
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions io_scene_godot/converters/physics.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ def generate_concave_shape(escn_file, export_settings, bl_object):
if mesh is not None and mesh.polygons:
vert_array = list()
for poly in mesh.polygons:
for vert_id in poly.vertices:
vert_array.append(list(mesh.vertices[vert_id].co))
for vert_id in reversed(poly.vertices):
vert_array.append(mesh.vertices[vert_id].co)

col_shape = InternalResource("ConcavePolygonShape", mesh.name)
col_shape['data'] = Array("PoolVector3Array(", values=vert_array)
Expand Down
2 changes: 1 addition & 1 deletion tests/reference_exports/mesh/physics.escn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ surfaces/0 = {
[sub_resource id=3 type="ConcavePolygonShape"]

resource_name = "Cube001"
data = PoolVector3Array(-4.0, 1.33333, 0.3, -4.0, 4.0, -0.3, -4.0, 1.33333, -0.3, 1.33333, 4.0, 0.3, 4.0, 4.0, -0.3, 1.33333, 4.0, -0.3, 4.0, -1.33333, 0.3, 4.0, -4.0, -0.3, 4.0, -1.33333, -0.3, -1.33333, -4.0, 0.3, -4.0, -4.0, -0.3, -1.33333, -4.0, -0.3, 4.0, -1.33333, -0.3, 1.33333, -4.0, -0.3, 1.33333, -1.33333, -0.3, -4.0, -1.33333, 0.3, -1.33333, -4.0, 0.3, -1.33333, -1.33333, 0.3, 1.33333, -1.33333, 0.3, 4.0, -4.0, 0.3, 4.0, -1.33333, 0.3, -1.33333, -1.33333, 0.3, 1.33333, -4.0, 0.3, 1.33333, -1.33333, 0.3, 1.33333, 4.0, 0.3, 4.0, 1.33333, 0.3, 4.0, 4.0, 0.3, 1.33333, 1.33333, 0.3, 4.0, -1.33333, 0.3, 4.0, 1.33333, 0.3, -1.33333, 4.0, 0.3, 1.33333, 1.33333, 0.3, 1.33333, 4.0, 0.3, -1.33333, -1.33333, -0.3, -1.33333, 1.33333, 0.3, -1.33333, -1.33333, 0.3, -4.0, 4.0, 0.3, -1.33333, 1.33333, 0.3, -1.33333, 4.0, 0.3, -4.0, 1.33333, 0.3, -1.33333, -1.33333, 0.3, -1.33333, 1.33333, 0.3, -1.33333, -1.33333, -0.3, -4.0, -4.0, -0.3, -4.0, -1.33333, -0.3, 1.33333, -1.33333, -0.3, -1.33333, -4.0, -0.3, -1.33333, -1.33333, -0.3, -1.33333, 4.0, -0.3, -4.0, 1.33333, -0.3, -4.0, 4.0, -0.3, -1.33333, 1.33333, -0.3, -4.0, -1.33333, -0.3, -4.0, 1.33333, -0.3, 1.33333, 4.0, -0.3, -1.33333, 1.33333, -0.3, -1.33333, 4.0, -0.3, 1.33333, -1.33333, -0.3, -1.33333, -1.33333, 0.3, 1.33333, -1.33333, 0.3, 4.0, 4.0, -0.3, 1.33333, 1.33333, -0.3, 1.33333, 4.0, -0.3, 4.0, 1.33333, -0.3, 1.33333, -1.33333, -0.3, 1.33333, 1.33333, -0.3, 4.0, -4.0, 0.3, 1.33333, -4.0, -0.3, 4.0, -4.0, -0.3, 1.33333, -4.0, 0.3, -1.33333, -4.0, -0.3, 1.33333, -4.0, -0.3, 4.0, 4.0, 0.3, 4.0, 1.33333, -0.3, 4.0, 4.0, -0.3, 4.0, 1.33333, 0.3, 4.0, -1.33333, -0.3, 4.0, 1.33333, -0.3, -4.0, 4.0, 0.3, -1.33333, 4.0, -0.3, -4.0, 4.0, -0.3, -1.33333, 4.0, 0.3, 1.33333, 4.0, -0.3, -1.33333, 4.0, -0.3, -4.0, -4.0, 0.3, -4.0, -1.33333, -0.3, -4.0, -4.0, -0.3, -4.0, -1.33333, 0.3, -4.0, 1.33333, -0.3, -4.0, -1.33333, -0.3, -1.33333, 1.33333, -0.3, 1.33333, 1.33333, 0.3, -1.33333, 1.33333, 0.3, 1.33333, 1.33333, -0.3, 1.33333, -1.33333, 0.3, 1.33333, 1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, 4.0, 0.3, -4.0, 4.0, -0.3, 1.33333, 4.0, 0.3, 4.0, 4.0, 0.3, 4.0, 4.0, -0.3, 4.0, -1.33333, 0.3, 4.0, -4.0, 0.3, 4.0, -4.0, -0.3, -1.33333, -4.0, 0.3, -4.0, -4.0, 0.3, -4.0, -4.0, -0.3, 4.0, -1.33333, -0.3, 4.0, -4.0, -0.3, 1.33333, -4.0, -0.3, -4.0, -1.33333, 0.3, -4.0, -4.0, 0.3, -1.33333, -4.0, 0.3, 1.33333, -1.33333, 0.3, 1.33333, -4.0, 0.3, 4.0, -4.0, 0.3, -1.33333, -1.33333, 0.3, -1.33333, -4.0, 0.3, 1.33333, -4.0, 0.3, 1.33333, 4.0, 0.3, 1.33333, 1.33333, 0.3, 4.0, 1.33333, 0.3, 1.33333, 1.33333, 0.3, 1.33333, -1.33333, 0.3, 4.0, -1.33333, 0.3, -1.33333, 4.0, 0.3, -1.33333, 1.33333, 0.3, 1.33333, 1.33333, 0.3, -1.33333, -1.33333, -0.3, -1.33333, 1.33333, -0.3, -1.33333, 1.33333, 0.3, -4.0, 4.0, 0.3, -4.0, 1.33333, 0.3, -1.33333, 1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, -1.33333, 0.3, -1.33333, -1.33333, 0.3, -1.33333, -1.33333, -0.3, -1.33333, -4.0, -0.3, -4.0, -4.0, -0.3, 1.33333, -1.33333, -0.3, 1.33333, -4.0, -0.3, -1.33333, -4.0, -0.3, -1.33333, 4.0, -0.3, -1.33333, 1.33333, -0.3, -4.0, 1.33333, -0.3, -1.33333, 1.33333, -0.3, -1.33333, -1.33333, -0.3, -4.0, -1.33333, -0.3, 1.33333, 4.0, -0.3, 1.33333, 1.33333, -0.3, -1.33333, 1.33333, -0.3, 1.33333, -1.33333, -0.3, -1.33333, -1.33333, -0.3, -1.33333, -1.33333, 0.3, 4.0, 4.0, -0.3, 4.0, 1.33333, -0.3, 1.33333, 1.33333, -0.3, 4.0, 1.33333, -0.3, 4.0, -1.33333, -0.3, 1.33333, -1.33333, -0.3, 4.0, -4.0, 0.3, 1.33333, -4.0, 0.3, 1.33333, -4.0, -0.3, 1.33333, -4.0, 0.3, -1.33333, -4.0, 0.3, -1.33333, -4.0, -0.3, 4.0, 4.0, 0.3, 4.0, 1.33333, 0.3, 4.0, 1.33333, -0.3, 4.0, 1.33333, 0.3, 4.0, -1.33333, 0.3, 4.0, -1.33333, -0.3, -4.0, 4.0, 0.3, -1.33333, 4.0, 0.3, -1.33333, 4.0, -0.3, -1.33333, 4.0, 0.3, 1.33333, 4.0, 0.3, 1.33333, 4.0, -0.3, -4.0, -4.0, 0.3, -4.0, -1.33333, 0.3, -4.0, -1.33333, -0.3, -4.0, -1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, 1.33333, -0.3, -1.33333, 1.33333, -0.3, 1.33333, 1.33333, -0.3, 1.33333, 1.33333, 0.3, 1.33333, 1.33333, -0.3, 1.33333, -1.33333, -0.3, 1.33333, -1.33333, 0.3)
data = PoolVector3Array(-4.0, 1.33333, -0.3, -4.0, 4.0, -0.3, -4.0, 1.33333, 0.3, 1.33333, 4.0, -0.3, 4.0, 4.0, -0.3, 1.33333, 4.0, 0.3, 4.0, -1.33333, -0.3, 4.0, -4.0, -0.3, 4.0, -1.33333, 0.3, -1.33333, -4.0, -0.3, -4.0, -4.0, -0.3, -1.33333, -4.0, 0.3, 1.33333, -1.33333, -0.3, 1.33333, -4.0, -0.3, 4.0, -1.33333, -0.3, -1.33333, -1.33333, 0.3, -1.33333, -4.0, 0.3, -4.0, -1.33333, 0.3, 4.0, -1.33333, 0.3, 4.0, -4.0, 0.3, 1.33333, -1.33333, 0.3, 1.33333, -1.33333, 0.3, 1.33333, -4.0, 0.3, -1.33333, -1.33333, 0.3, 4.0, 4.0, 0.3, 4.0, 1.33333, 0.3, 1.33333, 4.0, 0.3, 4.0, 1.33333, 0.3, 4.0, -1.33333, 0.3, 1.33333, 1.33333, 0.3, 1.33333, 4.0, 0.3, 1.33333, 1.33333, 0.3, -1.33333, 4.0, 0.3, -1.33333, -1.33333, 0.3, -1.33333, 1.33333, 0.3, -1.33333, -1.33333, -0.3, -1.33333, 4.0, 0.3, -1.33333, 1.33333, 0.3, -4.0, 4.0, 0.3, -1.33333, 1.33333, 0.3, -1.33333, -1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, -1.33333, -0.3, -4.0, -4.0, -0.3, -1.33333, -1.33333, -0.3, -1.33333, -1.33333, -0.3, -1.33333, -4.0, -0.3, 1.33333, -1.33333, -0.3, -4.0, 4.0, -0.3, -4.0, 1.33333, -0.3, -1.33333, 4.0, -0.3, -4.0, 1.33333, -0.3, -4.0, -1.33333, -0.3, -1.33333, 1.33333, -0.3, -1.33333, 4.0, -0.3, -1.33333, 1.33333, -0.3, 1.33333, 4.0, -0.3, 1.33333, -1.33333, 0.3, -1.33333, -1.33333, 0.3, 1.33333, -1.33333, -0.3, 1.33333, 4.0, -0.3, 1.33333, 1.33333, -0.3, 4.0, 4.0, -0.3, 1.33333, 1.33333, -0.3, 1.33333, -1.33333, -0.3, 4.0, 1.33333, -0.3, 4.0, -4.0, -0.3, 1.33333, -4.0, -0.3, 4.0, -4.0, 0.3, 1.33333, -4.0, -0.3, -1.33333, -4.0, -0.3, 1.33333, -4.0, 0.3, 4.0, 4.0, -0.3, 4.0, 1.33333, -0.3, 4.0, 4.0, 0.3, 4.0, 1.33333, -0.3, 4.0, -1.33333, -0.3, 4.0, 1.33333, 0.3, -4.0, 4.0, -0.3, -1.33333, 4.0, -0.3, -4.0, 4.0, 0.3, -1.33333, 4.0, -0.3, 1.33333, 4.0, -0.3, -1.33333, 4.0, 0.3, -4.0, -4.0, -0.3, -4.0, -1.33333, -0.3, -4.0, -4.0, 0.3, -4.0, -1.33333, -0.3, -4.0, 1.33333, -0.3, -4.0, -1.33333, 0.3, -1.33333, 1.33333, 0.3, 1.33333, 1.33333, 0.3, -1.33333, 1.33333, -0.3, 1.33333, 1.33333, 0.3, 1.33333, -1.33333, 0.3, 1.33333, 1.33333, -0.3, -4.0, 4.0, -0.3, -4.0, 4.0, 0.3, -4.0, 1.33333, 0.3, 4.0, 4.0, -0.3, 4.0, 4.0, 0.3, 1.33333, 4.0, 0.3, 4.0, -4.0, -0.3, 4.0, -4.0, 0.3, 4.0, -1.33333, 0.3, -4.0, -4.0, -0.3, -4.0, -4.0, 0.3, -1.33333, -4.0, 0.3, 1.33333, -4.0, -0.3, 4.0, -4.0, -0.3, 4.0, -1.33333, -0.3, -1.33333, -4.0, 0.3, -4.0, -4.0, 0.3, -4.0, -1.33333, 0.3, 4.0, -4.0, 0.3, 1.33333, -4.0, 0.3, 1.33333, -1.33333, 0.3, 1.33333, -4.0, 0.3, -1.33333, -4.0, 0.3, -1.33333, -1.33333, 0.3, 4.0, 1.33333, 0.3, 1.33333, 1.33333, 0.3, 1.33333, 4.0, 0.3, 4.0, -1.33333, 0.3, 1.33333, -1.33333, 0.3, 1.33333, 1.33333, 0.3, 1.33333, 1.33333, 0.3, -1.33333, 1.33333, 0.3, -1.33333, 4.0, 0.3, -1.33333, 1.33333, 0.3, -1.33333, 1.33333, -0.3, -1.33333, -1.33333, -0.3, -1.33333, 1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, 4.0, 0.3, -1.33333, -1.33333, 0.3, -4.0, -1.33333, 0.3, -4.0, 1.33333, 0.3, -4.0, -4.0, -0.3, -1.33333, -4.0, -0.3, -1.33333, -1.33333, -0.3, -1.33333, -4.0, -0.3, 1.33333, -4.0, -0.3, 1.33333, -1.33333, -0.3, -4.0, 1.33333, -0.3, -1.33333, 1.33333, -0.3, -1.33333, 4.0, -0.3, -4.0, -1.33333, -0.3, -1.33333, -1.33333, -0.3, -1.33333, 1.33333, -0.3, -1.33333, 1.33333, -0.3, 1.33333, 1.33333, -0.3, 1.33333, 4.0, -0.3, -1.33333, -1.33333, 0.3, -1.33333, -1.33333, -0.3, 1.33333, -1.33333, -0.3, 1.33333, 1.33333, -0.3, 4.0, 1.33333, -0.3, 4.0, 4.0, -0.3, 1.33333, -1.33333, -0.3, 4.0, -1.33333, -0.3, 4.0, 1.33333, -0.3, 1.33333, -4.0, -0.3, 1.33333, -4.0, 0.3, 4.0, -4.0, 0.3, -1.33333, -4.0, -0.3, -1.33333, -4.0, 0.3, 1.33333, -4.0, 0.3, 4.0, 1.33333, -0.3, 4.0, 1.33333, 0.3, 4.0, 4.0, 0.3, 4.0, -1.33333, -0.3, 4.0, -1.33333, 0.3, 4.0, 1.33333, 0.3, -1.33333, 4.0, -0.3, -1.33333, 4.0, 0.3, -4.0, 4.0, 0.3, 1.33333, 4.0, -0.3, 1.33333, 4.0, 0.3, -1.33333, 4.0, 0.3, -4.0, -1.33333, -0.3, -4.0, -1.33333, 0.3, -4.0, -4.0, 0.3, -4.0, 1.33333, -0.3, -4.0, 1.33333, 0.3, -4.0, -1.33333, 0.3, 1.33333, 1.33333, 0.3, 1.33333, 1.33333, -0.3, -1.33333, 1.33333, -0.3, 1.33333, -1.33333, 0.3, 1.33333, -1.33333, -0.3, 1.33333, 1.33333, -0.3)

[sub_resource id=4 type="CapsuleShape"]

Expand Down

0 comments on commit 9c4d187

Please sign in to comment.