|
@@ -35,6 +35,7 @@
|
|
|
#include "scene/3d/camera.h"
|
|
|
#include "scene/3d/visibility_notifier.h"
|
|
|
#include "scene/scene_string_names.h"
|
|
|
+#include "servers/navigation_server.h"
|
|
|
|
|
|
struct SpatialIndexer {
|
|
|
Octree<VisibilityNotifier> octree;
|
|
@@ -245,6 +246,10 @@ RID World::get_scenario() const {
|
|
|
return scenario;
|
|
|
}
|
|
|
|
|
|
+RID World::get_navigation_map() const {
|
|
|
+ return navigation_map;
|
|
|
+}
|
|
|
+
|
|
|
void World::set_environment(const Ref<Environment> &p_environment) {
|
|
|
if (environment == p_environment) {
|
|
|
return;
|
|
@@ -296,6 +301,7 @@ void World::get_camera_list(List<Camera *> *r_cameras) {
|
|
|
void World::_bind_methods() {
|
|
|
ClassDB::bind_method(D_METHOD("get_space"), &World::get_space);
|
|
|
ClassDB::bind_method(D_METHOD("get_scenario"), &World::get_scenario);
|
|
|
+ ClassDB::bind_method(D_METHOD("get_navigation_map"), &World::get_navigation_map);
|
|
|
ClassDB::bind_method(D_METHOD("set_environment", "env"), &World::set_environment);
|
|
|
ClassDB::bind_method(D_METHOD("get_environment"), &World::get_environment);
|
|
|
ClassDB::bind_method(D_METHOD("set_fallback_environment", "env"), &World::set_fallback_environment);
|
|
@@ -305,6 +311,7 @@ void World::_bind_methods() {
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "fallback_environment", PROPERTY_HINT_RESOURCE_TYPE, "Environment"), "set_fallback_environment", "get_fallback_environment");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::_RID, "space", PROPERTY_HINT_NONE, "", 0), "", "get_space");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::_RID, "scenario", PROPERTY_HINT_NONE, "", 0), "", "get_scenario");
|
|
|
+ ADD_PROPERTY(PropertyInfo(Variant::_RID, "navigation_map", PROPERTY_HINT_NONE, "", 0), "", "get_navigation_map");
|
|
|
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "direct_space_state", PROPERTY_HINT_RESOURCE_TYPE, "PhysicsDirectSpaceState", 0), "", "get_direct_space_state");
|
|
|
}
|
|
|
|
|
@@ -320,6 +327,11 @@ World::World() {
|
|
|
PhysicsServer::get_singleton()->area_set_param(space, PhysicsServer::AREA_PARAM_ANGULAR_DAMP, GLOBAL_DEF("physics/3d/default_angular_damp", 0.1));
|
|
|
ProjectSettings::get_singleton()->set_custom_property_info("physics/3d/default_angular_damp", PropertyInfo(Variant::REAL, "physics/3d/default_angular_damp", PROPERTY_HINT_RANGE, "-1,100,0.001,or_greater"));
|
|
|
|
|
|
+ navigation_map = NavigationServer::get_singleton()->map_create();
|
|
|
+ NavigationServer::get_singleton()->map_set_active(navigation_map, true);
|
|
|
+ NavigationServer::get_singleton()->map_set_cell_size(navigation_map, GLOBAL_DEF("navigation/3d/default_cell_size", 0.25));
|
|
|
+ NavigationServer::get_singleton()->map_set_edge_connection_margin(navigation_map, GLOBAL_DEF("navigation/3d/default_edge_connection_margin", 0.25));
|
|
|
+
|
|
|
#ifdef _3D_DISABLED
|
|
|
indexer = NULL;
|
|
|
#else
|
|
@@ -330,6 +342,7 @@ World::World() {
|
|
|
World::~World() {
|
|
|
PhysicsServer::get_singleton()->free(space);
|
|
|
VisualServer::get_singleton()->free(scenario);
|
|
|
+ NavigationServer::get_singleton()->free(navigation_map);
|
|
|
|
|
|
#ifndef _3D_DISABLED
|
|
|
memdelete(indexer);
|