Refactor WorldPos, WindowsPos done

This commit is contained in:
Jan Mrna
2025-10-04 16:54:29 +02:00
committed by Mrna
parent 47977d9979
commit 8a49c12909
13 changed files with 89 additions and 61 deletions

View File

@@ -63,7 +63,7 @@ void PathFindingDemo::CreateMap() {
}
WorldPos PathFindingDemo::GetRandomPosition() const {
return WorldPos{0.0, 0.0}; // totally random!
return WorldPos{0.0f, 0.0f}; // totally random!
}
std::optional<WorldPos> PathFindingDemo::GetMoveTarget() {
@@ -75,7 +75,7 @@ std::optional<WorldPos> PathFindingDemo::GetMoveTarget() {
WorldPos next_player_pos = m_Path.front();
if (current_player_pos.distance(next_player_pos) > 1.0) {
if (current_player_pos.DistanceTo(next_player_pos) > 1.0) {
// target not reached yet
return next_player_pos;
}
@@ -95,7 +95,7 @@ void PathFindingDemo::UpdatePlayerVelocity() {
WorldPos velocity = WorldPos{};
if (next_pos) {
velocity = next_pos.value() - current_pos;
velocity.normalize();
velocity.Normalize();
//LOG_DEBUG("I want to move to: ", next_pos.value(),
// ", velocity: ", velocity);
}