PathEngine home | previous: | next: |
Finds the closest unobstructed position to a specified target, within a specified query range and within local mesh as defined by a set of supplied root positions, if one exists (with an optional connectivity constraint based on connected regions preprocess).
cPosition findClosestUnobstructedPositionEx(const iShape& shape, const iCollisionContext* context, cPosition const * rootPositions_Buffer, uint32_t rootPositions_BufferEntries, const cHorizontalRange& queryRegion, int32_t targetX, int32_t targetY, int32_t const * permittedConnectedRegions_Buffer, uint32_t permittedConnectedRegions_BufferEntries) const; |
shape | The agent shape to use for this query. | ||
context |
The state of dynamic collision that will apply for this query. An empty context can be specified by passing nullptr for this argument. | ||
rootPositions_Buffer, rootPositions_BufferEntries |
(See | ||
queryRegion | Minimum and maximum bounds for the query in X and Y. (Values must be inside the PathEngine horizontal coordinate range limit, and this range must contain all of the supplied root positions.) | ||
targetX | Target X coordinate. (Must be within the PathEngine horizontal coordinate range limit.) | ||
targetY | Target Y coordinate. (Must be within the PathEngine horizontal coordinate range limit.) | ||
permittedConnectedRegions_Buffer, permittedConnectedRegions_BufferEntries |
(See |
Requires that unobstructed space has been generated on this mesh for the query shape.
If a connectivity constraint is applied (i.e. if permittedConnectedRegions is non empty) then connected region preprocess must also be present for that shape.
This method searches for the nearest point (in terms of the horizontal distance component) to the specified target coordinates.
The position array arguments supply a set of root positions, which must all be inside queryRegion.
The query will then only search for candidates within mesh which is locally reachable through ground mesh
within this queryRegion.
(The main intended use-case for this, at the time of writing, is to pass through a set of root positions obtained
from
The target position (specified with targetX and targetY) then specify the position from which distances should be measured, i.e. the query attempts to find the closest unobstructed position to this point.
Note that this method differs from the simpler
If a connectivity constraint is supplied then only positions that are within the specified set of connected regions will be considered.
If there is a preprocessed obstacle set included in context then connected regions will be checked against the connected region preprocess from this preprocessed obstacle set (and the supplied region IDs should then come from that preprocessed obstacle set), otherwise connected regions will be checked against base mesh connected region preprocess.
Note that the query supports more than one connected region ID to enable the calling application to keep track of a set of connected regions that are reachable through off-mesh connections, if desired (but this could also be used, more generally, just to find positions that are reachable from more than one connected region).
PathEngine.Position findClosestUnobstructedPositionEx(Shape shape, CollisionContext context, PathEngine.Position[] rootPositions, PathEngine.HorizontalRange queryRegion, int targetX, int targetY, int[] permittedConnectedRegions); |
Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEngine | next: |