fix MDL_USEROTATIONCENTER

This commit is contained in:
Ricardo Luís Vaz Silva 2025-05-11 01:12:55 -03:00
commit 0532a298d2

View file

@ -184,7 +184,7 @@ VSMatrix FSpriteModelFrame::ObjectToWorldMatrix(FLevelLocals *Level, DVector3 tr
// 1) Applying actor angle, pitch and roll to the model
if (flags & MDL_USEROTATIONCENTER)
{
objectToWorldMatrix.translate(rotationCenterX, rotationCenterY/stretch, rotationCenterZ);
objectToWorldMatrix.translate(rotationCenterX, rotationCenterZ/stretch, rotationCenterY);
objectToWorldMatrix.rotate(-rotation.Yaw.Degrees(), 0, 1, 0);
objectToWorldMatrix.rotate(rotation.Pitch.Degrees(), 0, 0, 1);
@ -197,7 +197,7 @@ VSMatrix FSpriteModelFrame::ObjectToWorldMatrix(FLevelLocals *Level, DVector3 tr
objectToWorldMatrix.rotate(rotateOffset, xrotate, yrotate, zrotate);
}
objectToWorldMatrix.translate(-rotationCenterX, -rotationCenterY/stretch, -rotationCenterZ);
objectToWorldMatrix.translate(-rotationCenterX, -rotationCenterZ/stretch, -rotationCenterY);
}
else
{
@ -210,9 +210,9 @@ VSMatrix FSpriteModelFrame::ObjectToWorldMatrix(FLevelLocals *Level, DVector3 tr
// The rotation angle is based on the elapsed time.
if(flags & MDL_ROTATING)
{
objectToWorldMatrix.translate(rotationCenterX, rotationCenterY/stretch, rotationCenterZ);
objectToWorldMatrix.translate(rotationCenterX, rotationCenterZ/stretch, rotationCenterY);
objectToWorldMatrix.rotate(rotateOffset, xrotate, yrotate, zrotate);
objectToWorldMatrix.translate(-rotationCenterX, -rotationCenterY/stretch, -rotationCenterZ);
objectToWorldMatrix.translate(-rotationCenterX, -rotationCenterZ/stretch, -rotationCenterY);
}
}