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

WeaponInfo docs #1596

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

WeaponInfo docs #1596

wants to merge 3 commits into from

Conversation

Dragorn421
Copy link
Collaborator

@Dragorn421 Dragorn421 commented Dec 11, 2023

Some docs on WeaponInfo and surroundings

Cf Player_UpdateWeaponInfo for an explanation of what this is (see if the doc is good enough)

Major change is renaming "tip" and "base" to "posA" and "posB" respectively.

This is because tip&base only works for melee weapons (swords, stick, hammer), where the two positions do correspond to a tip and a base:

image

However this falls apart for range weapons which also use WeaponInfo. For example hookshot uses positions that are basically "left and right" (or "top and bottom" idk)

image

Link to discord discussion (really me venting that bleh posA and posB) https://discord.com/channels/688807550715560050/688851317593997489/1175953325733199922

Comment on lines +416 to +417
static Vec3f sPosAModel = { 0.0f, 400.0f, 1500.0f };
static Vec3f sPosBModel = { 0.0f, -400.0f, 1500.0f };
Copy link
Collaborator

Choose a reason for hiding this comment

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

Currently we dont have a convention for naming these types of vectors. So maybe its something we need to solve outside of this PR. But, suffixing "model" isnt all that common so far for these.

Most often youll see "offset" used. As in, posA is 400 units in the y direction and 1500 units in the z direction from the base position of whatever the relevant entity is.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

"offset" makes it sound like it's just an addition though, when in fact the transformation also involves scaling and rotation (or any other linear transform but typically TRS)

It seems more typical/robust to me to specify the coordinates system a position is expressed in, here the "left hand limb (model) space"

I don't like the jumbled mess of words it comes out as either, but I don't really see a better option and apparently this is how I named similar coordinates in this file in the past (e.g. sPlayerFocusHeadLimbModelPos in #1230), it wasn't challenged then (just to say that other stuff would need changing too)

Brainstorming based on sPlayerFocusHeadLimbModelPos

  • sPlayerFocusPosHeadLimbSpace
  • sPlayerFocusPos_HeadLimbSpace
  • sPlayerFocusPos_HeadLimb

🤔

Comment on lines +1280 to +1288
// Positions for the tip of melee weapons, in the left hand limb's own model space.
Vec3f sMeleeWeaponTipLeftHandLimbModelPos0 = { 5000.0f, 400.0f, 0.0f };
Vec3f sMeleeWeaponTipLeftHandLimbModelPos1 = { 5000.0f, -400.0f, 1000.0f };
Vec3f sMeleeWeaponTipLeftHandLimbModelPos2 = { 5000.0f, 1400.0f, -1000.0f };

Vec3f D_801260A4[3] = {
{ 0.0f, 400.0f, 0.0f },
{ 0.0f, 1400.0f, -1000.0f },
{ 0.0f, -400.0f, 1000.0f },
};
// Positions for the base of melee weapons, in the left hand limb's own model space.
Vec3f sMeleeWeaponBaseLeftHandLimbModelPos0 = { 0.0f, 400.0f, 0.0f };
Vec3f sMeleeWeaponBaseLeftHandLimbModelPos1 = { 0.0f, 1400.0f, -1000.0f };
Vec3f sMeleeWeaponBaseLeftHandLimbModelPos2 = { 0.0f, -400.0f, 1000.0f };
Copy link
Collaborator

Choose a reason for hiding this comment

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

While the comments help greatly, the variable names themselves are quite confusing for me currently. I initially couldnt tell if this was the position of the left hand or what.

Using "offset" from the previous comment, it would be something like
sMeleeWeaponTipOffsetFromLeftHand0. This tells me that its the position of something relative to something else (and the fact that its in model space is imo clear by its usage instantly, and doesnt need to be in the name)

@ariahiro64
Copy link
Contributor

ariahiro64 commented Apr 8, 2024

why not just do sMeleeWeaponLengthPos0 then explain its from the tip in a comment

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

Successfully merging this pull request may close these issues.

None yet

3 participants