Fix QuatFromXZDirection
for negative dx inputs causing ACUs to spawn the wrong direction
#6630
+25
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue
Initially reported on Discord that ACUs would sometimes not spawn facing the correct direction after the release with #6438.
This is because the math used in the
QuatFromXZDirection(dx, dz)
function did not properly account for signs, and was giving the wrong output whendx
was negative. ACUs on the right side of the map have a negativedx
when rotating towards the middle of the map.Description of the proposed changes
Unit ual0001 is attempting to move to an invalid coord
to the log about the unit moving to an invalid coord whenSetOrientation({0, 1.#INF, 0, 1.#INF}, true)
happened.Testing done on the proposed changes
The follow script tests the differences between the old and new results of RotateTowards, but I didn't bother making the function results exactly the same (there are some switches in sign) because the end result for ACU orientation at the start was fine.
Checklist