1 | /**************************************************************************/ |
2 | /* navigation_link_3d.h */ |
3 | /**************************************************************************/ |
4 | /* This file is part of: */ |
5 | /* GODOT ENGINE */ |
6 | /* https://godotengine.org */ |
7 | /**************************************************************************/ |
8 | /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ |
9 | /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ |
10 | /* */ |
11 | /* Permission is hereby granted, free of charge, to any person obtaining */ |
12 | /* a copy of this software and associated documentation files (the */ |
13 | /* "Software"), to deal in the Software without restriction, including */ |
14 | /* without limitation the rights to use, copy, modify, merge, publish, */ |
15 | /* distribute, sublicense, and/or sell copies of the Software, and to */ |
16 | /* permit persons to whom the Software is furnished to do so, subject to */ |
17 | /* the following conditions: */ |
18 | /* */ |
19 | /* The above copyright notice and this permission notice shall be */ |
20 | /* included in all copies or substantial portions of the Software. */ |
21 | /* */ |
22 | /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */ |
23 | /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ |
24 | /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ |
25 | /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ |
26 | /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */ |
27 | /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ |
28 | /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ |
29 | /**************************************************************************/ |
30 | |
31 | #ifndef NAVIGATION_LINK_3D_H |
32 | #define NAVIGATION_LINK_3D_H |
33 | |
34 | #include "scene/3d/node_3d.h" |
35 | |
36 | class NavigationLink3D : public Node3D { |
37 | GDCLASS(NavigationLink3D, Node3D); |
38 | |
39 | bool enabled = true; |
40 | RID link; |
41 | bool bidirectional = true; |
42 | uint32_t navigation_layers = 1; |
43 | Vector3 end_position; |
44 | Vector3 start_position; |
45 | real_t enter_cost = 0.0; |
46 | real_t travel_cost = 1.0; |
47 | |
48 | Transform3D current_global_transform; |
49 | |
50 | #ifdef DEBUG_ENABLED |
51 | RID debug_instance; |
52 | Ref<ArrayMesh> debug_mesh; |
53 | |
54 | void _update_debug_mesh(); |
55 | #endif // DEBUG_ENABLED |
56 | |
57 | protected: |
58 | static void _bind_methods(); |
59 | void _notification(int p_what); |
60 | |
61 | #ifndef DISABLE_DEPRECATED |
62 | bool _set(const StringName &p_name, const Variant &p_value); |
63 | bool _get(const StringName &p_name, Variant &r_ret) const; |
64 | #endif // DISABLE_DEPRECATED |
65 | |
66 | public: |
67 | NavigationLink3D(); |
68 | ~NavigationLink3D(); |
69 | |
70 | void set_enabled(bool p_enabled); |
71 | bool is_enabled() const { return enabled; } |
72 | |
73 | void set_bidirectional(bool p_bidirectional); |
74 | bool is_bidirectional() const { return bidirectional; } |
75 | |
76 | void set_navigation_layers(uint32_t p_navigation_layers); |
77 | uint32_t get_navigation_layers() const { return navigation_layers; } |
78 | |
79 | void set_navigation_layer_value(int p_layer_number, bool p_value); |
80 | bool get_navigation_layer_value(int p_layer_number) const; |
81 | |
82 | void set_start_position(Vector3 p_position); |
83 | Vector3 get_start_position() const { return start_position; } |
84 | |
85 | void set_end_position(Vector3 p_position); |
86 | Vector3 get_end_position() const { return end_position; } |
87 | |
88 | void set_global_start_position(Vector3 p_position); |
89 | Vector3 get_global_start_position() const; |
90 | |
91 | void set_global_end_position(Vector3 p_position); |
92 | Vector3 get_global_end_position() const; |
93 | |
94 | void set_enter_cost(real_t p_enter_cost); |
95 | real_t get_enter_cost() const { return enter_cost; } |
96 | |
97 | void set_travel_cost(real_t p_travel_cost); |
98 | real_t get_travel_cost() const { return travel_cost; } |
99 | |
100 | PackedStringArray get_configuration_warnings() const override; |
101 | }; |
102 | |
103 | #endif // NAVIGATION_LINK_3D_H |
104 | |