PC Stable Documentation
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Loading...
Searching...
No Matches
ActionTargets Class Reference

Private Member Functions

void ActionTargets (PlayerBase player)
 
void Clear ()
 
void Update ()
 
private bool IsObstructed (Object object)
 
private bool IsObstructedEx (Object object, IsObjectObstructedCache cache)
 
int GetTargetsCount ()
 returns count of founded targets
 
ActionTarget GetTarget (int index)
 returns action target at index
 
private void StoreTarget (ActionTarget pActionTarget)
 inserts action into sorted array based on utility
 
private int FindIndexForStoring (float value)
 binary search algorithm
 
private float ComputeUtility (Object pTarget, vector pRayStart, vector pRayEnd, Object cursorTarget, vector hitPos)
 computes utility of target
 
private float DistSqrPoint2Line (vector pPoint, vector pL1, vector pL2)
 distance between point and line
 
private void FilterObstructedObjectsEx (Object cursor_target, array< Object > vicinityObjects)
 
private void FilterObstructedObjects (Object cursor_target)
 
vector CalculateRayStart ()
 DEPRECATED.
 

Static Private Member Functions

static array< ObjectGetVicinityObjects ()
 

Private Attributes

private PlayerBase m_Player
 player owner
 
private ref array< ref ActionTargetm_Targets
 selected & sorted targets by utility function
 
private vector m_RayEnd
 
private vector m_HitPos
 
private const float c_RayDistance = 5.0
 searching properties
 
private const float c_MaxTargetDistance = 3.0
 
private const float c_MaxActionDistance = UAMaxDistances.DEFAULT
 
private const float c_ConeAngle = 30.0
 
private const float c_ConeHeightMin = -0.5
 
private const float c_ConeHeightMax = 2.0
 
private const float c_DistanceDelta = 0.3
 
private const float c_UtilityMaxValue = 10000
 utility constants
 
private const float c_UtilityMaxDistFromRaySqr = 0.8 * 0.8
 
private const string CE_CENTER = "ce_center"
 p3d
 
private const float HEIGHT_OFFSET = 0.2
 
private const int OBSTRUCTED_COUNT_THRESHOLD = 3
 misc
 
private const int GROUPING_COUNT_THRESHOLD = 10
 

Static Private Attributes

static private ref VicinityObjects m_VicinityObjects private bool m_Debug private vector m_RayStart
 objects in vicinity
 

Constructor & Destructor Documentation

◆ ActionTargets()

void ActionTargets ( PlayerBase  player)
inlineprivate

References m_Player, and m_VicinityObjects.

Member Function Documentation

◆ CalculateRayStart()

vector CalculateRayStart ( )
private

DEPRECATED.

◆ Clear()

void Clear ( )
inlineprivate

◆ ComputeUtility()

private float ComputeUtility ( Object  pTarget,
vector  pRayStart,
vector  pRayEnd,
Object  cursorTarget,
vector  hitPos 
)
inlineprivate

computes utility of target

out of reach

ground and static objects

basebuilding objects

References c_MaxTargetDistance, c_UtilityMaxDistFromRaySqr, c_UtilityMaxValue, vector::DistanceSq(), DistSqrPoint2Line(), and m_Player.

◆ DistSqrPoint2Line()

private float DistSqrPoint2Line ( vector  pPoint,
vector  pL1,
vector  pL2 
)
inlineprivate

distance between point and line

References vector::DistanceSq(), and vector::Dot().

Referenced by ComputeUtility().

◆ FilterObstructedObjects()

private void FilterObstructedObjects ( Object  cursor_target)
inlineprivate

check if targets are not obstructed (eg.: wall)

check for object obstruction(if the object is not a proxy - has no parent)

when the number of obstructed items is higher than OBSTRUCTED_COUNT_THRESHOLD remove do no run obstruction check and skip these items

obstruction check

References IsObjectObstructedCache(), IsObstructedEx(), m_RayStart, m_VicinityObjects, and OBSTRUCTED_COUNT_THRESHOLD.

