Nebula
Loading...
Searching...
No Matches
navquery.h
Go to the documentation of this file.
1#pragma once
2//------------------------------------------------------------------------------
19//------------------------------------------------------------------------------
20#include "math/point.h"
21#include "math/vec3.h"
22#include "util/array.h"
24
25namespace NavigationFeature
26{
27
29{
31 float areaCost[64];
33 uint16_t includeFlags = 0xffff;
35 uint16_t excludeFlags = 0;
36};
37
38enum class PathStatus
39{
49 Failed
50};
51
64
68bool SetAreaCost(QueryFilter& filter, const Util::String& area, float cost);
69
73bool FindNearestPoint(Navigation::NavMeshId navMesh, const Math::point& position, const Math::vec3& extents, Math::point& outPoint, const QueryFilter* filter = nullptr);
75NavPath FindPath(Navigation::NavMeshId navMesh, const Math::point& start, const Math::point& end, const QueryFilter* filter = nullptr);
77bool Raycast(Navigation::NavMeshId navMesh, const Math::point& start, const Math::point& end, Math::point& outHit, const QueryFilter* filter = nullptr);
79bool RandomPoint(Navigation::NavMeshId navMesh, Math::point& outPoint, const QueryFilter* filter = nullptr);
81bool RandomPointAround(Navigation::NavMeshId navMesh, const Math::point& center, float radius, Math::point& outPoint, const QueryFilter* filter = nullptr);
82
83} // namespace NavigationFeature
Nebula's dynamic array class.
Definition array.h:61
Nebula's universal string class.
Definition string.h:50
Queries on a loaded navmesh.
Definition agentmanager.cc:30
bool SetAreaCost(QueryFilter &filter, const Util::String &area, float cost)
set the cost of an area by name, false if the area table has no such area
Definition navquery.cc:48
bool FindNearestPoint(Navigation::NavMeshId navMesh, const Math::point &position, const Math::vec3 &extents, Math::point &outPoint, const QueryFilter *filter)
the point on the surface closest to a position, within the extents around it. Returns false if there ...
Definition navquery.cc:131
bool RandomPoint(Navigation::NavMeshId navMesh, Math::point &outPoint, const QueryFilter *filter)
a random point on the surface, every area of surface is as likely. Returns false if the navmesh has n...
Definition navquery.cc:287
bool RandomPointAround(Navigation::NavMeshId navMesh, const Math::point &center, float radius, Math::point &outPoint, const QueryFilter *filter)
a random point on the surface which is connected to the center, on a polygon the circle touches,...
Definition navquery.cc:310
PathStatus
Definition navquery.h:39
@ Partial
the end can't be reached, the path ends at the point closest to it
Definition navquery.h:43
@ Found
the path reaches the end
Definition navquery.h:41
@ NoEnd
there is no navmesh surface near the end
Definition navquery.h:47
@ Failed
the navmesh isn't loaded, or the search failed
Definition navquery.h:49
@ NoStart
there is no navmesh surface near the start
Definition navquery.h:45
Math::vec3 SearchExtents(Navigation::NavMeshId navMesh)
half the size of the box points are looked for in, from the agent kind of the navmesh
Definition navquery.cc:102
bool Raycast(Navigation::NavMeshId navMesh, const Math::point &start, const Math::point &end, Math::point &outHit, const QueryFilter *filter)
walk along the surface from start towards end. Returns true and the point where it is blocked if an e...
Definition navquery.cc:231
NavPath FindPath(Navigation::NavMeshId navMesh, const Math::point &start, const Math::point &end, const QueryFilter *filter)
a path between two positions, which are moved to the closest surface within the search extents first
Definition navquery.cc:154
QueryFilter DefaultQueryFilter()
a filter with the area costs of the area table, every flag included
Definition navquery.cc:30
Represents a 3D point in space.
Definition point.h:22
A 3D vector.
Definition vec3.h:37
Definition streamnavmeshcache.h:36
Definition navquery.h:53
Util::Array< unsigned char > areas
the area of each segment, from points[i] to points[i + 1]
Definition navquery.h:58
Util::Array< Math::point > points
the corners of the path on the surface, from the start to the end
Definition navquery.h:56
PathStatus status
Definition navquery.h:54
float length
the length of the path
Definition navquery.h:60
float cost
the length of every segment times the cost of its area
Definition navquery.h:62
Definition navquery.h:29
float areaCost[64]
cost of walking a unit on each area, by area id
Definition navquery.h:31
uint16_t excludeFlags
and none of these
Definition navquery.h:35
uint16_t includeFlags
a polygon is used if it has one of these flags
Definition navquery.h:33