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

◆ IsPlayerInside()

override bool TentBase::IsPlayerInside ( PlayerBase player,
string selection )
inlineprivate

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

56 {
57 vector player_pos = player.GetPosition();
58 vector shelter_pos = GetPosition();
59 vector ref_dir = GetDirection();
60 ref_dir[1] = 0;
61 ref_dir.Normalize();
62
63 vector x[2];
64 vector b1,b2;
65 GetCollisionBox(x);
66 b1 = x[0];
67 b2 = x[1];
68
69 vector dir_to_shelter = shelter_pos - player_pos;
70 dir_to_shelter[1] = 0;
71 float len = dir_to_shelter.Length();
72
73 dir_to_shelter.Normalize();
74
75 vector ref_dir_angle = ref_dir.VectorToAngles();
76 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
77 vector test_angles = dir_to_shelter_angle - ref_dir_angle;
78
79 vector test_position = test_angles.AnglesToVector() * len;
80
81 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
82 {
83 return false;
84 }
85 else
86 {
87 return true;
88 }
89 }
Icon x
proto native float Length()
Returns length of vector (magnitude)
proto float Normalize()
Normalizes vector. Returns length.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
class JsonUndergroundAreaTriggerData GetPosition
Определения UndergroundAreaLoader.c:9

Перекрестные ссылки vector::AnglesToVector(), GetPosition, vector::Length(), vector::Normalize(), vector::VectorToAngles() и x.