195 {
196 int i;
197
201
202 Object cursorTarget = null;
204 array<Object> vicinityObjects = new array<Object>;
205
207 int hitComponentIndex;
208 vector playerPos =
m_Player.GetPosition();
209 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(
m_Player);
210
213
216
217 array<ref RaycastRVResult> results = new array<ref RaycastRVResult>;
218
219 if ( DayZPhysics.RaycastRVProxy(rayInput, results) )
220 {
221 if ( results.Count() > 0 )
222 {
223 array<float> distance_helper = new array<float>;
224 array<float> distance_helper_unsorted = new array<float>;
225 float distance;
226
227 for (i = 0; i < results.Count(); i++)
228 {
229 distance = vector.DistanceSq(results[i].pos,
m_RayStart);
230 distance_helper.Insert(distance);
231
232 }
233
234 distance_helper_unsorted.Copy(distance_helper);
235 distance_helper.Sort();
236
237 RaycastRVResult res;
238
239
240 for ( i = 0; i < results.Count(); i++)
241 {
242 res = results.Get(distance_helper_unsorted.Find(distance_helper[i]));
243
244 cursorTarget = res.
obj;
245 Class.CastTo(cursorTargetEntity,cursorTarget);
246 if (cursorTarget && !cursorTarget.CanBeActionTarget())
247 continue;
250 {
252 if ( !res.
parent.IsMan() )
253 {
255
256 }
257 else
258 continue;
259 }
260 else
261 {
263
264 }
265
268 break;
269 }
270 }
271
272
273 }
274 else
275 {
276
277 cursorTarget = null;
279 hitComponentIndex = -1;
280 }
281
282
283
286 if (camera && camera.GetCurrentPitch() <= -45)
288
290 vicinityObjects.RemoveItem(
m_Player);
291
293
295
296
299
302 {
305
307 if ( utility > 0 )
308 {
309 int targetComponent = -1;
310 targetComponent = hitComponentIndex;
311
314 }
315
316
317 }
318
321 {
322 vector contact_pos, contact_dir, hitNormal;
323 int contactComponent;
324 float hitFraction;
326
328
330 DayZPhysics.RayCastBullet(
m_RayStart,
m_RayEnd,collisionLayerMask,null,hitObject,contact_pos,hitNormal,hitFraction);
332 }
333
335
336#ifdef DIAG_DEVELOPER
337 if (DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
338 {
339 ShowDebugActionTargets(true);
340 DrawDebugActionTargets(true);
341 DrawDebugCone(true);
342 DrawDebugRay(true);
343 DrawSelectionPos(DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_SELPOS_DEBUG));
344 }
345 else
346 {
347 ShowDebugActionTargets(false);
348 DrawDebugActionTargets(false);
349 DrawDebugCone(false);
350 DrawDebugRay(false);
351 DrawSelectionPos(false);
352 }
353#endif
354
355 }
class ActionTargets ActionTarget
ref map< Object, Object > m_VicinityObjects
void DayZPlayerUtils()
cannot be instantiated
const float c_MaxTargetDistance
void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
const float c_RayDistance
searching properties
PlayerBase m_Player
player owner
void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
vector m_RayStart
objects in vicinity
ref array< ref ActionTarget > m_Targets
selected & sorted targets by utility function
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
computes utility of target
const float c_ConeHeightMax
const float c_ConeHeightMin
proto native vector GetCurrentCameraPosition()
proto native vector GetCurrentCameraDirection()
Object obj
object,that we collide with (NULL if none), If hierLevel > 0 object is the proxy object
int component
index of component in corresponding geometry level
int hierLevel
which hierarchy level is the collision detected at, == 0 = objects in landscape, > 0 = proxy
vector pos
position of collision (in world coord)
Object parent
if hierLevel > 0 most parent of the proxy object
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
proto native CGame GetGame()