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

Rough dynamic collision setup #24

Merged
merged 4 commits into from
Sep 27, 2024
Merged

Conversation

robojumper
Copy link
Collaborator

Largely based on TP code - since SComponent has been absorbed by other libraries there's no longer a split between cCcd and dCcd so all names are made up again, but this matches the vtables and multiple inheritance stuff and allows us to match some simple actors with collision \o/

public:
/* 0x00 */ mVec3_c mCenter;
/* 0x0C */ f32 mRadius;
/* 0x10 */ f32 field_0x10;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know why a sphere is characterized by another float in additon to the radius.

src/REL/d/a/obj/d_a_obj_toD3_stone_figure.cpp Outdated Show resolved Hide resolved
src/REL/d/a/obj/d_a_obj_triforce.cpp Outdated Show resolved Hide resolved
mVec3_c b = *mRail.getPntPosForIndex(0);
mVec3_c c = *mRail.getPntPosForIndex(1);

fn_80337EF0(&unk, b, c, scale.x * 100.0f);
f32 d;
if (fn_8032BFB0(&unk, a, q, d, 0)) {
if (cM3d_Len3dSqPntAndSegLine(&unk, a, &q, &d, nullptr)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is evidence the old cM3d code still uses vector types that aren't mVec3_c - this creates copies of the vector with implicit copy constructors (using GPRs rather than FPRs).

Copy link
Collaborator

Choose a reason for hiding this comment

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

What I find more interesting is the address of it. its already closer to the Collision code and is disconnected from the m code. I think it is safe to it was a minimal effort port xD

Comment on lines +26 to +34
mVec3_c mMin;
mVec3_c mMax;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

mVec3_c here and below is an unfounded assumption.

Copy link
Collaborator

@elijah-thomas774 elijah-thomas774 left a comment

Choose a reason for hiding this comment

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

Looks good at a glance. I think it can be said it does use mVec at least because it references mVec3_c::Zero

@elijah-thomas774 elijah-thomas774 merged commit 3829ee6 into zeldaret:main Sep 27, 2024
1 check passed
@robojumper robojumper deleted the collision branch September 28, 2024 09:30
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