Debian Codegraph @

modules/navigation_3d/nav_obstacle_3d.h

raw symbols SCIP
1 /**************************************************************************/
2 /* nav_obstacle_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 #pragma once
32
33 #include "nav_rid_3d.h"
34
35 #include "core/object/class_db.h"
36 #include "core/templates/self_list.h"
37
38 class NavAgent3D;
39 class NavMap3D;
40
41 class NavObstacle3D : public NavRid3D {
42 NavAgent3D *agent = nullptr;
43 NavMap3D *map = nullptr;
44 Vector3 velocity;
45 Vector3 position;
46 Vector<Vector3> vertices;
47
48 real_t radius = 0.0;
49 real_t height = 0.0;
50
51 bool avoidance_enabled = false;
52 bool use_3d_avoidance = false;
53 uint32_t avoidance_layers = 1;
54
55 bool obstacle_dirty = true;
56
57 uint32_t last_map_iteration_id = 0;
58 bool paused = false;
59
60 SelfList<NavObstacle3D> sync_dirty_request_list_element;
61
62 public:
63 NavObstacle3D();
64 ~NavObstacle3D();
65
66 void set_avoidance_enabled(bool p_enabled);
67 bool is_avoidance_enabled() { return avoidance_enabled; }
68
69 void set_use_3d_avoidance(bool p_enabled);
70 bool get_use_3d_avoidance() { return use_3d_avoidance; }
71
72 void set_map(NavMap3D *p_map);
73 NavMap3D *get_map() { return map; }
74
75 void set_agent(NavAgent3D *p_agent);
76 NavAgent3D *get_agent() { return agent; }
77
78 void set_position(const Vector3 p_position);
79 const Vector3 &get_position() const { return position; }
80
81 void set_radius(real_t p_radius);
82 real_t get_radius() const { return radius; }
83
84 void set_height(const real_t p_height);
85 real_t get_height() const { return height; }
86
87 void set_velocity(const Vector3 p_velocity);
88 const Vector3 &get_velocity() const { return velocity; }
89
90 void set_vertices(const Vector<Vector3> &p_vertices);
91 const Vector<Vector3> &get_vertices() const { return vertices; }
92
93 bool is_map_changed();
94
95 void set_avoidance_layers(uint32_t p_layers);
96 uint32_t get_avoidance_layers() const { return avoidance_layers; }
97
98 void set_paused(bool p_paused);
99 bool get_paused() const;
100
101 bool is_dirty() const;
102 void sync();
103 void request_sync();
104 void cancel_sync_request();
105
106 private:
107 void internal_update_agent();
108 };