Arma Reforger Script API
Loading...
Searching...
No Matches
SCR_EmptyPositionHelper Interface Reference

Static Public Member Functions

static bool TryFindNearbyFloorPositionForEntity (BaseWorld world, IEntity entity, vector position=vector.Zero, out vector floorPos=vector.Zero)
 Finds nearby floor position with enough space for the entity, considering its amphibious trait if applicable.
 
static bool TryFindNearbyFloorPosition (BaseWorld world, vector position, TraceParam traceParam, float minHeight, float spacing, float maxDistance=100, bool isAmphibious=false, float maxSubmersionDepth=0, out vector floorPos="0 0 0")
 Attempts to find a nearby position with suitable space defined by traceParam.
 
static bool TryGetValidFloorPosition (BaseWorld world, vector position, float minHeight, TraceParam traceParam, float minFloorY, float bonusTraceLength, out vector floorPos, out vector ceilingPos)
 Checks if there's a floor with enough empty space above it.
 
static bool TryDetectSurface (BaseWorld world, TraceParam traceParam, out vector surfacePos)
 Detects surface position along trace path in world, returns true if surface was found.
 
static bool TryGetValidFloorPositionWithPreTrace (BaseWorld world, vector position, float minHeight, TraceParam traceParam, float minFloorY, TraceParam preTraceParam, out vector floorPos, out vector ceilingPos)
 Wraps TryGetValidFloorPosition Adds a pre-trace to allow better room finding in cluttered spaces like interiors and offices.
 
static float GetTraceParamHeight (TraceParam traceParam)
 Calculates height from trace parameter supports derivatives of TraceBox or TraceSphere.
 
static vector RaiseToTerrain (BaseWorld world, vector position, float offset=0)
 Raises position to be above ocean height with optional offset.
 
static float GetMinYOnTerrainOrOcean (BaseWorld world, vector position, float maxSubmersionDepth)
 Returns minimum height allowed for a valid floor over terrain or ocean considering max submersion depth.
 
static TraceSphere CreatePreTraceParam (TraceParam traceParam)
 Clones properties from TraceParam to create a TraceSphere with small radius.
 

Static Public Attributes

static const float MAX_SCAN_LENGTH = 50
 
static const int SPHERE_AMOUNT_LIMIT = 3
 
static const float TRACE_EPSILON = 0.01
 
static const float CHARACTER_BOUNDING_RADIUS_MODIFIER = 0.75
 
static const float CHARACTER_SPACING_MODIFIER = 0.5
 

Static Protected Member Functions

static SCR_EditableEntityUIInfo GetEntityUIInfo (IEntity entity)
 Tries to get SCR_EditableEntityUIInfo from entity.
 
static float Pow2 (float base)
 Squares a value.
 

Static Protected Attributes

static const string DEBUG_TAG = "SCR_EmptyPositionHelper"
 

Member Function Documentation

◆ CreatePreTraceParam()

static TraceSphere SCR_EmptyPositionHelper.CreatePreTraceParam ( TraceParam traceParam)
static

Clones properties from TraceParam to create a TraceSphere with small radius.

Pre-traces allow better room finding in cluttered spaces like interiors and offices.

Parameters
[in]traceParamTraceParam represents input parameters for sphere tracing, including flags, layer mask, radii, exclusions, and inclusions.
Returns
a pre-trace parameter with adjusted radius and same flags, layer mask, exclusions, inclusions, and arrays as

◆ GetEntityUIInfo()

static SCR_EditableEntityUIInfo SCR_EmptyPositionHelper.GetEntityUIInfo ( IEntity entity)
staticprotected

Tries to get SCR_EditableEntityUIInfo from entity.

Parameters
[in]entityRepresents an in-game object with editable properties.
Returns
the SCR_EditableEntityUIInfo associated with the entity.

◆ GetMinYOnTerrainOrOcean()

static float SCR_EmptyPositionHelper.GetMinYOnTerrainOrOcean ( BaseWorld world,
vector position,
float maxSubmersionDepth )
static

Returns minimum height allowed for a valid floor over terrain or ocean considering max submersion depth.

Parameters
[in]worldGame world.
[in]maxSubmersionDepthMaxSubmersionDepth represents the maximum depth at which the object can submerge in water.
Returns
the minimum height of a valid floor.

◆ GetTraceParamHeight()

static float SCR_EmptyPositionHelper.GetTraceParamHeight ( TraceParam traceParam)
static

Calculates height from trace parameter supports derivatives of TraceBox or TraceSphere.

Parameters
[in]traceParamTraceParam to determine height of.
Returns
height of trace.

◆ Pow2()

static float SCR_EmptyPositionHelper.Pow2 ( float base)
staticprotected

Squares a value.

Parameters
[in]Value
Returns
square

◆ RaiseToTerrain()

static vector SCR_EmptyPositionHelper.RaiseToTerrain ( BaseWorld world,
vector position,
float offset = 0 )
static

Raises position to be above ocean height with optional offset.

Will not do anything if the position is already above the ocean + offset.

Parameters
[in]worldGame world.
[in]positionPosition checked if bellow ocean and raised if it is.
[in]offsetOffset is an optional parameter that adds to the position's height above ocean level.
Returns
the modified position with height adjusted to ocean level plus offset.

◆ TryDetectSurface()

