Found another solution:
PHP Code:
void GetEntityCoordinates(int entity, float vecMins[3], float vecMaxs[3], float vecOrigin[3])
{
GetEntPropVector(entity, Prop_Data, "m_vecAbsOrigin", vecOrigin);
GetEntPropVector(entity, Prop_Data, "m_vecMins", vecMins);
GetEntPropVector(entity, Prop_Data, "m_vecMaxs", vecMaxs);
float buffer[3];
float points[8][3];
float coordinateFrame[3][3];
coordinateFrame[0][0] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 0);
coordinateFrame[0][1] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 1);
coordinateFrame[0][2] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 2);
coordinateFrame[1][0] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 4);
coordinateFrame[1][1] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 5);
coordinateFrame[1][2] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 6);
coordinateFrame[2][0] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 8);
coordinateFrame[2][1] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 9);
coordinateFrame[2][2] = GetEntPropFloat(entity, Prop_Data, "m_rgflCoordinateFrame", 10);
points[0][0] = vecMins[0];
points[0][1] = vecMins[1];
points[0][2] = vecMins[2];
points[1][0] = vecMins[0];
points[1][1] = vecMaxs[1];
points[1][2] = vecMins[2];
points[2][0] = vecMaxs[0];
points[2][1] = vecMaxs[1];
points[2][2] = vecMins[2];
points[3][0] = vecMaxs[0];
points[3][1] = vecMins[1];
points[3][2] = vecMins[2];
points[4][0] = vecMins[0];
points[4][1] = vecMins[1];
points[4][2] = vecMaxs[2];
points[5][0] = vecMins[0];
points[5][1] = vecMaxs[1];
points[5][2] = vecMaxs[2];
points[6][0] = vecMaxs[0];
points[6][1] = vecMaxs[1];
points[6][2] = vecMaxs[2];
points[7][0] = vecMaxs[0];
points[7][1] = vecMins[1];
points[7][2] = vecMaxs[2];
for (int i = 0; i < 8; i++)
{
buffer = points[i];
for (int j = 0; j < 3; j++)
{
points[i][j] = GetVectorDotProduct(buffer, coordinateFrame[j]);
}
}
vecMins = points[0];
vecMaxs = points[0];
for (int i = 1; i < 8; i++)
{
for (int j = 0; j < 3; j++)
{
if (points[i][j] < vecMins[j])
{
vecMins[j] = points[i][j];
}
if (points[i][j] > vecMaxs[j])
{
vecMaxs[j] = points[i][j];
}
}
}
}
But the box expands too much sometimes:
https://imgur.com/a/oGI8aEL
When angRotation % 360 is close to 0, the bounding box is correct.
__________________