Skip to content

Commit

Permalink
fixing bug where would crash when all points were in same position
Browse files Browse the repository at this point in the history
  • Loading branch information
Miziziziz committed Apr 23, 2019
1 parent e4605f6 commit e76dbec
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions addons/godot-next/3d/trail_3d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -101,19 +101,21 @@ func render_trail():
add_vertex(cur[nxt_i])
add_vertex(nxt[nxt_i])
add_vertex(nxt[i])
#cap off top
for i in range(density_around):
var nxt = (i + 1) % density_around
add_vertex(verts[0][i])
add_vertex(Vector3())
add_vertex(verts[0][nxt])


#cap off bottom
for i in range(density_around):
var nxt = (i + 1) % density_around
add_vertex(verts[verts.size() - 1][i])
add_vertex(verts[verts.size() - 1][nxt])
add_vertex(last_p)
if verts.size() > 1:
#cap off top
for i in range(density_around):
var nxt = (i + 1) % density_around
add_vertex(verts[0][i])
add_vertex(Vector3())
add_vertex(verts[0][nxt])


#cap off bottom
for i in range(density_around):
var nxt = (i + 1) % density_around
add_vertex(verts[verts.size() - 1][i])
add_vertex(verts[verts.size() - 1][nxt])
add_vertex(last_p)
end()


0 comments on commit e76dbec

Please sign in to comment.