Skip to content

[GEN] Backport collision test related changes and fixes in WWMath from Zero Hour #772

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 28, 2025

Conversation

xezon
Copy link

@xezon xezon commented Apr 27, 2025

Merge with Rebase

This change unifies the remaining code of WWMath.

Generals inherits the following changes:

  • cardinalspline : Optimizes code in CardinalSpline3DClass::Update_Tangents
  • colmathaabox : Fixes normal direction in CollisionMath::Collide for AABox-AABox collision
  • colmathaabtri : Refactors the origin of the CollisionContext normal in aabtri_compute_contact_normal function
  • colmathobbobb : Fixes float division by zero in obb_separation_test function
  • colmathobbtri : Refactors storage type in obbtri_compute_contact_normal function
  • colmathobbtri : Changes normal value calculation in CollisionMath::Collide for OBBox-Tri collision

As far as I could tell, the collision math changes in colmathaabox, colmathaabtri, colmathobbtri are never called in Zero Hour (should have checked Generals but it is probably the same). So these math changes are probably inconsequential. If there were actual game logic relevant collisions using this code, it could incur behaviour changes.

Regarding CollisionContext, there appears to be a relevant comment nearby:

** Note that much of the code needs the un-normalized triangle normal.  For this reason,
** I have to compute N rather than copying it from the triangle.  (commenting this to
** avoid re-generating a difficult to find bug that I had)

The math changes are split into separate commits to make testing of older changes easier if we ever wanted to revisit a particular change.

@xezon xezon added Generals Related Generals only Unify Unifies code between Generals and Zero Hour labels Apr 27, 2025
@xezon xezon added this to the Code foundation build up milestone Apr 27, 2025
@xezon xezon requested a review from tomsons26 April 27, 2025 10:54
@xezon xezon force-pushed the xezon/unify-wwmath branch from 8156d8e to 3e55f5c Compare April 27, 2025 10:55
Copy link

@roossienb roossienb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked that

  • colmathaabtri.cpp, colmathobbob.cpp and colmathobbtri.cpp are not used in Generals
  • CardinalSpline3DClass::Update_Tangents() is never used.
  • CollisionMath::Collide() in colmathaabox.cpp is never used.
  • Tested it against the Skirmish 1 replay and had no issues.

Changes in this PR have no effect on Generals and can be safely merged.

@xezon xezon merged commit 55c60b3 into TheSuperHackers:main Apr 28, 2025
11 checks passed
xezon added a commit that referenced this pull request Apr 28, 2025
xezon added a commit that referenced this pull request Apr 28, 2025
xezon added a commit that referenced this pull request Apr 28, 2025
xezon added a commit that referenced this pull request Apr 28, 2025
@xezon xezon deleted the xezon/unify-wwmath branch April 28, 2025 17:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Generals Related Generals only Unify Unifies code between Generals and Zero Hour
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants