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

Method update

Engine/source/navigation/navPath.cpp:456–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

454}
455
456bool NavPath::update()
457{
458 PROFILE_SCOPE(NavPath_update);
459 if(dtStatusInProgress(mStatus))
460 mStatus = mQuery->updateSlicedFindPath(mMaxIterations, NULL);
461 if(dtStatusSucceed(mStatus))
462 {
463 // Add points from this leg.
464 dtPolyRef path[MaxPathLen];
465 S32 pathLen;
466 mStatus = mQuery->finalizeSlicedFindPath(path, &pathLen, MaxPathLen);
467 if(dtStatusSucceed(mStatus) && pathLen)
468 {
469 F32 straightPath[MaxPathLen * 3];
470 S32 straightPathLen;
471 dtPolyRef straightPathPolys[MaxPathLen];
472 U8 straightPathFlags[MaxPathLen];
473
474 U32 s = mVisitPoints.size();
475 Point3F start = mVisitPoints[s-1];
476 Point3F end = mVisitPoints[s-2];
477 F32 from[] = {start.x, start.z, -start.y};
478 F32 to[] = {end.x, end.z, -end.y};
479
480 mQuery->findStraightPath(from, to, path, pathLen,
481 straightPath, straightPathFlags,
482 straightPathPolys, &straightPathLen, MaxPathLen);
483
484 s = mPoints.size();
485 mPoints.increment(straightPathLen);
486 mFlags.increment(straightPathLen);
487 for(U32 i = 0; i < straightPathLen; i++)
488 {
489 F32 *f = straightPath + i * 3;
490 mPoints[s + i] = RCtoDTS(f);
491 mMesh->getNavMesh()->getPolyFlags(straightPathPolys[i], &mFlags[s + i]);
492 // Add to length
493 if(s > 0 || i > 0)
494 mLength += (mPoints[s+i] - mPoints[s+i-1]).len();
495 }
496
497 if(isServerObject())
498 setMaskBits(PathMask);
499 }
500 else
501 return false;
502 // Check to see where we still need to visit.
503 if(mVisitPoints.size() > 1)
504 {
505 //Next leg of the journey.
506 mVisitPoints.pop_back();
507 return visitNext();
508 }
509 else
510 {
511 // Finished!
512 return false;
513 }

Callers

nothing calls this directly

Calls 13

dtStatusInProgressFunction · 0.85
dtStatusSucceedFunction · 0.85
RCtoDTSFunction · 0.85
dtStatusFailedFunction · 0.85
updateSlicedFindPathMethod · 0.80
findStraightPathMethod · 0.80
incrementMethod · 0.80
getPolyFlagsMethod · 0.80
sizeMethod · 0.45
getNavMeshMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected