Skip to content
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

Library/Collision: Implement al::HitInfo and variants #182

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MonsterDruide1
Copy link
Owner

@MonsterDruide1 MonsterDruide1 commented Oct 31, 2024

On the way to pulling in more collision-specific code, another pretty important class is HitInfo. It stores the result(s) of collisions with some extra meta-data that can be used to appropriately react to the collision at hand.


This change is Reviewable

@MonsterDruide1 MonsterDruide1 self-assigned this Oct 31, 2024
Copy link
Contributor

@tetraxile tetraxile left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @MonsterDruide1)


lib/al/Library/Collision/CollisionPartsTriangle.cpp line 256 at r1 (raw file):

    sead::Vector3f scaled_a1;
    sead::Vector3f scaled_a2;

i wonder if you could move these declarations up a bit to make it more clear what's going on here? (same for DiskHitInfo). maybe something like the following:

Code snippet:

...
tryNormalizeOrZero(&v20);

sead::Vector3f scaled_a1;
sead::Vector3f scaled_a2;
f32 a1_scalar = v20.dot(mTriangle.getFaceNormal() * _70);
f32 a2_scalar = v20.dot(mTriangle.getFaceNormal());
sead::Vector3CalcCommon<f32>::multScalar(scaled_a1, v20, a1_scalar);
sead::Vector3CalcCommon<f32>::multScalar(scaled_a2, v20, a2_scalar);

// or maybe reorder like this if it still matches?

...
f32 a1_scalar = v20.dot(mTriangle.getFaceNormal() * _70);
sead::Vector3CalcCommon<f32>::multScalar(scaled_a1, v20, a1_scalar);

f32 a2_scalar = v20.dot(mTriangle.getFaceNormal());
sead::Vector3CalcCommon<f32>::multScalar(scaled_a2, v20, a2_scalar);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants