Fix anglesensor

► This fix is intended to handle player entities more accurately by using their eye direction (view direction) instead of their general forward vector. This would correct cases where something relies on the player's view angle, such as sensors, targeting, or alignment systems, ensuring that the player’s actual looking direction is used.
This commit is contained in:
speedvoltage 2025-03-12 17:15:13 +01:00
parent a62efecf62
commit ea02b64cf6

View file

@ -216,7 +216,14 @@ void CPointAngleSensor::Think(void)
if (m_hTargetEntity != NULL)
{
Vector forward;
m_hTargetEntity->GetVectors(&forward, NULL, NULL);
if ( dynamic_cast< CBasePlayer * >( m_hTargetEntity.Get() ) != NULL )
{
dynamic_cast< CBasePlayer * >( m_hTargetEntity.Get() )->EyeVectors( &forward, NULL, NULL );
}
else
{
m_hTargetEntity->GetVectors( &forward, NULL, NULL );
}
m_TargetDir.Set(forward, this, this);
if (m_hLookAtEntity != NULL)