NavMesh

Engine/source/navigation/navMesh.h

Represents a set of bounds within which a Recast navigation mesh is generated.

More...

Classes:

class

Intermediate data for tile creation.

Water

enum
WaterMethod {
  Ignore 
  Solid 
  Impassable 
}

SceneObject

enum
flags {
  BuildFlag = Parent::NextFreeMask << 0
  LoadFlag = Parent::NextFreeMask << 1
  NextFreeMask = Parent::NextFreeMask << 2
}
bool

Called when the object is added to the sim.

Called when the object is removed from the sim.

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Instructs this object to pack its state for transfer over the network.

Instructs this object to read state data previously packed with packUpdate.

Sets the Object -> World transform.

Sets the scale for the object.

Off-mesh links

enum
SelectState {
  Unselected 
  Hovered 
  Selected 
}

Coordinates of each link vertex.

Vector< bool >

Are the editor links unsynced from the mesh?

Radius of each link.

Direction (one-way or bidirectional)

Area ID.

ID number of each link.

Vector< bool >

Link will be deleted next build.

NavMesh build

bool
build(bool background, bool saveIntermediates)

Initiates the navmesh build process, which includes notifying the clients and posting an event.

Stop a build in progress.

bool

Generate cover points from a nav mesh.

Remove all cover points.

bool
save()

Save the navmesh to a file.

bool
load()

Load a saved navmesh from a file.

Instantly rebuild the tiles in the navmesh that overlap the box.

Instantly rebuild a specific tile.

Rebuild parts of the navmesh where links have changed.

Data file to store this nav mesh in. (From engine executable dir.)

Name of the SimSet to store cover points in. (Usually a SimGroup.)

Cell width and height.

Annotations

Distance to search for cover.

Distance to search horizontally when peeking around cover.

bool

Add cover to walls that don't have corners?

Rendering

Called when the SceneManager is ready for the registration of render instances.

renderLinks(duDebugDraw & dd)

Tiles

updateTiles(bool dirty)

Update tile dimensions.

unsigned char *
buildTileData(const Tile & tile, TileData & data, U32 & dataSize)

Generates navmesh data for a single tile.

Vector< Tile >

List of tiles.

Vector< TileData >

List of tile intermediate data.

List of indices to the tile array which are dirty.

Intermediate data

Updates our config from console members.

rcConfig

Config struct.

dtNavMesh *
rcContext *

Threaded updates

bool

A simple flag to say we are building.

Links

addLink(const Point3F & from, const Point3F & to, U32 flags)

Add an off-mesh link.

Get the ID of the off-mesh link near the point.

Get the number of links this mesh has.

Get the starting point of a link.

Get the ending point of a link.

Get the flags used by a link.

Set flags used by a link.

selectLink(U32 idx, bool select, bool hover)

Set the selected state of a link.

Delete the selected link.

SimObject

Called when the editor is activated.

Called when the editor is deactivated.

write(Stream & stream, U32 tabStop, U32 flags)

Output the TorqueScript to recreate this object.

ProcessObject

Processes a move event and updates object state once every 32 milliseconds.

Cover

bool
testEdgeCover(const Point3F & pos, const VectorF & dir, CoverPointData & data)

Attempt to place cover points along a given edge.

Private Types

Parent 

Public Friends

class

Public Attributes

bool

Should large characters use this mesh?

bool

Should regular-sized characters use this mesh?

bool

Should small characters use this mesh?

bool

Should vehicles use this mesh?

Private Attributes

bool

Save imtermediate navmesh creation data?

Private Static Attributes

Use this object to manage update events.

Server-side set for all NavMesh objects.

Public Functions

Return the index of the tile included by this point.

Return the box of a given tile.

Called after any property of the object is changed in the world editor.

Public Static Functions

Return the EventManager for all NavMeshes.

Return the server-side NavMesh SimSet.

Protected Functions

dtNavMesh const  *

Private Functions

Builds the next tile in the dirty list.

bool

Generates a navigation mesh for the collection of objects in this mesh.

Private Static Functions

bool
setProtectedAlwaysRender(void * obj, const char * index, const char * data)

Updates the client when we check the alwaysRender option.

bool
setProtectedDetailSampleDist(void * obj, const char * index, const char * data)

Used to perform non-standard validation. detailSampleDist can be 0, or >= 0.9.

Detailed Description

Represents a set of bounds within which a Recast navigation mesh is generated.

see:

NavMeshPolyList

Water

WaterMethod

Enumerator

Ignore
Solid
Impassable
WaterMethod mWaterMethod 

SceneObject

flags

Enumerator

BuildFlag = Parent::NextFreeMask << 0
LoadFlag = Parent::NextFreeMask << 1
NextFreeMask = Parent::NextFreeMask << 2
onAdd()

Reimplemented from: SceneObject

onRemove()

Reimplemented from: SceneObject

packUpdate(NetConnection * conn, U32 mask, BitStream * stream)

Reimplemented from: SceneObject

unpackUpdate(NetConnection * conn, BitStream * stream)

Reimplemented from: SceneObject

setTransform(const MatrixF & mat)

Reimplemented from: SceneObject

setScale(const VectorF & scale)

Reimplemented from: SceneObject

initPersistFields()

Off-mesh links

SelectState

Enumerator

Unselected
Hovered
Selected
eraseLink(U32 idx)

eraseLinks()

setLinkCount(U32 c)

Vector< F32 > mLinkVerts 

Coordinates of each link vertex.

Vector< bool > mLinksUnsynced 

Are the editor links unsynced from the mesh?

Vector< F32 > mLinkRads 

Radius of each link.

Vector< U8 > mLinkDirs 

Direction (one-way or bidirectional)

Vector< U8 > mLinkAreas 

Area ID.

Vector< U16 > mLinkFlags 

Flags.

Vector< U32 > mLinkIDs 

ID number of each link.

Vector< U8 > mLinkSelectStates 

Selection state of links.

Vector< bool > mDeleteLinks 

Link will be deleted next build.

U32 mCurLinkID 

NavMesh build

build(bool background, bool saveIntermediates)

Initiates the navmesh build process, which includes notifying the clients and posting an event.

cancelBuild()

Stop a build in progress.

createCoverPoints()

Generate cover points from a nav mesh.

deleteCoverPoints()

Remove all cover points.

save()

Save the navmesh to a file.

load()

Load a saved navmesh from a file.

buildTiles(const Box3F & box)

Instantly rebuild the tiles in the navmesh that overlap the box.

This method should never be called in a separate thread to the rendering or pathfinding logic.

It directly replaces data in the dtNavMesh for this NavMesh object.

buildTile(const U32 & tile)

Instantly rebuild a specific tile.

buildLinks()

Rebuild parts of the navmesh where links have changed.

StringTableEntry mFileName 

Data file to store this nav mesh in. (From engine executable dir.)

StringTableEntry mCoverSet 

Name of the SimSet to store cover points in. (Usually a SimGroup.)

F32 mCellSize 

Cell width and height.

F32 mCellHeight 

Actor data

F32 mWalkableHeight 
F32 mWalkableClimb 
F32 mWalkableRadius 
F32 mWalkableSlope 

Generation data

U32 mBorderSize 
F32 mDetailSampleDist 
F32 mDetailSampleMaxError 
U32 mMaxEdgeLen 
F32 mMaxSimplificationError 
U32 mMinRegionArea 
U32 mMergeRegionArea 
F32 mTileSize 
U32 mMaxPolysPerTile 
const U32 mMaxVertsPerPoly 

Annotations

F32 mCoverDist 

Distance to search for cover.

F32 mPeekDist 

Distance to search horizontally when peeking around cover.

bool mInnerCover 

Add cover to walls that don't have corners?

Rendering

prepRenderImage(SceneRenderState * state)

Reimplemented from: SceneObject

render(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)

renderLinks(duDebugDraw & dd)

renderTileData(duDebugDrawTorque & dd, U32 tile)

renderToDrawer()

bool mAlwaysRender 
duDebugDrawTorque mDbgDraw 

Tiles

updateTiles(bool dirty)

Update tile dimensions.

buildTileData(const Tile & tile, TileData & data, U32 & dataSize)

Generates navmesh data for a single tile.

Vector< Tile > mTiles 

List of tiles.

Vector< TileData > mTileData 

List of tile intermediate data.

Vector< U32 > mDirtyTiles 

List of indices to the tile array which are dirty.

Intermediate data

updateConfig()

Updates our config from console members.

rcConfig cfg 

Config struct.

dtNavMesh * nm 
rcContext * ctx 

Threaded updates

bool mBuilding 

A simple flag to say we are building.

Links

addLink(const Point3F & from, const Point3F & to, U32 flags)

Add an off-mesh link.

getLink(const Point3F & pos)

Get the ID of the off-mesh link near the point.

getLinkCount()

Get the number of links this mesh has.

getLinkStart(U32 idx)

Get the starting point of a link.

getLinkEnd(U32 idx)

Get the ending point of a link.

getLinkFlags(U32 idx)

Get the flags used by a link.

setLinkFlags(U32 idx, const LinkData & d)

Set flags used by a link.

selectLink(U32 idx, bool select, bool hover)

Set the selected state of a link.

deleteLink(U32 idx)

Delete the selected link.

SimObject

onEditorEnable()

Reimplemented from: SimObject

onEditorDisable()

Reimplemented from: SimObject

write(Stream & stream, U32 tabStop, U32 flags)

Reimplemented from: SimSet

ProcessObject

processTick(const Move * move)

Reimplemented from: ProcessObject

Cover

testEdgeCover(const Point3F & pos, const VectorF & dir, CoverPointData & data)

Attempt to place cover points along a given edge.

Private Types

typedef SceneObject Parent 

Public Friends

Public Attributes

bool mLargeCharacters 

Should large characters use this mesh?

bool mRegularCharacters 

Should regular-sized characters use this mesh?

bool mSmallCharacters 

Should small characters use this mesh?

bool mVehicles 

Should vehicles use this mesh?

Private Attributes

bool mSaveIntermediates 

Save imtermediate navmesh creation data?

Private Static Attributes

SimObjectPtr< EventManager > smEventManager 

Use this object to manage update events.

SimObjectPtr< SimSet > smServerSet 

Server-side set for all NavMesh objects.

Public Functions

NavMesh()

~NavMesh()

DECLARE_CONOBJECT(NavMesh )

getTile(const Point3F & pos)

Return the index of the tile included by this point.

getTileBox(U32 id)

Return the box of a given tile.

inspectPostApply()

Reimplemented from: SceneObject

Public Static Functions

getEventManager()

Return the EventManager for all NavMeshes.

getServerSet()

Return the server-side NavMesh SimSet.

Protected Functions

getNavMesh()

Private Functions

buildNextTile()

Builds the next tile in the dirty list.

generateMesh()

Generates a navigation mesh for the collection of objects in this mesh.

Returns true if successful. Stores the created mesh in tnm.

Private Static Functions

setProtectedAlwaysRender(void * obj, const char * index, const char * data)

Updates the client when we check the alwaysRender option.

setProtectedDetailSampleDist(void * obj, const char * index, const char * data)

Used to perform non-standard validation. detailSampleDist can be 0, or >= 0.9.