[saco] Implement/match CEntity::GetDistanceFromCamera()

This commit is contained in:
RD42 2024-08-07 19:02:25 +08:00
parent 669437e30b
commit fa0b2fb065
2 changed files with 18 additions and 0 deletions

View File

@ -263,6 +263,23 @@ float CEntity::GetDistanceFromLocalPlayerPed()
//-----------------------------------------------------------
float CEntity::GetDistanceFromCamera()
{
if(!m_pEntity || m_pEntity->vtable == 0x863C40) return 100000.0f;
MATRIX4X4 matThis;
float fSX,fSY,fSZ;
GetMatrix(&matThis);
fSX = (matThis.pos.X - *(float*)0xB6F9CC) * (matThis.pos.X - *(float*)0xB6F9CC);
fSY = (matThis.pos.Y - *(float*)0xB6F9D0) * (matThis.pos.Y - *(float*)0xB6F9D0);
fSZ = (matThis.pos.Z - *(float*)0xB6F9D4) * (matThis.pos.Z - *(float*)0xB6F9D4);
return (float)sqrt(fSX + fSY + fSZ);
}
//-----------------------------------------------------------
float CEntity::GetDistanceFromPoint(float X, float Y, float Z)
{
MATRIX4X4 matThis;

View File

@ -26,6 +26,7 @@ public:
UINT GetModelIndex();
void TeleportTo(float x, float y, float z);
float GetDistanceFromLocalPlayerPed();
float GetDistanceFromCamera();
float GetDistanceFromPoint(float X, float Y, float Z);
BOOL IsStationary();