| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
#include "scene/3d/node_3d.h" |
| 34 |
#include "scene/resources/navigation_mesh.h" |
| 35 |
|
| 36 |
class NavigationRegion3D : public Node3D { |
| 37 |
GDCLASS(NavigationRegion3D, Node3D); |
| 38 |
|
| 39 |
bool enabled = true; |
| 40 |
bool use_edge_connections = true; |
| 41 |
|
| 42 |
RID region; |
| 43 |
RID map_override; |
| 44 |
uint32_t navigation_layers = 1; |
| 45 |
real_t enter_cost = 0.0; |
| 46 |
real_t travel_cost = 1.0; |
| 47 |
Ref<NavigationMesh> navigation_mesh; |
| 48 |
|
| 49 |
Transform3D current_global_transform; |
| 50 |
|
| 51 |
void _navigation_mesh_changed(); |
| 52 |
|
| 53 |
AABB bounds; |
| 54 |
|
| 55 |
#ifdef DEBUG_ENABLED |
| 56 |
RID debug_instance; |
| 57 |
RID debug_edge_connections_instance; |
| 58 |
Ref<ArrayMesh> debug_mesh; |
| 59 |
Ref<ArrayMesh> debug_edge_connections_mesh; |
| 60 |
|
| 61 |
private: |
| 62 |
void _update_debug_mesh(); |
| 63 |
void _update_debug_edge_connections_mesh(); |
| 64 |
void _navigation_map_changed(RID p_map); |
| 65 |
void _navigation_debug_changed(); |
| 66 |
#endif |
| 67 |
|
| 68 |
protected: |
| 69 |
void _notification(int p_what); |
| 70 |
static void _bind_methods(); |
| 71 |
|
| 72 |
#ifndef DISABLE_DEPRECATED |
| 73 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 74 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 75 |
#endif |
| 76 |
|
| 77 |
public: |
| 78 |
RID get_rid() const; |
| 79 |
|
| 80 |
void set_enabled(bool p_enabled); |
| 81 |
bool is_enabled() const; |
| 82 |
|
| 83 |
void set_navigation_map(RID p_navigation_map); |
| 84 |
RID get_navigation_map() const; |
| 85 |
|
| 86 |
void set_use_edge_connections(bool p_enabled); |
| 87 |
bool get_use_edge_connections() const; |
| 88 |
|
| 89 |
void set_navigation_layers(uint32_t p_navigation_layers); |
| 90 |
uint32_t get_navigation_layers() const; |
| 91 |
|
| 92 |
void set_navigation_layer_value(int p_layer_number, bool p_value); |
| 93 |
bool get_navigation_layer_value(int p_layer_number) const; |
| 94 |
|
| 95 |
RID get_region_rid() const; |
| 96 |
|
| 97 |
void set_enter_cost(real_t p_enter_cost); |
| 98 |
real_t get_enter_cost() const; |
| 99 |
|
| 100 |
void set_travel_cost(real_t p_travel_cost); |
| 101 |
real_t get_travel_cost() const; |
| 102 |
|
| 103 |
void set_navigation_mesh(const Ref<NavigationMesh> &p_navigation_mesh); |
| 104 |
Ref<NavigationMesh> get_navigation_mesh() const; |
| 105 |
|
| 106 |
|
| 107 |
|
| 108 |
void bake_navigation_mesh(bool p_on_thread); |
| 109 |
void _bake_finished(); |
| 110 |
bool is_baking() const; |
| 111 |
|
| 112 |
PackedStringArray get_configuration_warnings() const override; |
| 113 |
|
| 114 |
AABB get_bounds() const { return bounds; } |
| 115 |
|
| 116 |
NavigationRegion3D(); |
| 117 |
~NavigationRegion3D(); |
| 118 |
|
| 119 |
private: |
| 120 |
void _update_bounds(); |
| 121 |
void _region_enter_navigation_map(); |
| 122 |
void _region_exit_navigation_map(); |
| 123 |
void _region_update_transform(); |
| 124 |
}; |