PathEngine home previous: The PathEngine Movement Modelnext: Why Integer Coordinates?
Contents, Overview, Fundamental Concepts, Representing Positions on the Ground

Representing Positions on the Ground

Run-time position representation

The cPosition class is used to provide a fast and robust run-time position representation.

A cPosition is composed of X and Y coordinates plus a cell index that relates to PathEngine's internal partitioning.
This cell index serves to disambiguate between different layers of overlapping geometry.

The information in a cPosition may also be stored and retrieved from persistence under certain conditions:
The underlying mesh must not have changed between storing and retrieving the position data.
If persistence across different releases of the SDK is required then it is important to ensure that a '2d mapping' is saved out with ground meshes, otherwise changes in PathEngine's internal process for generating this mapping can result in stored positions becoming invalidated.

'Anchors' for content side position definition

On the content side 'anchors' provide a way to represent positions on the ground in a form that is persistent with respect to changes in a ground mesh.
Anchors can then be resolved (usually at export or content processing) and associated with a ground mesh for retrieval at runtime.

An anchor is essentially just a vertical line that intersects the ground mesh.
This can then be resolved to a run-time position by finding the point of intersection of this vertical line with the mesh's ground surface.

In addition to defining agent start positions, script positions, and so on, anchors also provide a convenient way for content creators to 'pin' obstacle shapes onto the mesh.

A pair of anchors being used to pin static obstruction shapes to the ground mesh.

Terrain Anchors

'Terrain anchors' are a variant of the anchor representation which resolve directly to the terrain. The vertical extents of terrain anchors are ignored.

Anchor validity

Anchors will remain valid across modification to a ground mesh as long as the anchor line continues to intersect the mesh. If big changes are made to a mesh then it's possible for anchors to become invalidated. In this case, invalidated anchors will need to be moved to correspond to the new shape of the ground.

Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: Why Integer Coordinates?