static bool SCR_EmptyPositionHelper.TryDetectSurface ( BaseWorld world,
TraceParam traceParam,
out vector surfacePos )
static

Detects surface position along trace path in world, returns true if surface was found.

Parameters
[in]worldGame world.
[in]traceParamTraceParam needs to have everythging nessary defined.
[out]surfacePosSurface position of center of trace in 3D space where the trace intersects a surface.
Returns
True if a surface was detected.

◆ TryFindNearbyFloorPosition()

static bool SCR_EmptyPositionHelper.TryFindNearbyFloorPosition ( BaseWorld world,
vector position,
TraceParam traceParam,
float minHeight,
float spacing,
float maxDistance = 100,
bool isAmphibious = false,
float maxSubmersionDepth = 0,
out vector floorPos = "0 0 0" )
static

Attempts to find a nearby position with suitable space defined by traceParam.

Parameters
[in]worldGame world.
[in]positionThe start position for searching.
[in,out]traceParamTraceParam must define a shape with dimensions.
[in]minHeightMinimum scan length is the minimum distance that the shape must be traced.
[in]spacingSpacing represents the distance between checks, this should be atleast or greater than the size of the entity.
[in]maxDistanceMaxDistance is the maximum distance from the start position to search for a valid floor positions.
[in]isAmphibiousAmphibious switch indicates whether the search for floor position should consider ocean surface as a valid floor.
[out]floorPosRepresents the final found floor position within the specified search area.
Returns
True if a valid floor was found.

◆ TryFindNearbyFloorPositionForEntity()

static bool SCR_EmptyPositionHelper.TryFindNearbyFloorPositionForEntity ( BaseWorld world,
IEntity entity,
vector position = vector::Zero,
out vector floorPos = vector::Zero )
static

Finds nearby floor position with enough space for the entity, considering its amphibious trait if applicable.

Does not move or modify the entity.

Parameters
[in]worldGame world.
[in]entityEntity is used to define Trace params, amphibious trait, and position*.
[in]positionOptional position to use for searching from instead of entity.GetOrigin().
[out]floorPosIf successful it is the floor with enough space for the entity can stand.
Returns
True if a floor with enough space was found.

◆ TryGetValidFloorPosition()

static bool SCR_EmptyPositionHelper.TryGetValidFloorPosition ( BaseWorld world,
vector position,
float minHeight,
TraceParam traceParam,
float minFloorY,
float bonusTraceLength,
out vector floorPos,
out vector ceilingPos )
static

Checks if there's a floor with enough empty space above it.

Ocean surface counts as a floor. Does not scan further than MAX_SCAN_LENGTH

Parameters
[in]worldGame world.
[in]positionPosition to start search from.
[in]minHeightMinHeight is the minimium length that the shape needs to be trace out to fit the height requirement for empty space above the floor.
[in]traceParamTraceParam should specify flags, entities, shape, and size to trace. Start and end position are overwritten on reference.
[in]Ifthe scanned floor position is lower than this, the function will return false.
[in]Extraceiling height to scan for if knowing the ceiling is desired.
[out]floorPosRepresents the position of the floor detected by tracing downwards from the input position.
[out]ceilingPosCeiling position represents the ceiling detected by tracing upwards. Limited to floor + minHeight.
Returns
True if a floor with enough empty space was found.

◆ TryGetValidFloorPositionWithPreTrace()

static bool SCR_EmptyPositionHelper.TryGetValidFloorPositionWithPreTrace ( BaseWorld world,
vector position,
float minHeight,
TraceParam traceParam,
float minFloorY,
TraceParam preTraceParam,
out vector floorPos,
out vector ceilingPos )
static

Wraps TryGetValidFloorPosition Adds a pre-trace to allow better room finding in cluttered spaces like interiors and offices.

Parameters
[in]worldGame world.
[in]positionPosition to start search from.
[in]minHeightMinHeight is the minimium length that the shape needs to be trace out to fit the height requirement for empty space above the floor.
[in]traceParamTraceParam should specify flags, entities, shape, and size to trace. Start and end position are overwritten on reference.
[out]Ifthe scanned floor position is lower than this, the function will return false.
[out]floorPosRepresents the position of the floor detected by tracing downwards from the input position.
[out]ceilingPosCeiling position represents the ceiling detected by tracing upwards. Limited to floor + minHeight.
Returns
True if a floor with enough empty space was found.

Member Data Documentation

◆ CHARACTER_BOUNDING_RADIUS_MODIFIER

const float SCR_EmptyPositionHelper.CHARACTER_BOUNDING_RADIUS_MODIFIER = 0.75
static

◆ CHARACTER_SPACING_MODIFIER

const float SCR_EmptyPositionHelper.CHARACTER_SPACING_MODIFIER = 0.5
static

◆ DEBUG_TAG

const string SCR_EmptyPositionHelper.DEBUG_TAG = "SCR_EmptyPositionHelper"
staticprotected

◆ MAX_SCAN_LENGTH

const float SCR_EmptyPositionHelper.MAX_SCAN_LENGTH = 50
static

◆ SPHERE_AMOUNT_LIMIT

const int SCR_EmptyPositionHelper.SPHERE_AMOUNT_LIMIT = 3
static

◆ TRACE_EPSILON

const float SCR_EmptyPositionHelper.TRACE_EPSILON = 0.01
static

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