Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/servers/navigation_3d/navigation_path_query_parameters_3d.h
11322 views
1
/**************************************************************************/
2
/* navigation_path_query_parameters_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 "core/object/ref_counted.h"
34
#include "servers/navigation_3d/navigation_constants_3d.h"
35
36
class NavigationPathQueryParameters3D : public RefCounted {
37
GDCLASS(NavigationPathQueryParameters3D, RefCounted);
38
39
protected:
40
static void _bind_methods();
41
42
public:
43
enum PathfindingAlgorithm {
44
PATHFINDING_ALGORITHM_ASTAR = NavigationEnums3D::PATHFINDING_ALGORITHM_ASTAR,
45
};
46
47
enum PathPostProcessing {
48
PATH_POSTPROCESSING_CORRIDORFUNNEL = NavigationEnums3D::PATH_POSTPROCESSING_CORRIDORFUNNEL,
49
PATH_POSTPROCESSING_EDGECENTERED = NavigationEnums3D::PATH_POSTPROCESSING_EDGECENTERED,
50
PATH_POSTPROCESSING_NONE = NavigationEnums3D::PATH_POSTPROCESSING_NONE,
51
};
52
53
enum PathMetadataFlags {
54
PATH_METADATA_INCLUDE_NONE = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_NONE,
55
PATH_METADATA_INCLUDE_TYPES = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_TYPES,
56
PATH_METADATA_INCLUDE_RIDS = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_RIDS,
57
PATH_METADATA_INCLUDE_OWNERS = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_OWNERS,
58
PATH_METADATA_INCLUDE_ALL = NavigationEnums3D::PathMetadataFlags::PATH_INCLUDE_ALL
59
};
60
61
private:
62
PathfindingAlgorithm pathfinding_algorithm = PATHFINDING_ALGORITHM_ASTAR;
63
PathPostProcessing path_postprocessing = PATH_POSTPROCESSING_CORRIDORFUNNEL;
64
RID map;
65
Vector3 start_position;
66
Vector3 target_position;
67
uint32_t navigation_layers = 1;
68
BitField<PathMetadataFlags> metadata_flags = PATH_METADATA_INCLUDE_ALL;
69
bool simplify_path = false;
70
real_t simplify_epsilon = 0.0;
71
72
LocalVector<RID> _excluded_regions;
73
LocalVector<RID> _included_regions;
74
75
float path_return_max_length = 0.0;
76
float path_return_max_radius = 0.0;
77
int path_search_max_polygons = NavigationDefaults3D::path_search_max_polygons;
78
float path_search_max_distance = 0.0;
79
80
public:
81
void set_pathfinding_algorithm(const PathfindingAlgorithm p_pathfinding_algorithm);
82
PathfindingAlgorithm get_pathfinding_algorithm() const;
83
84
void set_path_postprocessing(const PathPostProcessing p_path_postprocessing);
85
PathPostProcessing get_path_postprocessing() const;
86
87
void set_map(RID p_map);
88
RID get_map() const;
89
90
void set_start_position(Vector3 p_start_position);
91
Vector3 get_start_position() const;
92
93
void set_target_position(Vector3 p_target_position);
94
Vector3 get_target_position() const;
95
96
void set_navigation_layers(uint32_t p_navigation_layers);
97
uint32_t get_navigation_layers() const;
98
99
void set_metadata_flags(BitField<NavigationPathQueryParameters3D::PathMetadataFlags> p_flags);
100
BitField<NavigationPathQueryParameters3D::PathMetadataFlags> get_metadata_flags() const;
101
102
void set_simplify_path(bool p_enabled);
103
bool get_simplify_path() const;
104
105
void set_simplify_epsilon(real_t p_epsilon);
106
real_t get_simplify_epsilon() const;
107
108
void set_excluded_regions(const TypedArray<RID> &p_regions);
109
TypedArray<RID> get_excluded_regions() const;
110
111
void set_included_regions(const TypedArray<RID> &p_regions);
112
TypedArray<RID> get_included_regions() const;
113
114
void set_path_return_max_length(float p_length);
115
float get_path_return_max_length() const;
116
117
void set_path_return_max_radius(float p_radius);
118
float get_path_return_max_radius() const;
119
120
void set_path_search_max_polygons(int p_max_polygons);
121
int get_path_search_max_polygons() const;
122
123
void set_path_search_max_distance(float p_distance);
124
float get_path_search_max_distance() const;
125
};
126
127
VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathfindingAlgorithm);
128
VARIANT_ENUM_CAST(NavigationPathQueryParameters3D::PathPostProcessing);
129
VARIANT_BITFIELD_CAST(NavigationPathQueryParameters3D::PathMetadataFlags);
130
131