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

◆ IsPlayerInside()

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

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

69 {
70 vector player_pos = player.GetPosition();
71 vector shelter_pos = GetPosition();
72 vector ref_dir = GetDirection();
73 ref_dir[1] = 0;
74 ref_dir.Normalize();
75
76 vector x[2];
77 vector b1,b2;
78 GetCollisionBox(x);
79 b1 = x[0];
80 b2 = x[1];
81
82 vector dir_to_shelter = shelter_pos - player_pos;
83 dir_to_shelter[1] = 0;
84 float len = dir_to_shelter.Length();
85
86 dir_to_shelter.Normalize();
87
88 vector ref_dir_angle = ref_dir.VectorToAngles();
89 vector dir_to_shelter_angle = dir_to_shelter.VectorToAngles();
90 vector test_angles = dir_to_shelter_angle - ref_dir_angle;
91
92 vector test_position = test_angles.AnglesToVector() * len;
93
94 if (test_position[0] < b1[0] || test_position[0] > b2[0] || test_position[2] < 0.2 || test_position[2] > 2.2 )
95 {
96 return false;
97 }
98 else
99 {
100 return true;
101 }
102 }
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.
vector GetPosition()
Get the world position of the Effect.
Определения Effect.c:473

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