void BezierController::CreatePath() { if (!mStartNode || !mStartNode->GetNext()) { return; } //we set this flag, so the draw implementation //knows not to touch this mPathChanged = false; mPath.clear(); const BezierNode* pCurrentNode = mStartNode->GetBezierInterface(); const BezierNode* pNextNode = pCurrentNode->GetNext()->GetBezierInterface(); float elapsedTime = 0.0; while (pCurrentNode && pNextNode && pCurrentNode->GetExit() && pNextNode->GetEntry()) { float dt = pCurrentNode->GetStep(); float totalTime = pCurrentNode->GetTimeToNext(); float multiply = 1.0f / totalTime; // Magical Epsilon if (dt < 0.000001f) { dt = 0.05f; } for (float j = 0.0f; j < totalTime; j+= dt) { //note this is simplified through extending PathPointConverter //which has an implicit conversion from a dtCore::Transformable to a PathPoint MakeSegment(elapsedTime, j * multiply, pCurrentNode->GetPathPoint(), pCurrentNode->GetExit()->GetPathPoint(), pNextNode->GetEntry()->GetPathPoint(), pNextNode->GetPathPoint()); elapsedTime += dt; } pCurrentNode = pNextNode; if (pCurrentNode->GetNext()) { pNextNode = pCurrentNode->GetNext()->GetBezierInterface(); } else { pNextNode = NULL; } } mPathChanged = true; }
FGameplayDebuggerShape FGameplayDebuggerShape::MakeSegment(const FVector& StartLocation, const FVector& EndLocation, const FColor& Color, const FString& Description) { return MakeSegment(StartLocation, EndLocation, 1.0f, Color, Description); }