Note however there's currently no way to tell if the player is actually crouching or not. ViewPos doesn't appear to update based on that factor. A minor detail, but otherwise this works out pretty nicely.
Spoiler: Old PostTrying to brainstorm with dpJudas on how best to handle DONTFLIP but, so far, not having any luck here. This seems to only have made things a little worse from before.Code: Select all
// Here we need some form of priority in order to work. if (spritetype == RF_FLATSPRITE) { float pitchDegrees = -actor->Angles.Pitch.Degrees; // Calculate the full rotation Matrix3x4 rotmatrix; rotmatrix.MakeIdentity(); rotmatrix.Rotate(-yawvecY, 0, yawvecX, -pitchDegrees); if (drawRollSpriteActor) { if (useOffsets) rotmatrix.Translate(xx, zz, yy); rotmatrix.Rotate(yawvecX, 0, yawvecY, -rollDegrees); if (useOffsets) rotmatrix.Translate(-xx, -zz, -yy); } // Rotate diff vector and check angle DVector3 apos = { x, y, z }; DVector3 diff = ViewPos - apos; FVector3 diffrotated = rotmatrix * FVector3(diff.X, diff.Y, diff.Z); diff = { diffrotated.X, diffrotated.Y, diffrotated.Z }; DAngle angto = diff.Angle(); angto = deltaangle(actor->Angles.Yaw, angto); bool noFlipSprite = (!dontFlip || (fabs(angto) < 90.)); // Apply flip rotation first and then the rotation matrix mat.Rotate(0, 1, 0, (noFlipSprite) ? 0 : 180); mat = mat * rotmatrix; }
To summarize what's going on, currently DONTFLIP doesn't handle pitch. I've tried my hardest to get it to that point where it will only flip if it's truly being looked at from the backside and not just > 90 of an angle. Any ideas on how to figure this out would be greatly appreciated.