210 {
212
213 array<Object> objectsInVicinity = new array<Object>();
214 array<CargoBase> proxyCargos = new array<CargoBase>();
215 array<Object> filteredObjects = new array<Object>();
216 array<Object> allFoundObjects = new array<Object>();
217 vector playerPosition = player.GetPosition();
218 vector playerHeadPositionFixed = playerPosition;
220 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(player);
221
223 bool cameraActive = FreeDebugCamera.GetInstance() && FreeDebugCamera.GetInstance().IsActive();
224 if (cameraActive)
225 {
226 playerPosition = FreeDebugCamera.GetInstance().GetPosition();
227 playerHeadPositionFixed = playerPosition;
228
229 float headingAngle = FreeDebugCamera.GetInstance().GetOrientation()[0] * Math.DEG2RAD;
230
231 headingDirection[0] = Math.Cos(headingAngle);
232 headingDirection[1] = 0;
233 headingDirection[2] = Math.Sin(headingAngle);
235 }
236
239
242
243
244
246
247
248 foreach (CargoBase cargoObject : proxyCargos)
250
251
252 foreach (
Object actorInRadius : objectsInVicinity)
253 {
255 allFoundObjects.Insert(actorInRadius);
256
258 continue;
259
261 filteredObjects.Insert(actorInRadius);
262 }
263
264 if (objectsInVicinity)
265 objectsInVicinity.Clear();
266
267
269
270
271
272 foreach (
Object objectInRadius : objectsInVicinity)
273 {
275 allFoundObjects.Insert(objectInRadius);
276
278 continue;
279
281 filteredObjects.Insert(objectInRadius);
282 }
283
284 if (objectsInVicinity)
285 objectsInVicinity.Clear();
286
287
289
290
291 RaycastRVParams rayInput;
292 array<ref RaycastRVResult> raycastResults = new array<ref RaycastRVResult>();
293
294 foreach (
Object objectInCone : objectsInVicinity)
295 {
297 allFoundObjects.Insert(objectInCone);
298
300 continue;
301
303 {
304 rayInput = new RaycastRVParams(playerHeadPositionFixed, objectInCone.GetPosition());
306 rayInput.
type = ObjIntersectView;
308 DayZPhysics.RaycastRVProxy(rayInput, raycastResults, {player});
309
310
311 foreach (RaycastRVResult result : raycastResults)
312 {
314 continue;
315
316 if (result.hierLevel > 0)
317 {
318 if (result.parent.CanProxyObstruct())
319 break;
320
321 if (result.parent == objectInCone)
322 {
323 filteredObjects.Insert(objectInCone);
324 break;
325 }
326 }
327 else
328 {
329 if (result.obj == objectInCone)
330 {
331 filteredObjects.Insert(objectInCone);
332 break;
333 }
334 }
335 }
336 }
337 }
338
339
340 BoxCollidingParams params = new BoxCollidingParams();
341 vector boxEdgeLength = {
345 };
346
347 params.
SetParams(playerPosition, headingDirection.
VectorToAngles(), boxEdgeLength * 2, ObjIntersect.View, ObjIntersect.Fire,
true);
348 array<ref BoxCollidingResult> results = new array<ref BoxCollidingResult>();
349 if (
GetGame().IsBoxCollidingGeometryProxy(params, {player}, results))
350 {
351 foreach (BoxCollidingResult bResult : results)
352 {
353 if (bResult.obj && (bResult.obj.CanObstruct() || bResult.obj.CanProxyObstruct()))
354 {
356 allFoundObjects.Insert(bResult.obj);
357 }
358
359 if (bResult.parent && (bResult.parent.CanObstruct() || bResult.parent.CanProxyObstruct()))
360 {
362 allFoundObjects.Insert(bResult.parent);
363 }
364 }
365 }
366
367
368 array<Object> obstructingObjects = new array<Object>();
369 MiscGameplayFunctions.FilterObstructingObjects(allFoundObjects, obstructingObjects);
370
372 if (obstructingObjects.Count() > 0 && !cameraActive)
373 {
374
375 if (filteredObjects.Count() > 10)
376 {
377 array<Object> filteredObjectsGrouped = new array<Object>();
379
380 foreach (
Object object: filteredObjectsGrouped)
382 }
383 else
384 {
385 foreach (
Object filteredObjectClose: filteredObjects)
386 {
388 Class.CastTo(entity, filteredObjectClose);
389
390
392 {
394 {
395 continue;
396 }
397 }
398
400 {
402 }
403 }
404 }
405 }
406 else
407 {
408 foreach (
Object filteredObject: filteredObjects)
410 }
411 }
void DayZPlayerUtils()
cannot be instantiated
proto native void SetParams(vector center, vector orientation, vector edgeLength, ObjIntersect primaryType, ObjIntersect secondaryType, bool fullComponentInfo)
Set the parameters.
proto native void GetObjectsAtPosition3D(vector pos, float radius, out array< Object > objects, out array< CargoBase > proxyCargos)
Returns list of all objects in sphere "radius" around position "pos".
float radius
radius along the ray tested
bool IsObstructed(Object filtered_object)
const float VICINITY_CONE_DISTANCE
const float VICINITY_CONE_REACH_DISTANCE
void AddVicinityCargos(CargoBase object)
const float VICINITY_ACTOR_DISTANCE
const float CONE_HEIGHT_MIN
bool ExcludeFromContainer_Phase3(Object object_in_cone)
bool ExcludeFromContainer_Phase1(Object actor_in_radius)
float GetFixedHeadHeightAdjustment(PlayerBase player)
const float CONE_HEIGHT_MAX
const float VICINITY_LARGE_ACTOR_DISTANCE
void AddVicinityItems(Object object)
const float VICINITY_CONE_ANGLE
ref array< EntityAI > m_VicinityItems
const float VICINITY_DISTANCE
bool ExcludeFromContainer_Phase2(Object object_in_radius)
bool CanIgnoreDistanceCheck(EntityAI entity_ai)
ref array< CargoBase > m_VicinityCargos
proto float Normalize()
Normalizes vector. Returns length.
proto vector VectorToAngles()
Converts vector to spherical coordinates with radius = 1.
const int INDEX_NOT_FOUND
proto native CGame GetGame()