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

Method update

Engine/source/navigation/navPath.cpp:453–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

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