MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / findNavMesh

Method findNavMesh

Engine/source/T3D/aiPlayer.cpp:1042–1071  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1040}
1041
1042NavMesh *AIPlayer::findNavMesh() const
1043{
1044 // Search for NavMeshes that contain us entirely with the smallest possible
1045 // volume.
1046 NavMesh *mesh = NULL;
1047 SimSet *set = NavMesh::getServerSet();
1048 for(U32 i = 0; i < set->size(); i++)
1049 {
1050 NavMesh *m = static_cast<NavMesh*>(set->at(i));
1051 if(m->getWorldBox().isContained(getWorldBox()))
1052 {
1053 // Check that mesh size is appropriate.
1054 if(mMount.object) // Should use isMounted() but it's not const. Grr.
1055 {
1056 if(!m->mVehicles)
1057 continue;
1058 }
1059 else
1060 {
1061 if((getNavSize() == Small && !m->mSmallCharacters) ||
1062 (getNavSize() == Regular && !m->mRegularCharacters) ||
1063 (getNavSize() == Large && !m->mLargeCharacters))
1064 continue;
1065 }
1066 if(!mesh || m->getWorldBox().getVolume() < mesh->getWorldBox().getVolume())
1067 mesh = m;
1068 }
1069 }
1070 return mesh;
1071}
1072
1073DefineEngineMethod(AIPlayer, findNavMesh, S32, (),,
1074 "@brief Get the NavMesh object this AIPlayer is currently using.\n\n"

Callers

nothing calls this directly

Calls 5

sizeMethod · 0.45
atMethod · 0.45
isContainedMethod · 0.45
getWorldBoxMethod · 0.45
getVolumeMethod · 0.45

Tested by

no test coverage detected