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.

ParameterType
xfloat
yfloat

ContainsPoint

bool ContainsPoint(const Vector& vecPosition, float flZTolerance = 32.0f) const;

Whether a position sits on this area, within flZTolerance of its surface.

ParameterTypeDefault
vecPositionconst Vector&
flZTolerancefloat32.0f

ContainsBox

bool ContainsBox(const Vector& vecMins, const Vector& vecMaxs, float flZTolerance = 32.0f) const;

Whether a box sits entirely on this area.

ParameterTypeDefault
vecMinsconst Vector&
vecMaxsconst Vector&
flZTolerancefloat32.0f

IntersectsBox

bool IntersectsBox(const Vector& vecMins, const Vector& vecMaxs, float flZTolerance = 32.0f) const;

Whether a box overlaps this area at all.

ParameterTypeDefault
vecMinsconst Vector&
vecMaxsconst Vector&
flZTolerancefloat32.0f

GetClosestPoint

Vector GetClosestPoint(const Vector& vecPosition) const;

Point of this area nearest a world position.

ParameterType
vecPositionconst Vector&

GetDistanceToPoint

float GetDistanceToPoint(const Vector& vecPosition) const;

Distance from a world position to this area.

ParameterType
vecPositionconst Vector&

GetDistanceSquaredToPoint

float GetDistanceSquaredToPoint(const Vector& vecPosition) const;

Squared distance, for comparing without the square root.

ParameterType
vecPositionconst 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.

ParameterTypeDefaultDescription
vecPositionconst Vector&
flMaximumDistancefloat-1.0fSearch limit; zero or less means no limit.
pflDistanceOutfloat*

IsValidNavMesh

static bool IsValidNavMesh();

Whether the game has a nav mesh loaded.

On this page