mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
added navmesh tester tool
Added ground work for tester tool tester tool works but needs to fill out list of acceptable datablocks and spawnclasses navpaths now share 1 navmeshquery AIControllerData now has a vector of area costs for different polyareas General cleanup
This commit is contained in:
parent
edf4d47be0
commit
6d36e17d91
17 changed files with 604 additions and 421 deletions
|
|
@ -114,6 +114,10 @@ AIPlayer::AIPlayer()
|
|||
mJump = None;
|
||||
mNavSize = Regular;
|
||||
mLinkTypes = LinkData(AllFlags);
|
||||
mFilter.setIncludeFlags(mLinkTypes.getFlags());
|
||||
mFilter.setExcludeFlags(0);
|
||||
mAreaCosts.setSize(PolyAreas::NumAreas);
|
||||
mAreaCosts.fill(1.0f);
|
||||
#endif
|
||||
|
||||
mIsAiControlled = true;
|
||||
|
|
@ -163,7 +167,8 @@ void AIPlayer::initPersistFields()
|
|||
|
||||
#ifdef TORQUE_NAVIGATION_ENABLED
|
||||
addGroup("Pathfinding");
|
||||
|
||||
addField("areaCosts", TypeF32Vector, Offset(mAreaCosts, AIPlayer),
|
||||
"Vector of costs for each PolyArea.");
|
||||
addField("allowWalk", TypeBool, Offset(mLinkTypes.walk, AIPlayer),
|
||||
"Allow the character to walk on dry land.");
|
||||
addField("allowJump", TypeBool, Offset(mLinkTypes.jump, AIPlayer),
|
||||
|
|
@ -785,6 +790,7 @@ void AIPlayer::moveToNode(S32 node)
|
|||
|
||||
bool AIPlayer::setPathDestination(const Point3F &pos)
|
||||
{
|
||||
#ifdef TORQUE_NAVIGATION_ENABLED
|
||||
// Pathfinding only happens on the server.
|
||||
if(!isServerObject())
|
||||
return false;
|
||||
|
|
@ -799,6 +805,13 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
|||
return false;
|
||||
}
|
||||
|
||||
mFilter.setIncludeFlags(mLinkTypes.getFlags());
|
||||
mFilter.setExcludeFlags(mLinkTypes.getExcludeFlags());
|
||||
for (U32 i = 0; i < PolyAreas::NumAreas; i++)
|
||||
{
|
||||
mFilter.setAreaCost((PolyAreas)i, mAreaCosts[i]);
|
||||
}
|
||||
|
||||
// Create a new path.
|
||||
NavPath *path = new NavPath();
|
||||
|
||||
|
|
@ -808,6 +821,7 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
|||
path->mFromSet = path->mToSet = true;
|
||||
path->mAlwaysRender = true;
|
||||
path->mLinkTypes = mLinkTypes;
|
||||
path->mFilter = mFilter;
|
||||
path->mXray = true;
|
||||
// Paths plan automatically upon being registered.
|
||||
if(!path->registerObject())
|
||||
|
|
@ -839,6 +853,9 @@ bool AIPlayer::setPathDestination(const Point3F &pos)
|
|||
path->deleteObject();
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
setMoveDestination(pos, false);
|
||||
#endif
|
||||
}
|
||||
|
||||
DefineEngineMethod(AIPlayer, setPathDestination, bool, (Point3F goal),,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue