16 if (ib && (ib.IsBeingPlaced() || ib.IsHologram()))
36 foreach (
Object obj : objects)
47 return obj.CanBeActionTarget();
69 return vicinityObjects;
81 return vicinityObjects;
108 for (
int i = 0; i < objects.Count(); i++)
196 string res =
"ActionTarget dump = {";
201 res = res +
"; m_Utility: " +
m_Utility.ToString();
222 return m_VicinityObjects.GetVicinityObjects();
235 m_VicinityObjects.ClearVicinityObjects();
238 Object firstValidRaycastedObject = null;
243 vector headingDirection = MiscGameplayFunctions.GetHeadingVector(
m_Player);
259 if (sortedResultsCount > 0 )
261 foreach (
int sortedDist : sortedDistanceHelper)
267 if (res.obj && !res.obj.CanBeActionTarget())
271 if (res.hierLevel > 0)
278 sortedValidRaycastResults.Insert(res);
279 resultMap.Insert(res.obj, res);
280 if (!firstValidRaycastedObject)
281 firstValidRaycastedObject = res.obj;
286 if (res.surface && res.surface.GetSurfaceType() !=
"")
298 surfaceParams.
rsd = RoadSurfaceDetection.ABOVE;
302 if (
g_Game.GetSurface(surfaceParams, surfaceResult))
304 if (surfaceResult && surfaceResult.
surface)
317 firstValidRaycastedObject = null;
324 if (camera && camera.GetCurrentPitch() <= -45)
328 vicinityObjects.RemoveItem(
m_Player);
333 m_VicinityObjects.TransformToVicinityObjects(vicinityObjects);
339 int vicinityObjCount = m_VicinityObjects.Count();
340 for (
int i = 0; i < vicinityObjCount; ++i)
342 Object object = m_VicinityObjects.GetObject(i);
348 if (resultMap.Find(
object, result))
356 parent = m_VicinityObjects.GetParent(i);
358 targetComponent = -1;
376 vector contact_pos, contact_dir, hitNormal;
377 int contactComponent;
393 ShowDebugActionTargets(
true);
394 DrawDebugActionTargets(
true);
401 ShowDebugActionTargets(
false);
402 DrawDebugActionTargets(
false);
403 DrawDebugCone(
false);
405 DrawSelectionPos(
false);
433 if (distHelper.Find(distance) == -1)
434 distHelper.Insert(distance);
449 return MiscGameplayFunctions.IsObjectObstructedEx(
object, cache);
464 m_Targets.InsertAt(pActionTarget, index);
473 while ( left <= right )
475 int middle = (left + right) / 2;
476 float middleValue =
m_Targets.Get(middle).GetUtility();
478 if ( middleValue == value )
480 else if ( middleValue < value )
498 if (pTarget == cursorTarget)
501 if (pTarget.GetType() ==
string.Empty)
504 if (pTarget.IsBuilding())
507 if (pTarget.IsTransport())
511 if (pTarget.CanUseConstruction())
514 if (pTarget.IsWell())
548 if ( c1 <= 0 || c2 == 0 )
552 vector nearestPoint = pL1 + (v * b);
560 tmp.Copy(vicinityObjectsOutput);
561 vicinityObjectsOutput.Clear();
562 foreach (
Object obj : tmp)
564 if (obj && vicinityObjectsOutput.Find(obj) == -1)
565 vicinityObjectsOutput.Insert(obj);
571 if (raycastResult.obj && vicinityObjectsOutput.Find(raycastResult.obj) == -1)
572 vicinityObjectsOutput.Insert(raycastResult.obj);
578 #ifdef DIAG_DEVELOPER
584 MiscGameplayFunctions.FilterObstructingObjects(vicinityObjects, obstructingObjects);
586 if ( obstructingObjects.Count() > 0 )
590 int numObstructed = 0;
591 int mCount = m_VicinityObjects.Count();
597 m_VicinityObjects.ClearVicinityObjects();
598 m_VicinityObjects.TransformToVicinityObjects(filteredObjects);
609 int numObstructed = 0;
610 int mCount = m_VicinityObjects.Count();
615 for (
int i = mCount; i >= 0; --i )
617 Object object = m_VicinityObjects.GetObject(i);
618 Object parent = m_VicinityObjects.GetParent(i);
621 if (
object && !parent)
627 m_VicinityObjects.Remove(
object);
634 m_VicinityObjects.Remove(
object);
650 void ShowDebugActionTargets(
bool enabled)
666 float util =
m_Targets.Get(i).GetUtility();
667 int compIdx =
m_Targets.Get(i).GetComponentIndex();
670 compName = obj.GetActionComponentName(compIdx);
671 obj.GetActionComponentNameList(compIdx, compNames);
673 if ( compNames.Count() > 0 )
675 for (
int c = 0; c < compNames.Count(); c++ )
677 DbgUI.
Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compNames[c] +
"| wPos: " + obj.GetWorldPosition() );
682 DbgUI.Text(obj.GetDisplayName() +
" :: " + obj +
" | util: " + util +
" | compIdx: " + compIdx +
" | compName: " + compName +
"| wPos: " + obj.GetWorldPosition() );
690 DbgUI.EndCleanupScope();
693 void DrawDebugActionTargets(
bool enabled)
710 w_pos = obj.GetPosition();
713 w_pos_sphr[1] = w_pos_sphr[1] + 0.5;
716 w_pos_lend[1] = w_pos_lend[1] + 0.5;
735 private void DrawDebugCone(
bool enabled)
738 vector start, end, endL, endR;
747 playerAngle = MiscGameplayFunctions.GetHeadingAngle(
m_Player);
750 start[1] = start[1] + 0.2;
758 endL[0] = endL[0] + xL;
759 endL[2] = endL[2] + zL;
760 endR[0] = endR[0] + xR;
761 endR[2] = endR[2] + zR;
771 private void DrawSelectionPos(
bool enabled)
781 string compName = at.GetObject().GetActionComponentName(at.GetComponentIndex());
782 vector modelPos = at.GetObject().GetSelectionPositionMS(compName);
783 vector worldPos = at.GetObject().ModelToWorld(modelPos);
792 private void DrawDebugRay(
bool enabled)
806 for (
int it = 0; it < shapesArr.Count(); ++it )
808 Shape shape = shapesArr[it];
809 Debug.RemoveShape( shape );
int GetSurfaceLiquidType()
void DbgPrintTargetDump()
void ActionTarget(Object object, Object parent, int componentIndex, vector cursorHitPos, float utility, string surfaceName="")
void SetCursorHitPos(vector cursor_position)
proto native int GetComponentIndex()
void DayZPlayerUtils()
cannot be instantiated
void CleanupDebugShapes(array< Shape > shapesArr)
DEPRECATED.
void IsObjectObstructedCache(vector rayCastStart, int totalObjects)
class PresenceNotifierNoiseEvents windowPosX
dbgUI settings
SurfaceInfo m_SurfaceInfo
first valid hitpos! Used only as rough reference value for conecasted results.
const float c_UtilityMaxDistFromRaySqr
const float c_MaxTargetDistance
const float c_DistanceDelta
int GetTargetsCount()
returns count of founded targets
const float c_UtilityValueCoef
const string CE_CENTER
p3d
const float HEIGHT_OFFSET
ref map< int, ref array< RaycastRVResult > > m_SortedResults
static array< Object > GetVicinityObjects()
array< int > SortResultsDistance(array< ref RaycastRVResult > results)
const int OBSTRUCTED_COUNT_THRESHOLD
misc
void FilterObstructedObjects(Object cursor_target)
void FilterDuplicateVicinityObjects(inout array< Object > vicinityObjectsOutput, array< RaycastRVResult > sortedRaycastResults)
const float c_MaxActionDistance
bool IsObstructedEx(Object object, IsObjectObstructedCache cache)
bool IsObstructed(Object object)
float DistSqrPoint2Line(vector pPoint, vector pL1, vector pL2)
distance between point and line
void StoreTarget(ActionTarget pActionTarget)
inserts action into sorted array based on utility
bool IsRaycastResultException(RaycastRVResult res)
Initial raycast filtering exceptions (can't ask the entity type, sadly)
const float c_RayDistance
searching properties
PlayerBase m_Player
player owner
ActionTarget GetTarget(int index)
returns action target at index
void FilterObstructedObjectsEx(Object cursor_target, array< Object > vicinityObjects)
void ActionTargets(PlayerBase player)
const int GROUPING_COUNT_THRESHOLD
vector CalculateRayStart()
DEPRECATED.
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_UtilityMaxValue
utility constants
int FindIndexForStoring(float value)
binary search algorithm
const float c_ConeHeightMax
const float c_ConeHeightMin
static proto bool RayCastBullet(vector begPos, vector endPos, PhxInteractionLayers layerMask, Object ignoreObj, out Object hitObject, out vector hitPosition, out vector hitNormal, out float hitFraction)
static proto bool RaycastRVProxy(notnull RaycastRVParams in, out notnull array< ref RaycastRVResult > results, array< Object > excluded=null)
override bool IsTakeable()
ref array< Object > Objects
int component
index of component in corresponding geometry level
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 int GetLiquidType()
See 'LiquidTypes' in 'constants.c'.
static proto SurfaceInfo GetByFile(string name)
void Remove(Object object)
bool IsValidVicinityObject(notnull Object obj)
void Remove(array< Object > objects)
void ClearVicinityObjects()
Object GetObject(int i)
returns VicinityObjects Key
void TransformToVicinityObjects(array< Object > objects)
transform simple array of Objects to VicinityObjects hashmap
ref map< Object, Object > m_VicinityObjects
Object GetParent(int i)
returns VicinityObjects Element
void StoreVicinityObject(Object object, Object parent=null)
stores VicinityObject to Hashmap - for storing of parent/child relationship
array< Object > GetRawVicinityObjects()
return simple array of Objects in Vicinity
array< Object > GetVicinityObjects()
return simple array of Objects in Vicinity
objects in vicinity - extended with secondary object which is parent of that Object
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto native float DistanceSq(vector v1, vector v2)
Returns the square distance between tips of two 3D vectors.
static float Dot(vector v1, vector v2)
Returns Dot product of vector v1 and vector v2.
class DayZPlayerCameraResult DayZPlayerCamera(DayZPlayer pPlayer, HumanInputController pInput)
proto void Print(void var)
Prints content of variable to console/log.
static proto native void Begin(string windowTitle, float x=0, float y=0)
static proto native void Text(string label)
static proto void BeginCleanupScope()