[saco] Implement/match CEntity::SetEulerAngles(...)

This commit is contained in:
RD42 2024-11-03 23:30:11 +08:00
parent ddbda01200
commit 39edded764
2 changed files with 31 additions and 0 deletions

View File

@ -623,6 +623,36 @@ DWORD CEntity::GetWorldBoundRadius()
return 0; return 0;
} }
//-----------------------------------------------------------
void CEntity::SetEulerAngles(float fX, float fY, float fZ)
{
fX *= (PI/180.0f);
fY *= (PI/180.0f);
fZ *= (PI/180.0f);
float fCX = cos(fX);
float fSX = sin(fX);
float fCY = cos(fY);
float fSY = sin(fY);
float fCZ = cos(fZ);
float fSZ = sin(fZ);
float fSS = fSZ * fSX;
float fCS = fCZ * fSX;
m_pEntity->mat->right.X = fCZ * fCY - fSS * fSY;
m_pEntity->mat->right.Y = fCS * fSY + fSZ * fCY;
m_pEntity->mat->right.Z = -(fSY * fCX);
m_pEntity->mat->up.X = -(fSZ * fCX);
m_pEntity->mat->up.Y = fCZ * fCX;
m_pEntity->mat->up.Z = fSX;
m_pEntity->mat->at.X = fSS * fCY + fCZ * fSY;
m_pEntity->mat->at.Y = fSZ * fSY - fCS * fCY;
m_pEntity->mat->at.Z = fCY * fCX;
}
//-----------------------------------------------------------

View File

@ -47,6 +47,7 @@ public:
void MakeNonCollidable(); void MakeNonCollidable();
void SetClumpAlpha(int iAlpha); void SetClumpAlpha(int iAlpha);
DWORD GetWorldBoundRadius(); DWORD GetWorldBoundRadius();
void SetEulerAngles(float fX, float fY, float fZ);
virtual void Add(); virtual void Add();
virtual void Remove(); virtual void Remove();