DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ GetNearestDoorBySoundPos()

int EntityAI::GetNearestDoorBySoundPos ( vector position)
inlineprivate

Gets the nearest door based on the sound position (quick and dirty function for debugging)

См. определение в файле Building.c строка 66

67 {
68 float smallestDist = float.MAX;
69 int nearestDoor = -1;
70
71 int count = GetDoorCount();
72 for (int i = 0; i < count; i++)
73 {
74 float dist = vector.DistanceSq(GetDoorSoundPos(i), position);
75 if (dist < smallestDist)
76 {
77 nearestDoor = i;
78 smallestDist = dist;
79 }
80 }
81
82 return nearestDoor;
83 }
proto native int GetDoorCount()
Returns the number of the doors in the building.
proto native vector GetDoorSoundPos(int index)
Position in world space for where the door sounds are played from.

Перекрестные ссылки vector::DistanceSq(), GetDoorCount() и GetDoorSoundPos().

Используется в OnAction().