136 {
138
139 if ( player )
140 {
144 vector contact_pos;
145 vector contact_dir;
146 int contactComponent;
147
148 bool hit = DayZPhysics.RaycastRV( from, to, contact_pos, contact_dir, contactComponent, NULL , NULL, player, false, false, ObjIntersectIFire);
149
150
151
152
153
154
155
156 float h = vector.
Distance( from, contact_pos );
157
158 if (hit)
160 else
162
163
164 TextWidget angleText = TextWidget.Cast(
m_Root.FindAnyWidget(
"AngleText"));
165 TextWidget horizText = TextWidget.Cast(
m_Root.FindAnyWidget(
"RangeHDText"));
166
167 vector horizontalTo =
Vector( contact_pos[0], from[1], contact_pos[2] );
168 float a = vector.Distance( from, horizontalTo );
169
170
171 float heightDiff = contact_pos[1] - from[1];
172 float angle = Math.Atan( heightDiff / a ) * Math.RAD2DEG;
173 angle = Math.Round(angle);
174
175 if (angleText)
176 {
177 if (hit)
178 angleText.SetText(string.Format("%1", angle));
179 else
181 }
182
183 if (horizText)
184 {
185 if (hit)
187 else
189 }
190 }
191 }
proto native vector GetCurrentCameraPosition()
proto native vector GetCurrentCameraDirection()
static const float RANGEFINDER_MAX_DISTANCE
void SetDistanceText(TextWidget text, float dist)
void SetInvalidText(TextWidget text)
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
proto native CGame GetGame()
proto native vector Vector(float x, float y, float z)
Vector constructor from components.