Fix one failing test

This commit is contained in:
David Markowitz
2024-02-10 19:53:20 -08:00
parent 944d3e1bac
commit 1ae57dc6e8
4 changed files with 13 additions and 10 deletions

View File

@@ -141,6 +141,7 @@ void PlatformSubComponent::SetupPath(const std::string& pathName, uint32_t start
m_InReverse = startsInReverse;
m_CurrentWaypointIndex = startingWaypointIndex;
m_TimeBasedMovement = m_Path->movingPlatform.timeBasedMovement;
m_NextWaypointIndex = m_InReverse ? m_CurrentWaypointIndex - 1 : m_CurrentWaypointIndex + 1;
}
const PathWaypoint& PlatformSubComponent::GetNextWaypoint() const {
@@ -159,6 +160,8 @@ float PlatformSubComponent::CalculateSpeed() const {
float unitizedDirection = 1.0f / (GetNextWaypoint().position - GetCurrentWaypoint().position).Length();
speed = unitizedDirection / GetCurrentWaypoint().movingPlatform.speed;
} else {
LOG("%i %i", m_CurrentWaypointIndex, m_NextWaypointIndex);
Game::logger->Flush();
speed = (GetNextWaypoint().movingPlatform.speed - GetCurrentWaypoint().movingPlatform.speed) * m_PercentUntilNextWaypoint + GetCurrentWaypoint().movingPlatform.speed;
}
return speed;