Fix water pvp (#728)
Some checks are pending
Build coop / build-macos-intel (push) Waiting to run
Build coop / build-ubuntu (push) Waiting to run
Build coop / build-windows (push) Waiting to run
Build coop / build-macos-arm (push) Waiting to run

* Fix water pvp

* Revert "Fix water pvp"

This reverts commit 95adc3206e.

* The real fix

Turns out I needed to swap the x and z facing angles for the calculations
This commit is contained in:
Sunk 2025-04-09 19:13:18 -04:00 committed by GitHub
parent e1c0d87ea8
commit 407e74ccf7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -153,13 +153,13 @@ u32 determine_interaction(struct MarioState *m, struct Object *o) {
// hack: make water punch actually do something
if (interaction == 0 && m->action == ACT_WATER_PUNCH && o->oInteractType & INTERACT_PLAYER) {
f32 cossFaceAngle0 = coss(m->faceAngle[0]);
Vec3f facing = { coss(m->faceAngle[1])*cossFaceAngle0, sins(m->faceAngle[0]), sins(m->faceAngle[1])*cossFaceAngle0 };
Vec3f dif = { o->oPosX - m->pos[0], (o->oPosY + o->hitboxHeight * 0.5) - m->pos[1], o->oPosZ - m->pos[2] };
f32 cossPitch = coss(m->faceAngle[0]);
Vec3f facing = { sins(m->faceAngle[1])*cossPitch, sins(m->faceAngle[0]), coss(m->faceAngle[1])*cossPitch };
Vec3f dif = { o->oPosX - m->pos[0], (o->oPosY + o->hitboxHeight * 0.5) - (m->pos[1] + m->marioObj->hitboxHeight * 0.5), o->oPosZ - m->pos[2] };
vec3f_normalize(dif);
f32 angle = vec3f_dot(facing, dif);
// Unknown angle (60 degrees in each direction?)
if (angle >= 0.5f) {
if (angle >= 0.6f) {
interaction = INT_PUNCH;
}
}