aboutsummaryrefslogtreecommitdiff
path: root/scene/3d/navigation_mesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/navigation_mesh.cpp')
-rw-r--r--scene/3d/navigation_mesh.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/scene/3d/navigation_mesh.cpp b/scene/3d/navigation_mesh.cpp
index 386a0fab5..9ed3b4147 100644
--- a/scene/3d/navigation_mesh.cpp
+++ b/scene/3d/navigation_mesh.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -201,23 +201,23 @@ Ref<Mesh> NavigationMesh::get_debug_mesh() {
arr.resize(Mesh::ARRAY_MAX);
arr[Mesh::ARRAY_VERTEX]=varr;
- debug_mesh->add_surface(Mesh::PRIMITIVE_LINES,arr);
+ debug_mesh->add_surface_from_arrays(Mesh::PRIMITIVE_LINES,arr);
return debug_mesh;
}
void NavigationMesh::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_vertices","vertices"),&NavigationMesh::set_vertices);
- ObjectTypeDB::bind_method(_MD("get_vertices"),&NavigationMesh::get_vertices);
+ ClassDB::bind_method(_MD("set_vertices","vertices"),&NavigationMesh::set_vertices);
+ ClassDB::bind_method(_MD("get_vertices"),&NavigationMesh::get_vertices);
- ObjectTypeDB::bind_method(_MD("add_polygon","polygon"),&NavigationMesh::add_polygon);
- ObjectTypeDB::bind_method(_MD("get_polygon_count"),&NavigationMesh::get_polygon_count);
- ObjectTypeDB::bind_method(_MD("get_polygon","idx"),&NavigationMesh::get_polygon);
- ObjectTypeDB::bind_method(_MD("clear_polygons"),&NavigationMesh::clear_polygons);
+ ClassDB::bind_method(_MD("add_polygon","polygon"),&NavigationMesh::add_polygon);
+ ClassDB::bind_method(_MD("get_polygon_count"),&NavigationMesh::get_polygon_count);
+ ClassDB::bind_method(_MD("get_polygon","idx"),&NavigationMesh::get_polygon);
+ ClassDB::bind_method(_MD("clear_polygons"),&NavigationMesh::clear_polygons);
- ObjectTypeDB::bind_method(_MD("_set_polygons","polygons"),&NavigationMesh::_set_polygons);
- ObjectTypeDB::bind_method(_MD("_get_polygons"),&NavigationMesh::_get_polygons);
+ ClassDB::bind_method(_MD("_set_polygons","polygons"),&NavigationMesh::_set_polygons);
+ ClassDB::bind_method(_MD("_get_polygons"),&NavigationMesh::_get_polygons);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR3_ARRAY,"vertices",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("set_vertices"),_SCS("get_vertices"));
ADD_PROPERTY(PropertyInfo(Variant::ARRAY,"polygons",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_NOEDITOR),_SCS("_set_polygons"),_SCS("_get_polygons"));
@@ -356,6 +356,11 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref<NavigationMesh>& p_na
if (navigation && navmesh.is_valid() && enabled) {
nav_id = navigation->navmesh_create(navmesh,get_relative_transform(navigation),this);
}
+
+ if (debug_view && navmesh.is_valid()) {
+ debug_view->cast_to<MeshInstance>()->set_mesh( navmesh->get_debug_mesh() );
+ }
+
update_gizmo();
update_configuration_warning();
@@ -389,11 +394,11 @@ String NavigationMeshInstance::get_configuration_warning() const {
void NavigationMeshInstance::_bind_methods() {
- ObjectTypeDB::bind_method(_MD("set_navigation_mesh","navmesh"),&NavigationMeshInstance::set_navigation_mesh);
- ObjectTypeDB::bind_method(_MD("get_navigation_mesh"),&NavigationMeshInstance::get_navigation_mesh);
+ ClassDB::bind_method(_MD("set_navigation_mesh","navmesh"),&NavigationMeshInstance::set_navigation_mesh);
+ ClassDB::bind_method(_MD("get_navigation_mesh"),&NavigationMeshInstance::get_navigation_mesh);
- ObjectTypeDB::bind_method(_MD("set_enabled","enabled"),&NavigationMeshInstance::set_enabled);
- ObjectTypeDB::bind_method(_MD("is_enabled"),&NavigationMeshInstance::is_enabled);
+ ClassDB::bind_method(_MD("set_enabled","enabled"),&NavigationMeshInstance::set_enabled);
+ ClassDB::bind_method(_MD("is_enabled"),&NavigationMeshInstance::is_enabled);
ADD_PROPERTY( PropertyInfo(Variant::OBJECT,"navmesh",PROPERTY_HINT_RESOURCE_TYPE,"NavigationMesh"),_SCS("set_navigation_mesh"),_SCS("get_navigation_mesh"));
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"enabled"),_SCS("set_enabled"),_SCS("is_enabled"));