diff --git a/doc/classes/Navigation.xml b/doc/classes/Navigation.xml
index 0000ca6bd5..93170bca4a 100644
--- a/doc/classes/Navigation.xml
+++ b/doc/classes/Navigation.xml
@@ -4,7 +4,7 @@
Mesh-based navigation and pathfinding node.
- Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationMeshInstance] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
+ Provides navigation and pathfinding within a collection of [NavigationMesh]es. These will be automatically collected from child [NavigationRegion] nodes. In addition to basic pathfinding, this class also assists with aligning navigation agents with the meshes they are navigating on.
diff --git a/doc/classes/Navigation2D.xml b/doc/classes/Navigation2D.xml
index 0d016a3210..dcbfbc2350 100644
--- a/doc/classes/Navigation2D.xml
+++ b/doc/classes/Navigation2D.xml
@@ -4,7 +4,7 @@
2D navigation and pathfinding node.
- Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. These are automatically collected from child [NavigationPolygonInstance] nodes.
+ Navigation2D provides navigation and pathfinding within a 2D area, specified as a collection of [NavigationPolygon] resources. These are automatically collected from child [NavigationRegion2D] nodes.
diff --git a/doc/classes/NavigationPolygon.xml b/doc/classes/NavigationPolygon.xml
index da291b7337..b0f77dff83 100644
--- a/doc/classes/NavigationPolygon.xml
+++ b/doc/classes/NavigationPolygon.xml
@@ -11,7 +11,7 @@
var outline = PackedVector2Array([Vector2(0, 0), Vector2(0, 50), Vector2(50, 50), Vector2(50, 0)])
polygon.add_outline(outline)
polygon.make_polygons_from_outlines()
- $NavigationPolygonInstance.navpoly = polygon
+ $NavigationRegion2D.navpoly = polygon
[/codeblock]
Using [method add_polygon] and indices of the vertices array.
[codeblock]
@@ -20,7 +20,7 @@
polygon.set_vertices(vertices)
var indices = PackedInt32Array(0, 3, 1)
polygon.add_polygon(indices)
- $NavigationPolygonInstance.navpoly = polygon
+ $NavigationRegion2D.navpoly = polygon
[/codeblock]
diff --git a/doc/classes/NavigationMeshInstance.xml b/doc/classes/NavigationRegion.xml
similarity index 75%
rename from doc/classes/NavigationMeshInstance.xml
rename to doc/classes/NavigationRegion.xml
index 75bd62e278..41fac70654 100644
--- a/doc/classes/NavigationMeshInstance.xml
+++ b/doc/classes/NavigationRegion.xml
@@ -1,10 +1,10 @@
-
+
- An instance of a [NavigationMesh].
+ A region of the navigation map.
- An instance of a [NavigationMesh]. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node.
+ A region of the navigation map. It tells the [Navigation] node what can be navigated and what cannot, based on the [NavigationMesh] resource. This should be a child of a [Navigation] node (even not a direct child).
@@ -19,7 +19,7 @@
- Determines if the [NavigationMeshInstance] is enabled or disabled.
+ Determines if the [NavigationRegion] is enabled or disabled.
The [NavigationMesh] resource to use.
diff --git a/doc/classes/NavigationPolygonInstance.xml b/doc/classes/NavigationRegion2D.xml
similarity index 86%
rename from doc/classes/NavigationPolygonInstance.xml
rename to doc/classes/NavigationRegion2D.xml
index 34c6b09859..aef114e1db 100644
--- a/doc/classes/NavigationPolygonInstance.xml
+++ b/doc/classes/NavigationRegion2D.xml
@@ -1,5 +1,5 @@
-
+
diff --git a/doc/classes/PhysicsServer.xml b/doc/classes/PhysicsServer.xml
index 592d3d8e4e..c9f4accee2 100644
--- a/doc/classes/PhysicsServer.xml
+++ b/doc/classes/PhysicsServer.xml
@@ -1467,7 +1467,7 @@
If [code]set[/code] there is a linear motor on this axis that targets a specific velocity.
- The [Shape] is a [PlaneShape].
+ The [Shape] is a [WorldMarginShape].
The [Shape] is a [RayShape].
diff --git a/doc/classes/PlaneShape.xml b/doc/classes/WorldMarginShape.xml
similarity index 65%
rename from doc/classes/PlaneShape.xml
rename to doc/classes/WorldMarginShape.xml
index b40e133d00..54f76a066b 100644
--- a/doc/classes/PlaneShape.xml
+++ b/doc/classes/WorldMarginShape.xml
@@ -1,10 +1,10 @@
-
+
Infinite plane shape for 3D collisions.
- An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [PlaneShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane.
+ An infinite plane shape for 3D collisions. Note that the [Plane]'s normal matters; anything "below" the plane will collide with it. If the [WorldMarginShape] is used in a [PhysicsBody], it will cause colliding objects placed "below" it to teleport "above" the plane.
@@ -12,7 +12,7 @@
- The [Plane] used by the [PlaneShape] for collision.
+ The [Plane] used by the [WorldMarginShape] for collision.
diff --git a/editor/icons/NavigationMeshInstance.svg b/editor/icons/NavigationMeshInstance.svg
deleted file mode 100644
index 737d9c319d..0000000000
--- a/editor/icons/NavigationMeshInstance.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/editor/icons/NavigationPolygonInstance.svg b/editor/icons/NavigationPolygonInstance.svg
deleted file mode 100644
index e16d10614e..0000000000
--- a/editor/icons/NavigationPolygonInstance.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/editor/icons/NavigationRegion.svg b/editor/icons/NavigationRegion.svg
new file mode 100644
index 0000000000..92cc9afd91
--- /dev/null
+++ b/editor/icons/NavigationRegion.svg
@@ -0,0 +1,58 @@
+
+
diff --git a/editor/icons/NavigationRegion2D.svg b/editor/icons/NavigationRegion2D.svg
new file mode 100644
index 0000000000..a297216cb7
--- /dev/null
+++ b/editor/icons/NavigationRegion2D.svg
@@ -0,0 +1,67 @@
+
+
diff --git a/editor/icons/PlaneMesh.svg b/editor/icons/PlaneMesh.svg
deleted file mode 100644
index ddcc623c67..0000000000
--- a/editor/icons/PlaneMesh.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/editor/icons/WorldMarginShape.svg b/editor/icons/WorldMarginShape.svg
new file mode 100644
index 0000000000..2c90cf6d53
--- /dev/null
+++ b/editor/icons/WorldMarginShape.svg
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/editor/import/resource_importer_scene.cpp b/editor/import/resource_importer_scene.cpp
index 9fb6be50d9..5651197fa3 100644
--- a/editor/import/resource_importer_scene.cpp
+++ b/editor/import/resource_importer_scene.cpp
@@ -41,10 +41,10 @@
#include "scene/resources/animation.h"
#include "scene/resources/box_shape.h"
#include "scene/resources/packed_scene.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/resource_format_text.h"
#include "scene/resources/sphere_shape.h"
+#include "scene/resources/world_margin_shape.h"
uint32_t EditorSceneImporter::get_import_flags() const {
@@ -446,9 +446,9 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map[
colshape->set_name("RayShape");
Object::cast_to(sb)->rotate_x(Math_PI / 2);
} else if (empty_draw_type == "IMAGE") {
- PlaneShape *planeShape = memnew(PlaneShape);
- colshape->set_shape(planeShape);
- colshape->set_name("PlaneShape");
+ WorldMarginShape *world_margin_shape = memnew(WorldMarginShape);
+ colshape->set_shape(world_margin_shape);
+ colshape->set_name("WorldMarginShape");
} else {
SphereShape *sphereShape = memnew(SphereShape);
sphereShape->set_radius(1);
@@ -559,7 +559,7 @@ Node *ResourceImporterScene::_fix_node(Node *p_node, Node *p_root, Map][
Ref mesh = mi->get_mesh();
ERR_FAIL_COND_V(mesh.is_null(), NULL);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_name(_fixstr(name, "navmesh"));
Ref nmesh = memnew(NavigationMesh);
diff --git a/editor/plugins/mesh_instance_editor_plugin.cpp b/editor/plugins/mesh_instance_editor_plugin.cpp
index 37cf16de58..c285bb4e1a 100644
--- a/editor/plugins/mesh_instance_editor_plugin.cpp
+++ b/editor/plugins/mesh_instance_editor_plugin.cpp
@@ -32,7 +32,7 @@
#include "editor/editor_scale.h"
#include "scene/3d/collision_shape.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/gui/box_container.h"
#include "spatial_editor_plugin.h"
@@ -233,7 +233,7 @@ void MeshInstanceEditor::_menu_option(int p_option) {
return;
nmesh->create_from_mesh(mesh);
- NavigationMeshInstance *nmi = memnew(NavigationMeshInstance);
+ NavigationRegion *nmi = memnew(NavigationRegion);
nmi->set_navigation_mesh(nmesh);
Node *owner = node == get_tree()->get_edited_scene_root() ? node : node->get_owner();
diff --git a/editor/plugins/mesh_library_editor_plugin.cpp b/editor/plugins/mesh_library_editor_plugin.cpp
index ea8842a56f..863ea451b5 100644
--- a/editor/plugins/mesh_library_editor_plugin.cpp
+++ b/editor/plugins/mesh_library_editor_plugin.cpp
@@ -34,7 +34,7 @@
#include "editor/editor_settings.h"
#include "main/main.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/physics_body.h"
#include "scene/main/viewport.h"
#include "scene/resources/packed_scene.h"
@@ -152,9 +152,9 @@ void MeshLibraryEditor::_import_scene(Node *p_scene, Ref p_library,
Transform navmesh_transform;
for (int j = 0; j < mi->get_child_count(); j++) {
Node *child2 = mi->get_child(j);
- if (!Object::cast_to(child2))
+ if (!Object::cast_to(child2))
continue;
- NavigationMeshInstance *sb = Object::cast_to(child2);
+ NavigationRegion *sb = Object::cast_to(child2);
navmesh = sb->get_navigation_mesh();
navmesh_transform = sb->get_transform();
if (!navmesh.is_null())
diff --git a/editor/plugins/navigation_polygon_editor_plugin.cpp b/editor/plugins/navigation_polygon_editor_plugin.cpp
index c4e61f2488..6671d0b6b4 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.cpp
+++ b/editor/plugins/navigation_polygon_editor_plugin.cpp
@@ -48,7 +48,7 @@ Node2D *NavigationPolygonEditor::_get_node() const {
void NavigationPolygonEditor::_set_node(Node *p_polygon) {
- node = Object::cast_to(p_polygon);
+ node = Object::cast_to(p_polygon);
}
int NavigationPolygonEditor::_get_polygon_count() const {
@@ -127,5 +127,5 @@ NavigationPolygonEditor::NavigationPolygonEditor(EditorNode *p_editor) :
}
NavigationPolygonEditorPlugin::NavigationPolygonEditorPlugin(EditorNode *p_node) :
- AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationPolygonInstance") {
+ AbstractPolygon2DEditorPlugin(p_node, memnew(NavigationPolygonEditor(p_node)), "NavigationRegion2D") {
}
diff --git a/editor/plugins/navigation_polygon_editor_plugin.h b/editor/plugins/navigation_polygon_editor_plugin.h
index 1cab336381..10f8cbc0a5 100644
--- a/editor/plugins/navigation_polygon_editor_plugin.h
+++ b/editor/plugins/navigation_polygon_editor_plugin.h
@@ -38,7 +38,7 @@ class NavigationPolygonEditor : public AbstractPolygon2DEditor {
GDCLASS(NavigationPolygonEditor, AbstractPolygon2DEditor);
- NavigationPolygonInstance *node;
+ NavigationRegion2D *node;
Ref _ensure_navpoly() const;
diff --git a/editor/plugins/tile_set_editor_plugin.cpp b/editor/plugins/tile_set_editor_plugin.cpp
index a61b291029..0d5741d84a 100644
--- a/editor/plugins/tile_set_editor_plugin.cpp
+++ b/editor/plugins/tile_set_editor_plugin.cpp
@@ -109,8 +109,8 @@ void TileSetEditor::_import_node(Node *p_node, Ref p_library) {
Node *child2 = mi->get_child(j);
- if (Object::cast_to(child2))
- nav_poly = Object::cast_to(child2)->get_navigation_polygon();
+ if (Object::cast_to(child2))
+ nav_poly = Object::cast_to(child2)->get_navigation_polygon();
if (Object::cast_to(child2))
occluder = Object::cast_to(child2)->get_occluder_polygon();
diff --git a/editor/spatial_editor_gizmos.cpp b/editor/spatial_editor_gizmos.cpp
index 40e1be665c..c155430eae 100644
--- a/editor/spatial_editor_gizmos.cpp
+++ b/editor/spatial_editor_gizmos.cpp
@@ -41,7 +41,7 @@
#include "scene/3d/light.h"
#include "scene/3d/listener.h"
#include "scene/3d/mesh_instance.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/particles.h"
#include "scene/3d/physics_joint.h"
#include "scene/3d/position_3d.h"
@@ -58,11 +58,11 @@
#include "scene/resources/convex_polygon_shape.h"
#include "scene/resources/cylinder_shape.h"
#include "scene/resources/height_map_shape.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/sphere_shape.h"
#include "scene/resources/surface_tool.h"
+#include "scene/resources/world_margin_shape.h"
#define HANDLE_HALF_SIZE 9.5
@@ -3575,9 +3575,9 @@ void CollisionShapeSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
p_gizmo->add_handles(handles, handles_material);
}
- if (Object::cast_to(*s)) {
+ if (Object::cast_to(*s)) {
- Ref ps = s;
+ Ref ps = s;
Plane p = ps->get_plane();
Vector points;
@@ -3720,11 +3720,11 @@ NavigationMeshSpatialGizmoPlugin::NavigationMeshSpatialGizmoPlugin() {
}
bool NavigationMeshSpatialGizmoPlugin::has_gizmo(Spatial *p_spatial) {
- return Object::cast_to(p_spatial) != NULL;
+ return Object::cast_to(p_spatial) != NULL;
}
String NavigationMeshSpatialGizmoPlugin::get_name() const {
- return "NavigationMeshInstance";
+ return "NavigationRegion";
}
int NavigationMeshSpatialGizmoPlugin::get_priority() const {
@@ -3733,7 +3733,7 @@ int NavigationMeshSpatialGizmoPlugin::get_priority() const {
void NavigationMeshSpatialGizmoPlugin::redraw(EditorSpatialGizmo *p_gizmo) {
- NavigationMeshInstance *navmesh = Object::cast_to(p_gizmo->get_spatial_node());
+ NavigationRegion *navmesh = Object::cast_to(p_gizmo->get_spatial_node());
Ref edge_material = get_material("navigation_edge_material", p_gizmo);
Ref edge_material_disabled = get_material("navigation_edge_material_disabled", p_gizmo);
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp
index 43958a9493..0304e8f6dd 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics.cpp
@@ -110,13 +110,13 @@ protected:
PhysicsServer *ps = PhysicsServer::get_singleton();
- RID plane_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE);
- ps->shape_set_data(plane_shape, p_plane);
+ RID world_margin_shape = ps->shape_create(PhysicsServer::SHAPE_PLANE);
+ ps->shape_set_data(world_margin_shape, p_plane);
RID b = ps->body_create(PhysicsServer::BODY_MODE_STATIC);
ps->body_set_space(b, space);
//todo set space
- ps->body_add_shape(b, plane_shape);
+ ps->body_add_shape(b, world_margin_shape);
return b;
}
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
index 28fe0bfd06..4ab90ac7eb 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.cpp
@@ -84,7 +84,7 @@ void NavigationMeshEditor::_clear_pressed() {
}
}
-void NavigationMeshEditor::edit(NavigationMeshInstance *p_nav_mesh_instance) {
+void NavigationMeshEditor::edit(NavigationRegion *p_nav_mesh_instance) {
if (p_nav_mesh_instance == NULL || node == p_nav_mesh_instance) {
return;
@@ -128,12 +128,12 @@ NavigationMeshEditor::~NavigationMeshEditor() {
void NavigationMeshEditorPlugin::edit(Object *p_object) {
- navigation_mesh_editor->edit(Object::cast_to(p_object));
+ navigation_mesh_editor->edit(Object::cast_to(p_object));
}
bool NavigationMeshEditorPlugin::handles(Object *p_object) const {
- return p_object->is_class("NavigationMeshInstance");
+ return p_object->is_class("NavigationRegion");
}
void NavigationMeshEditorPlugin::make_visible(bool p_visible) {
diff --git a/modules/gdnavigation/navigation_mesh_editor_plugin.h b/modules/gdnavigation/navigation_mesh_editor_plugin.h
index f5833f3d7f..7c3faebf57 100644
--- a/modules/gdnavigation/navigation_mesh_editor_plugin.h
+++ b/modules/gdnavigation/navigation_mesh_editor_plugin.h
@@ -36,7 +36,7 @@
#include "editor/editor_node.h"
#include "editor/editor_plugin.h"
-class NavigationMeshInstance;
+class NavigationRegion;
class NavigationMeshEditor : public Control {
friend class NavigationMeshEditorPlugin;
@@ -50,7 +50,7 @@ class NavigationMeshEditor : public Control {
ToolButton *button_reset;
Label *bake_info;
- NavigationMeshInstance *node;
+ NavigationRegion *node;
void _bake_pressed();
void _clear_pressed();
@@ -61,7 +61,7 @@ protected:
void _notification(int p_option);
public:
- void edit(NavigationMeshInstance *p_nav_mesh_instance);
+ void edit(NavigationRegion *p_nav_mesh_instance);
NavigationMeshEditor();
~NavigationMeshEditor();
};
diff --git a/modules/gdnavigation/navigation_mesh_generator.cpp b/modules/gdnavigation/navigation_mesh_generator.cpp
index 7f8761dac8..e7038b38a2 100644
--- a/modules/gdnavigation/navigation_mesh_generator.cpp
+++ b/modules/gdnavigation/navigation_mesh_generator.cpp
@@ -42,10 +42,10 @@
#include "scene/resources/concave_polygon_shape.h"
#include "scene/resources/convex_polygon_shape.h"
#include "scene/resources/cylinder_shape.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/primitive_meshes.h"
#include "scene/resources/shape.h"
#include "scene/resources/sphere_shape.h"
+#include "scene/resources/world_margin_shape.h"
#include "modules/modules_enabled.gen.h"
#ifdef TOOLS_ENABLED
diff --git a/modules/gdnavigation/navigation_mesh_generator.h b/modules/gdnavigation/navigation_mesh_generator.h
index 27a56e1d7a..d1f2e4b56f 100644
--- a/modules/gdnavigation/navigation_mesh_generator.h
+++ b/modules/gdnavigation/navigation_mesh_generator.h
@@ -33,7 +33,7 @@
#ifndef _3D_DISABLED
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include
diff --git a/scene/2d/navigation_polygon.cpp b/scene/2d/navigation_polygon.cpp
index 41f29c4072..8fb9a8427e 100644
--- a/scene/2d/navigation_polygon.cpp
+++ b/scene/2d/navigation_polygon.cpp
@@ -374,7 +374,7 @@ NavigationPolygon::NavigationPolygon() :
NavigationPolygon::~NavigationPolygon() {
}
-void NavigationPolygonInstance::set_enabled(bool p_enabled) {
+void NavigationRegion2D::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
return;
@@ -398,25 +398,25 @@ void NavigationPolygonInstance::set_enabled(bool p_enabled) {
update();
}
-bool NavigationPolygonInstance::is_enabled() const {
+bool NavigationRegion2D::is_enabled() const {
return enabled;
}
/////////////////////////////
#ifdef TOOLS_ENABLED
-Rect2 NavigationPolygonInstance::_edit_get_rect() const {
+Rect2 NavigationRegion2D::_edit_get_rect() const {
return navpoly.is_valid() ? navpoly->_edit_get_rect() : Rect2();
}
-bool NavigationPolygonInstance::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
+bool NavigationRegion2D::_edit_is_selected_on_click(const Point2 &p_point, double p_tolerance) const {
return navpoly.is_valid() ? navpoly->_edit_is_selected_on_click(p_point, p_tolerance) : false;
}
#endif
-void NavigationPolygonInstance::_notification(int p_what) {
+void NavigationRegion2D::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -500,7 +500,7 @@ void NavigationPolygonInstance::_notification(int p_what) {
}
}
-void NavigationPolygonInstance::set_navigation_polygon(const Ref &p_navpoly) {
+void NavigationRegion2D::set_navigation_polygon(const Ref &p_navpoly) {
if (p_navpoly == navpoly) {
return;
@@ -522,18 +522,18 @@ void NavigationPolygonInstance::set_navigation_polygon(const Ref NavigationPolygonInstance::get_navigation_polygon() const {
+Ref NavigationRegion2D::get_navigation_polygon() const {
return navpoly;
}
-void NavigationPolygonInstance::_navpoly_changed() {
+void NavigationRegion2D::_navpoly_changed() {
if (is_inside_tree() && (Engine::get_singleton()->is_editor_hint() || get_tree()->is_debugging_navigation_hint()))
update();
}
-String NavigationPolygonInstance::get_configuration_warning() const {
+String NavigationRegion2D::get_configuration_warning() const {
if (!is_visible_in_tree() || !is_inside_tree())
return String();
@@ -551,24 +551,24 @@ String NavigationPolygonInstance::get_configuration_warning() const {
c = Object::cast_to(c->get_parent());
}
- return TTR("NavigationPolygonInstance must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
+ return TTR("NavigationRegion2D must be a child or grandchild to a Navigation2D node. It only provides navigation data.");
}
-void NavigationPolygonInstance::_bind_methods() {
+void NavigationRegion2D::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationPolygonInstance::set_navigation_polygon);
- ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationPolygonInstance::get_navigation_polygon);
+ ClassDB::bind_method(D_METHOD("set_navigation_polygon", "navpoly"), &NavigationRegion2D::set_navigation_polygon);
+ ClassDB::bind_method(D_METHOD("get_navigation_polygon"), &NavigationRegion2D::get_navigation_polygon);
- ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationPolygonInstance::set_enabled);
- ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationPolygonInstance::is_enabled);
+ ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion2D::set_enabled);
+ ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion2D::is_enabled);
- ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationPolygonInstance::_navpoly_changed);
+ ClassDB::bind_method(D_METHOD("_navpoly_changed"), &NavigationRegion2D::_navpoly_changed);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navpoly", PROPERTY_HINT_RESOURCE_TYPE, "NavigationPolygon"), "set_navigation_polygon", "get_navigation_polygon");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
}
-NavigationPolygonInstance::NavigationPolygonInstance() {
+NavigationRegion2D::NavigationRegion2D() {
enabled = true;
set_notify_transform(true);
@@ -577,6 +577,6 @@ NavigationPolygonInstance::NavigationPolygonInstance() {
navigation = NULL;
}
-NavigationPolygonInstance::~NavigationPolygonInstance() {
+NavigationRegion2D::~NavigationRegion2D() {
Navigation2DServer::get_singleton()->free(region);
}
diff --git a/scene/2d/navigation_polygon.h b/scene/2d/navigation_polygon.h
index 70804358f6..579d6b0e0e 100644
--- a/scene/2d/navigation_polygon.h
+++ b/scene/2d/navigation_polygon.h
@@ -94,9 +94,9 @@ public:
class Navigation2D;
-class NavigationPolygonInstance : public Node2D {
+class NavigationRegion2D : public Node2D {
- GDCLASS(NavigationPolygonInstance, Node2D);
+ GDCLASS(NavigationRegion2D, Node2D);
bool enabled;
RID region;
@@ -123,8 +123,8 @@ public:
String get_configuration_warning() const;
- NavigationPolygonInstance();
- ~NavigationPolygonInstance();
+ NavigationRegion2D();
+ ~NavigationRegion2D();
};
#endif // NAVIGATIONPOLYGON_H
diff --git a/scene/3d/collision_shape.cpp b/scene/3d/collision_shape.cpp
index d0d775d557..c7a92b66e1 100644
--- a/scene/3d/collision_shape.cpp
+++ b/scene/3d/collision_shape.cpp
@@ -33,9 +33,9 @@
#include "scene/resources/capsule_shape.h"
#include "scene/resources/concave_polygon_shape.h"
#include "scene/resources/convex_polygon_shape.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/ray_shape.h"
#include "scene/resources/sphere_shape.h"
+#include "scene/resources/world_margin_shape.h"
#include "servers/visual_server.h"
//TODO: Implement CylinderShape and HeightMapShape?
#include "core/math/quick_hull.h"
@@ -123,10 +123,6 @@ String CollisionShape::get_configuration_warning() const {
return TTR("A shape must be provided for CollisionShape to function. Please create a shape resource for it.");
}
- if (shape->is_class("PlaneShape")) {
- return TTR("Plane shapes don't work well and will be removed in future versions. Please don't use them.");
- }
-
return String();
}
diff --git a/scene/3d/navigation.h b/scene/3d/navigation.h
index 85887651ff..08f306611f 100644
--- a/scene/3d/navigation.h
+++ b/scene/3d/navigation.h
@@ -31,7 +31,7 @@
#ifndef NAVIGATION_H
#define NAVIGATION_H
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/spatial.h"
class Navigation : public Spatial {
diff --git a/scene/3d/navigation_mesh_instance.cpp b/scene/3d/navigation_region.cpp
similarity index 84%
rename from scene/3d/navigation_mesh_instance.cpp
rename to scene/3d/navigation_region.cpp
index 8f8574ba2d..d96d095797 100644
--- a/scene/3d/navigation_mesh_instance.cpp
+++ b/scene/3d/navigation_region.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* navigation_mesh_instance.cpp */
+/* navigation_region.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,13 +28,13 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "navigation_mesh_instance.h"
+#include "navigation_region.h"
#include "core/os/thread.h"
#include "mesh_instance.h"
#include "navigation.h"
#include "servers/navigation_server.h"
-void NavigationMeshInstance::set_enabled(bool p_enabled) {
+void NavigationRegion::set_enabled(bool p_enabled) {
if (enabled == p_enabled)
return;
@@ -66,14 +66,14 @@ void NavigationMeshInstance::set_enabled(bool p_enabled) {
update_gizmo();
}
-bool NavigationMeshInstance::is_enabled() const {
+bool NavigationRegion::is_enabled() const {
return enabled;
}
/////////////////////////////
-void NavigationMeshInstance::_notification(int p_what) {
+void NavigationRegion::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
@@ -129,7 +129,7 @@ void NavigationMeshInstance::_notification(int p_what) {
}
}
-void NavigationMeshInstance::set_navigation_mesh(const Ref &p_navmesh) {
+void NavigationRegion::set_navigation_mesh(const Ref &p_navmesh) {
if (p_navmesh == navmesh)
return;
@@ -156,13 +156,13 @@ void NavigationMeshInstance::set_navigation_mesh(const Ref &p_na
update_configuration_warning();
}
-Ref NavigationMeshInstance::get_navigation_mesh() const {
+Ref NavigationRegion::get_navigation_mesh() const {
return navmesh;
}
struct BakeThreadsArgs {
- NavigationMeshInstance *nav_mesh_instance;
+ NavigationRegion *nav_mesh_instance;
};
void _bake_navigation_mesh(void *p_user_data) {
@@ -182,7 +182,7 @@ void _bake_navigation_mesh(void *p_user_data) {
}
}
-void NavigationMeshInstance::bake_navigation_mesh() {
+void NavigationRegion::bake_navigation_mesh() {
ERR_FAIL_COND(bake_thread != NULL);
BakeThreadsArgs *args = memnew(BakeThreadsArgs);
@@ -192,12 +192,12 @@ void NavigationMeshInstance::bake_navigation_mesh() {
ERR_FAIL_COND(bake_thread == NULL);
}
-void NavigationMeshInstance::_bake_finished(Ref p_nav_mesh) {
+void NavigationRegion::_bake_finished(Ref p_nav_mesh) {
set_navigation_mesh(p_nav_mesh);
bake_thread = NULL;
}
-String NavigationMeshInstance::get_configuration_warning() const {
+String NavigationRegion::get_configuration_warning() const {
if (!is_visible_in_tree() || !is_inside_tree())
return String();
@@ -214,19 +214,19 @@ String NavigationMeshInstance::get_configuration_warning() const {
c = Object::cast_to(c->get_parent());
}
- return TTR("NavigationMeshInstance must be a child or grandchild to a Navigation node. It only provides navigation data.");
+ return TTR("NavigationRegion must be a child or grandchild to a Navigation node. It only provides navigation data.");
}
-void NavigationMeshInstance::_bind_methods() {
+void NavigationRegion::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationMeshInstance::set_navigation_mesh);
- ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationMeshInstance::get_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("set_navigation_mesh", "navmesh"), &NavigationRegion::set_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("get_navigation_mesh"), &NavigationRegion::get_navigation_mesh);
- ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationMeshInstance::set_enabled);
- ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationMeshInstance::is_enabled);
+ ClassDB::bind_method(D_METHOD("set_enabled", "enabled"), &NavigationRegion::set_enabled);
+ ClassDB::bind_method(D_METHOD("is_enabled"), &NavigationRegion::is_enabled);
- ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationMeshInstance::bake_navigation_mesh);
- ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationMeshInstance::_bake_finished);
+ ClassDB::bind_method(D_METHOD("bake_navigation_mesh"), &NavigationRegion::bake_navigation_mesh);
+ ClassDB::bind_method(D_METHOD("_bake_finished", "nav_mesh"), &NavigationRegion::_bake_finished);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "navmesh", PROPERTY_HINT_RESOURCE_TYPE, "NavigationMesh"), "set_navigation_mesh", "get_navigation_mesh");
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "enabled"), "set_enabled", "is_enabled");
@@ -235,12 +235,12 @@ void NavigationMeshInstance::_bind_methods() {
ADD_SIGNAL(MethodInfo("bake_finished"));
}
-void NavigationMeshInstance::_changed_callback(Object *p_changed, const char *p_prop) {
+void NavigationRegion::_changed_callback(Object *p_changed, const char *p_prop) {
update_gizmo();
update_configuration_warning();
}
-NavigationMeshInstance::NavigationMeshInstance() {
+NavigationRegion::NavigationRegion() {
enabled = true;
set_notify_transform(true);
@@ -251,7 +251,7 @@ NavigationMeshInstance::NavigationMeshInstance() {
bake_thread = NULL;
}
-NavigationMeshInstance::~NavigationMeshInstance() {
+NavigationRegion::~NavigationRegion() {
if (navmesh.is_valid())
navmesh->remove_change_receptor(this);
NavigationServer::get_singleton()->free(region);
diff --git a/scene/3d/navigation_mesh_instance.h b/scene/3d/navigation_region.h
similarity index 90%
rename from scene/3d/navigation_mesh_instance.h
rename to scene/3d/navigation_region.h
index 1135bf47d2..f215e92c97 100644
--- a/scene/3d/navigation_mesh_instance.h
+++ b/scene/3d/navigation_region.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* navigation_mesh_instance.h */
+/* navigation_region.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef NAVIGATION_MESH_INSTANCE_H
-#define NAVIGATION_MESH_INSTANCE_H
+#ifndef NAVIGATION_REGION_H
+#define NAVIGATION_REGION_H
#include "scene/3d/spatial.h"
#include "scene/resources/mesh.h"
@@ -37,9 +37,9 @@
class Navigation;
-class NavigationMeshInstance : public Spatial {
+class NavigationRegion : public Spatial {
- GDCLASS(NavigationMeshInstance, Spatial);
+ GDCLASS(NavigationRegion, Spatial);
bool enabled;
RID region;
@@ -68,8 +68,8 @@ public:
String get_configuration_warning() const;
- NavigationMeshInstance();
- ~NavigationMeshInstance();
+ NavigationRegion();
+ ~NavigationRegion();
};
-#endif // NAVIGATION_MESH_INSTANCE_H
+#endif // NAVIGATION_REGION_H
diff --git a/scene/register_scene_types.cpp b/scene/register_scene_types.cpp
index 6288598ce2..dd00565929 100644
--- a/scene/register_scene_types.cpp
+++ b/scene/register_scene_types.cpp
@@ -151,7 +151,6 @@
#include "scene/resources/packed_scene.h"
#include "scene/resources/particles_material.h"
#include "scene/resources/physics_material.h"
-#include "scene/resources/plane_shape.h"
#include "scene/resources/polygon_path_finder.h"
#include "scene/resources/primitive_meshes.h"
#include "scene/resources/ray_shape.h"
@@ -169,6 +168,7 @@
#include "scene/resources/visual_shader_nodes.h"
#include "scene/resources/world.h"
#include "scene/resources/world_2d.h"
+#include "scene/resources/world_margin_shape.h"
#include "scene/scene_string_names.h"
#ifndef _3D_DISABLED
@@ -190,8 +190,8 @@
#include "scene/3d/multimesh_instance.h"
#include "scene/3d/navigation.h"
#include "scene/3d/navigation_agent.h"
-#include "scene/3d/navigation_mesh_instance.h"
#include "scene/3d/navigation_obstacle.h"
+#include "scene/3d/navigation_region.h"
#include "scene/3d/particles.h"
#include "scene/3d/path.h"
#include "scene/3d/physics_body.h"
@@ -470,7 +470,7 @@ void register_scene_types() {
ClassDB::register_class();
ClassDB::register_class();
- ClassDB::register_class();
+ ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
@@ -643,7 +643,7 @@ void register_scene_types() {
ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
- ClassDB::register_class();
+ ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
@@ -726,7 +726,7 @@ void register_scene_types() {
ClassDB::register_class();
ClassDB::register_class();
- ClassDB::register_class();
+ ClassDB::register_class();
ClassDB::register_class();
ClassDB::register_class();
@@ -746,6 +746,9 @@ void register_scene_types() {
ClassDB::add_compatibility_class("VisualShaderNodeScalarUniform", "VisualShaderNodeFloatUniform");
ClassDB::add_compatibility_class("VisualShaderNodeScalarOp", "VisualShaderNodeFloatOp");
ClassDB::add_compatibility_class("VisualShaderNodeScalarFunc", "VisualShaderNodeFloatFunc");
+ ClassDB::add_compatibility_class("NavigationMeshInstance", "NavigationRegion");
+ ClassDB::add_compatibility_class("NavigationPolygonInstance", "NavigationRegion2D");
+ ClassDB::add_compatibility_class("PlaneShape", "WorldMarginShape");
#endif
OS::get_singleton()->yield(); //may take time to init
diff --git a/scene/resources/mesh_library.h b/scene/resources/mesh_library.h
index 9155975f47..b256e86b96 100644
--- a/scene/resources/mesh_library.h
+++ b/scene/resources/mesh_library.h
@@ -34,7 +34,7 @@
#include "core/map.h"
#include "core/resource.h"
#include "mesh.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
#include "shape.h"
class MeshLibrary : public Resource {
diff --git a/scene/resources/plane_shape.cpp b/scene/resources/world_margin_shape.cpp
similarity index 86%
rename from scene/resources/plane_shape.cpp
rename to scene/resources/world_margin_shape.cpp
index ddc820233e..b5b701327c 100644
--- a/scene/resources/plane_shape.cpp
+++ b/scene/resources/world_margin_shape.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* plane_shape.cpp */
+/* world_margin_shape.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,11 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "plane_shape.h"
+#include "world_margin_shape.h"
#include "servers/physics_server.h"
-Vector PlaneShape::get_debug_mesh_lines() {
+Vector WorldMarginShape::get_debug_mesh_lines() {
Plane p = get_plane();
Vector points;
@@ -61,13 +61,13 @@ Vector PlaneShape::get_debug_mesh_lines() {
return points;
}
-void PlaneShape::_update_shape() {
+void WorldMarginShape::_update_shape() {
PhysicsServer::get_singleton()->shape_set_data(get_shape(), plane);
Shape::_update_shape();
}
-void PlaneShape::set_plane(Plane p_plane) {
+void WorldMarginShape::set_plane(Plane p_plane) {
plane = p_plane;
_update_shape();
@@ -75,20 +75,20 @@ void PlaneShape::set_plane(Plane p_plane) {
_change_notify("plane");
}
-Plane PlaneShape::get_plane() const {
+Plane WorldMarginShape::get_plane() const {
return plane;
}
-void PlaneShape::_bind_methods() {
+void WorldMarginShape::_bind_methods() {
- ClassDB::bind_method(D_METHOD("set_plane", "plane"), &PlaneShape::set_plane);
- ClassDB::bind_method(D_METHOD("get_plane"), &PlaneShape::get_plane);
+ ClassDB::bind_method(D_METHOD("set_plane", "plane"), &WorldMarginShape::set_plane);
+ ClassDB::bind_method(D_METHOD("get_plane"), &WorldMarginShape::get_plane);
ADD_PROPERTY(PropertyInfo(Variant::PLANE, "plane"), "set_plane", "get_plane");
}
-PlaneShape::PlaneShape() :
+WorldMarginShape::WorldMarginShape() :
Shape(PhysicsServer::get_singleton()->shape_create(PhysicsServer::SHAPE_PLANE)) {
set_plane(Plane(0, 1, 0, 0));
diff --git a/scene/resources/plane_shape.h b/scene/resources/world_margin_shape.h
similarity index 90%
rename from scene/resources/plane_shape.h
rename to scene/resources/world_margin_shape.h
index 360f9dbbe9..78ea570212 100644
--- a/scene/resources/plane_shape.h
+++ b/scene/resources/world_margin_shape.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* plane_shape.h */
+/* world_margin_shape.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,14 +28,14 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PLANE_SHAPE_H
-#define PLANE_SHAPE_H
+#ifndef WORLD_MARGIN_SHAPE_H
+#define WORLD_MARGIN_SHAPE_H
#include "scene/resources/shape.h"
-class PlaneShape : public Shape {
+class WorldMarginShape : public Shape {
- GDCLASS(PlaneShape, Shape);
+ GDCLASS(WorldMarginShape, Shape);
Plane plane;
protected:
@@ -52,6 +52,6 @@ public:
return 0;
}
- PlaneShape();
+ WorldMarginShape();
};
-#endif // PLANE_SHAPE_H
+#endif // WORLD_MARGIN_SHAPE_H
diff --git a/servers/navigation_server.h b/servers/navigation_server.h
index 2587e53ab2..7c9b6ba595 100644
--- a/servers/navigation_server.h
+++ b/servers/navigation_server.h
@@ -37,7 +37,7 @@
#include "core/object.h"
#include "core/rid.h"
-#include "scene/3d/navigation_mesh_instance.h"
+#include "scene/3d/navigation_region.h"
/// This server uses the concept of internal mutability.
/// All the constant functions can be called in multithread because internally
]