Navigation mesh
Engine structures the SDK declares by hand: CCSNavArea.
Header source2mod/schema/navarea.h
Constructors
CCSNavArea() = delete;
CCSNavArea(const CCSNavArea&) = delete;Methods
Id
uint32_t Id() const;Nav area identifier.
Center
const Vector& Center() const;Centre of the area.
Normal
const Vector& Normal() const;Surface normal, which is what gives the area its slope.
Min
Vector Min() const;Corner with the smaller components on every axis.
Max
Vector Max() const;Corner with the larger components on every axis.
Width
float Width() const;Extent along X.
Height
float Height() const;Extent along Y.
Area2D
float Area2D() const;Width times height; the area ignoring slope.
GetHeightAtPosition
float GetHeightAtPosition(float x, float y) const;Height of the area's surface directly under a world position.
| Parameter | Type |
|---|---|
x | float |
y | float |
ContainsPoint
bool ContainsPoint(const Vector& vecPosition, float flZTolerance = 32.0f) const;Whether a position sits on this area, within flZTolerance of its surface.
| Parameter | Type | Default |
|---|---|---|
vecPosition | const Vector& | |
flZTolerance | float | 32.0f |
ContainsBox
bool ContainsBox(const Vector& vecMins, const Vector& vecMaxs, float flZTolerance = 32.0f) const;Whether a box sits entirely on this area.
| Parameter | Type | Default |
|---|---|---|
vecMins | const Vector& | |
vecMaxs | const Vector& | |
flZTolerance | float | 32.0f |
IntersectsBox
bool IntersectsBox(const Vector& vecMins, const Vector& vecMaxs, float flZTolerance = 32.0f) const;Whether a box overlaps this area at all.
| Parameter | Type | Default |
|---|---|---|
vecMins | const Vector& | |
vecMaxs | const Vector& | |
flZTolerance | float | 32.0f |
GetClosestPoint
Vector GetClosestPoint(const Vector& vecPosition) const;Point of this area nearest a world position.
| Parameter | Type |
|---|---|
vecPosition | const Vector& |
GetDistanceToPoint
float GetDistanceToPoint(const Vector& vecPosition) const;Distance from a world position to this area.
| Parameter | Type |
|---|---|
vecPosition | const Vector& |
GetDistanceSquaredToPoint
float GetDistanceSquaredToPoint(const Vector& vecPosition) const;Squared distance, for comparing without the square root.
| Parameter | Type |
|---|---|
vecPosition | const Vector& |
GetAllNavAreas
static std::vector<CCSNavArea*> GetAllNavAreas();Every area of the current nav mesh, or empty when there is none.
GetClosestNavArea
static CCSNavArea* GetClosestNavArea(const Vector& vecPosition, float flMaximumDistance = -1.0f);
static CCSNavArea* GetClosestNavArea(const Vector& vecPosition, float* pflDistanceOut, float flMaximumDistance = -1.0f);Area nearest a position, or null when the mesh is missing or nothing is in range.
As above, and writes the distance it found to pflDistanceOut.
| Parameter | Type | Default | Description |
|---|---|---|---|
vecPosition | const Vector& | ||
flMaximumDistance | float | -1.0f | Search limit; zero or less means no limit. |
pflDistanceOut | float* |
IsValidNavMesh
static bool IsValidNavMesh();Whether the game has a nav mesh loaded.