Referenced by FilterObstructedObjectsEx().

◆ FilterObstructedObjectsEx()

private void FilterObstructedObjectsEx ( Object  cursor_target,
array< Object vicinityObjects 
)
inlineprivate

◆ FindIndexForStoring()

private int FindIndexForStoring ( float  value)
inlineprivate

binary search algorithm

References m_Targets.

Referenced by StoreTarget().

◆ GetTarget()

ActionTarget GetTarget ( int  index)
inlineprivate

returns action target at index

References m_Targets.

Referenced by ActionManagerClient::FindActionTarget().

◆ GetTargetsCount()

int GetTargetsCount ( )
inlineprivate

returns count of founded targets

References m_Targets.

Referenced by ActionManagerClient::FindActionTarget().

◆ GetVicinityObjects()

static array< Object > GetVicinityObjects ( )
inlinestaticprivate

References m_VicinityObjects.

◆ IsObstructed()

private bool IsObstructed ( Object  object)
inlineprivate

◆ IsObstructedEx()

private bool IsObstructedEx ( Object  object,
IsObjectObstructedCache  cache 
)
inlineprivate

◆ StoreTarget()

private void StoreTarget ( ActionTarget  pActionTarget)
inlineprivate

inserts action into sorted array based on utility

References FindIndexForStoring(), and m_Targets.

◆ Update()

void Update ( )
inlineprivate

clear state

camera & ray properties

if the cursor target is a proxy

ignores attachments on player

spacial search

removes player from the vicinity

transformation of array of Objects to hashmap (VicinityObjects)

removes Vicinity objects that are not directly visible from player position

select & sort targets based on utility function

action target for surface actions (lowest utility)

Referenced by ActionManagerClient::Update().

Field Documentation

◆ c_ConeAngle

private const float c_ConeAngle = 30.0
private

◆ c_ConeHeightMax

private const float c_ConeHeightMax = 2.0
private

◆ c_ConeHeightMin

private const float c_ConeHeightMin = -0.5
private

◆ c_DistanceDelta

private const float c_DistanceDelta = 0.3
private

◆ c_MaxActionDistance

private const float c_MaxActionDistance = UAMaxDistances.DEFAULT
private

◆ c_MaxTargetDistance

private const float c_MaxTargetDistance = 3.0
private

◆ c_RayDistance

private const float c_RayDistance = 5.0
private

searching properties

◆ c_UtilityMaxDistFromRaySqr

private const float c_UtilityMaxDistFromRaySqr = 0.8 * 0.8
private

Referenced by ComputeUtility().

◆ c_UtilityMaxValue

private const float c_UtilityMaxValue = 10000
private

utility constants

Referenced by ComputeUtility().

◆ CE_CENTER

private const string CE_CENTER = "ce_center"
private

p3d

◆ GROUPING_COUNT_THRESHOLD

private const int GROUPING_COUNT_THRESHOLD = 10
private

◆ HEIGHT_OFFSET

private const float HEIGHT_OFFSET = 0.2
private

◆ m_HitPos

private vector m_HitPos
private

◆ m_Player

private PlayerBase m_Player
private

player owner

Referenced by ActionTargets(), and ComputeUtility().

◆ m_RayEnd

private vector m_RayEnd
private

◆ m_RayStart

private ref VicinityObjects m_VicinityObjects private bool m_Debug private vector m_RayStart
staticprivate

objects in vicinity

Referenced by FilterObstructedObjects(), FilterObstructedObjectsEx(), and IsObstructed().

◆ m_Targets

private ref array<ref ActionTarget> m_Targets
private

selected & sorted targets by utility function

Referenced by FindIndexForStoring(), GetTarget(), GetTargetsCount(), and StoreTarget().

◆ OBSTRUCTED_COUNT_THRESHOLD

private const int OBSTRUCTED_COUNT_THRESHOLD = 3
private

misc

Referenced by FilterObstructedObjects().


The documentation for this class was generated from the following file: