-
Notifications
You must be signed in to change notification settings - Fork 601
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
base: main
Are you sure you want to change the base?
WeaponInfo
docs
#1596
Conversation
static Vec3f sPosAModel = { 0.0f, 400.0f, 1500.0f }; | ||
static Vec3f sPosBModel = { 0.0f, -400.0f, 1500.0f }; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
🤔
// 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 }; |
There was a problem hiding this comment.
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)
why not just do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think changing from tip/base to accommodate the hookshot is a mistake. Honestly tip/base still works, and is just plain easier to reason about. From a modding perspective it's immediately obvious which one I need to use, and have used several times. I think changing it to posA
/posB
is a strict downgrade and obfuscates the WeaponInfo struct further.
also... these names sMeleeWeaponTipLeftHandLimbModelPos0
are just way too much in my opinion, but I'm not as against it as I am the tip/base thing. I think sWeeaponTipOffset0
, etc. is better and simpler. same for the other ones, calling these offset
s makes a lot of sense to me. this idea of model space offsets
makes a lot a lot a lot of sense to me. I would be happy to see all such Vec3fs used in this way named "offset".
How does tip/base still work for hookshot? They're used by hookshot as "one side" and "the other side" |
Maybe it's not perfect, but I also don't think it's wrong, and having to go all the way back to just "pos" feels like an overcorrection. Like... yeah of course it's a pos, we knew that much from the type basically. |
For hookshot, you can think of it as shooting out a tiny weapon, oriented vertically so the top is the "tip" and the bottom is the "base". Same with boomerang, the leading edge of the hitbox is the true "weapon", although I don't know which way it's oriented (and I wouldn't know if it's named posA/posB either) |
Why can't we give them a suggestive name anyway? I think the base/tip analogy works well if you imagine a little sword sweeping out the path the hookshot or boomerang. It's at least not worse than posA/posB for hookshot etc (note posA/posB also implies some orientation), and it's much better for things like sword and deku stick, so overall I think base/tip are better names. |
They are pointing at complete opposite points between hookshot and boomerang, how is tip and base helping here |
They don't really, I guess you could imagine the boomerang as being thrown upside-down. But |
The weapon info system is used for more than melee weapons, so I think it should accommodate for that fact. Being generic when things are generic only really makes sense. Tip and base in the other contexts they are used are just wrong. The pieces relevant only to melee weapons can still be named after tip and base, like the vector that holds their offsets. |
@krm01 do you still want to keep tip and base given the information above? You said |
I don't think they're "just wrong" for hookshot/bow/boomerang, it would be wrong if for example the hammer used "tip" for the handle and "base" for the head. For those weapons you can think of "base" and "tip" as being generic instead since the orientation doesn't matter |
I see, that's not how "quad" weapons work though, it sweeps out a path along weapon using the previous base/tip and the current base/tip.
I guess you really don't like this analogy? I've internalized it pretty well after working on tricks to hit stuff with a weirdshot or a boomerang throw |
Yea after reading the further discussion I still like the sword base / tip just has so many common uses... I reference it all the time for various things, checking the burning stick tip in range, etc... to me, being slightly more "correct" by being more generic and less meaningful for its use in hookshot/boomerang isn't worth the hit to usability/readability for the common use case of dealing with Link's melee weapons. |
I think the other uses are being disregarded as small use cases/hacks when 3 different weapons is a significant amount. And I still dont follow how we can call it tip and base when those other weapons dont have a tip or base and dont use it in that manner. Even if you look at the leading edge as a small sword, the tip and base are not used in a meaningful way. But I am just repeating myself at this point and dont think it will add anything to the conversation. |
What about using an union? typedef struct WeaponInfo {
/* 0x00 */ s32 active;
union {
struct {
/* 0x04 */ Vec3f tip; // furthest from the player hand
/* 0x10 */ Vec3f base; // near the player hand
} melee;
struct {
/* 0x04 */ Vec3f a;
/* 0x10 */ Vec3f b;
} other;
} pos;
} WeaponInfo; // size = 0x1C |
trying to lean toward compromise is a nice thought, but dont think it will really help with anything in this case The main debate here is over what these members will be called within If a union was used thered be pretty much no place where you would access them as |
Phrased another way, I have no problem with tip and base terminology being used in |
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:
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)
Link to discord discussion (really me venting that bleh posA and posB) https://discord.com/channels/688807550715560050/688851317593997489/1175953325733199922