mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-11 15:21:51 +00:00
- fixed: INHERITACTORPITCH was inverted.
- changed PITCHFORMOMENTUM to do nothing for very small velocities.
This commit is contained in:
parent
ab8a647433
commit
fd8a59bd24
1 changed files with 12 additions and 9 deletions
|
@ -933,16 +933,19 @@ void gl_RenderModel(GLSprite * spr)
|
|||
const double x = spr->actor->Vel.X;
|
||||
const double y = spr->actor->Vel.Y;
|
||||
const double z = spr->actor->Vel.Z;
|
||||
|
||||
// [BB] Calculate the pitch using spherical coordinates.
|
||||
if(z || x || y) pitch = float(atan( z/sqrt(x*x+y*y) ) / M_PI * 180);
|
||||
|
||||
// Correcting pitch if model is moving backwards
|
||||
if(x || y)
|
||||
|
||||
if (spr->actor->Vel.LengthSquared() > EQUAL_EPSILON)
|
||||
{
|
||||
if((x * cos(angle * M_PI / 180) + y * sin(angle * M_PI / 180)) / sqrt(x * x + y * y) < 0) pitch *= -1;
|
||||
// [BB] Calculate the pitch using spherical coordinates.
|
||||
if (z || x || y) pitch = float(atan(z / sqrt(x*x + y*y)) / M_PI * 180);
|
||||
|
||||
// Correcting pitch if model is moving backwards
|
||||
if (fabs(x) > EQUAL_EPSILON || fabs(y) > EQUAL_EPSILON)
|
||||
{
|
||||
if ((x * cos(angle * M_PI / 180) + y * sin(angle * M_PI / 180)) / sqrt(x * x + y * y) < 0) pitch *= -1;
|
||||
}
|
||||
else pitch = fabs(pitch);
|
||||
}
|
||||
else pitch = fabs(pitch);
|
||||
}
|
||||
|
||||
if( smf->flags & MDL_ROTATING )
|
||||
|
@ -964,7 +967,7 @@ void gl_RenderModel(GLSprite * spr)
|
|||
// Applying model transformations:
|
||||
// 1) Applying actor angle, pitch and roll to the model
|
||||
gl_RenderState.mModelMatrix.rotate(-angle, 0, 1, 0);
|
||||
gl_RenderState.mModelMatrix.rotate(pitch, 0, 0, 1);
|
||||
gl_RenderState.mModelMatrix.rotate(-pitch, 0, 0, 1);
|
||||
gl_RenderState.mModelMatrix.rotate(-roll, 1, 0, 0);
|
||||
|
||||
// 2) Applying Doomsday like rotation of the weapon pickup models
|
||||
|
|
Loading…
Reference in a new issue