Merge pull request #44 from AlienDenis12/fix/thirdperson-frontview-inverted-pitch

Fix inverted pitch in ThirdPersonView 2 (Front View)
This commit is contained in:
NOTPIES 2026-03-03 19:09:59 -03:00 committed by GitHub
commit 78052a4222
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -552,6 +552,10 @@ void GameRenderer::moveCameraToPlayer(float a)
double zd = Mth::cos(yRot / 180 * PI) * Mth::cos(xRot / 180 * PI) * cameraDist;
double yd = -Mth::sin(xRot / 180 * PI) * cameraDist;
// Invert Y offset if in third-person front view (camera faces player)
if (localplayer->ThirdPersonView() == 2)
yd = Mth::sin(xRot / 180 * PI) * cameraDist;
for (int i = 0; i < 8; i++)
{
float xo = (float)((i & 1) * 2 - 1);
@ -588,7 +592,18 @@ void GameRenderer::moveCameraToPlayer(float a)
if (!mc->options->fixedCamera)
{
glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
//glRotatef(player->xRotO + (player->xRot - player->xRotO) * a, 1, 0, 0);
float pitch = player->xRotO + (player->xRot - player->xRotO) * a;
// Invert pitch if in third-person front view (camera faces player)
if(localplayer->ThirdPersonView() == 2)
{
pitch = -pitch;
}
glRotatef(pitch, 1, 0, 0);
if( localplayer->ThirdPersonView() == 2 )
{
// Third person view is now 0 for disabled, 1 for original, 2 for flipped