225 {
226 int i;
227
229 m_VicinityObjects.ClearVicinityObjects();
231
232 Object cursorTarget = null;
234 array<Object> vicinityObjects = new array<Object>;
235
237 int hitComponentIndex;
238 vector playerPos =
m_Player.GetPosition();
239 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(
m_Player);
240
243
246
247 array<ref RaycastRVResult> results = new array<ref RaycastRVResult>;
248
249 if ( DayZPhysics.RaycastRVProxy(rayInput, results) )
250 {
251 if ( results.Count() > 0 )
252 {
253 array<float> distance_helper = new array<float>;
254 array<float> distance_helper_unsorted = new array<float>;
255 float distance;
256
257 for (i = 0; i < results.Count(); i++)
258 {
259 distance = vector.DistanceSq(results[i].pos,
m_RayStart);
260 distance_helper.Insert(distance);
261
262 }
263
264 distance_helper_unsorted.Copy(distance_helper);
265 distance_helper.Sort();
266
267 RaycastRVResult res;
268
269 for (i = 0; i < results.Count(); i++)
270 {
271 res = results.Get(distance_helper_unsorted.Find(distance_helper[i]));
272
273 cursorTarget = res.
obj;
274 Class.CastTo(cursorTargetEntity,cursorTarget);
275 if (cursorTarget && !cursorTarget.CanBeActionTarget())
276 continue;
279 {
282 {
283 m_VicinityObjects.StoreVicinityObject(res.
obj, res.
parent);
284
285 }
286 else
287 continue;
288 }
289 else
290 {
291 m_VicinityObjects.StoreVicinityObject(res.
obj, null);
292
293 }
294
297
299 {
301 }
302 else
303 {
305 SurfaceDetectionParameters surfaceParams = new SurfaceDetectionParameters();
310 surfaceParams.
rsd = RoadSurfaceDetection.ABOVE;
311
313 SurfaceDetectionResult surfaceResult = new SurfaceDetectionResult();
314 if (
g_Game.GetSurface(surfaceParams, surfaceResult))
315 {
316 if (surfaceResult && surfaceResult.
surface)
317 {
319 }
320 }
321 }
322 break;
323 }
324 }
325
326
327 }
328 else
329 {
330
331 cursorTarget = null;
334 hitComponentIndex = -1;
335 }
336
337
338
341 if (camera && camera.GetCurrentPitch() <= -45)
343
345 vicinityObjects.RemoveItem(
m_Player);
346
348
349 m_VicinityObjects.TransformToVicinityObjects(vicinityObjects);
350
351
354
356 for (i = 0; i < m_VicinityObjects.Count(); i++)
357 {
358 Object object = m_VicinityObjects.GetObject(i);
359 Object parent = m_VicinityObjects.GetParent(i);
360
362 if (utility > 0)
363 {
364 int targetComponent = -1;
365 targetComponent = hitComponentIndex;
366
367 string surfaceName;
370
373 }
374
375
376 }
377
380 {
381 vector contact_pos, contact_dir, hitNormal;
382 int contactComponent;
383 float hitFraction;
385
387
389 DayZPhysics.RayCastBullet(
m_RayStart,
m_RayEnd,collisionLayerMask,null,hitObject,contact_pos,hitNormal,hitFraction);
391 }
392
394
395#ifdef DIAG_DEVELOPER
396 if (DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_DEBUG))
397 {
398 ShowDebugActionTargets(true);
399 DrawDebugActionTargets(true);
400 DrawDebugCone(true);
401 DrawDebugRay(true);
402 DrawSelectionPos(DiagMenu.GetBool(
DiagMenuIDs.MISC_ACTION_TARGETS_SELPOS_DEBUG));
403 }
404 else
405 {
406 ShowDebugActionTargets(false);
407 DrawDebugActionTargets(false);
408 DrawDebugCone(false);
409 DrawDebugRay(false);
410 DrawSelectionPos(false);
411 }
412#endif
413
414 }
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
void DayZPlayerUtils()
cannot be instantiated
SurfaceInfo m_SurfaceInfo
const float c_MaxTargetDistance
float ComputeUtility(Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos, SurfaceInfo surfaceInfo)
computes utility of target
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
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
SurfaceInfo surface
surface material info handle
vector pos
position of collision (in world coord)
Object parent
if hierLevel > 0 most parent of the proxy object
bool includeWater
Include water in the surface detection, will return the water if it is higher than the surface.
SurfaceDetectionType type
Type of surface to detect.
RoadSurfaceDetection rsd
See RoadSurfaceDetection, SurfaceTraceType.Roadway only.
vector position
3D position to trace the surface from
UseObjectsMode syncMode
See UseObjectsMode, SurfaceTraceType.Roadway only.
SurfaceInfo surface
Returned SurfaceInfo, plain pointer.
proto string GetSurfaceType()
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
proto native CGame GetGame()