summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2015-04-09 01:18:01 -0300
committerJuan Linietsky <reduzio@gmail.com>2015-04-09 01:18:01 -0300
commit3fddc9e55a66b9a2fb60ddbdf8d309f8ed57c4ab (patch)
tree116cb7d2cc96374fa8e64f871eac5371cea0bd61
parente7ba4eca9f7ea767d75db8ecc2d73c1e7c217b7e (diff)
fixed navigation tile issue, fixes #1581
-rw-r--r--scene/2d/tile_map.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/scene/2d/tile_map.cpp b/scene/2d/tile_map.cpp
index 2b88ee5dba..18f8b5bbbb 100644
--- a/scene/2d/tile_map.cpp
+++ b/scene/2d/tile_map.cpp
@@ -406,17 +406,19 @@ void TileMap::_update_dirty_quadrants() {
if (navigation) {
Ref<NavigationPolygon> navpoly = tile_set->tile_get_navigation_polygon(c.id);
- Vector2 npoly_ofs = tile_set->tile_get_navigation_polygon_offset(c.id);
- Matrix32 xform;
- xform.set_origin(offset.floor()+q.pos);
- _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s);
+ if (navpoly.is_valid()) {
+ Vector2 npoly_ofs = tile_set->tile_get_navigation_polygon_offset(c.id);
+ Matrix32 xform;
+ xform.set_origin(offset.floor()+q.pos);
+ _fix_cell_transform(xform,c,npoly_ofs+center_ofs,s);
- int pid = navigation->navpoly_create(navpoly,nav_rel * xform);
+ int pid = navigation->navpoly_create(navpoly,nav_rel * xform);
- Quadrant::NavPoly np;
- np.id=pid;
- np.xform=xform;
- q.navpoly_ids[E->key()]=np;
+ Quadrant::NavPoly np;
+ np.id=pid;
+ np.xform=xform;
+ q.navpoly_ids[E->key()]=np;
+ }
}