PathEngine home previous: Setting Face Attributesnext: Working with Terrain
Contents, Programmers Guide, World Representation, Representing Regions with Cost to Traverse

Representing Regions with Cost to Traverse

Refer to this page for an overview of PathEngine's functionality for managing regions with traverse cost.

Placing soft obstacles

Soft obstacles are created in exactly the same way as hard obstacles.
Once an agent has been placed, it can be marked as a soft obstacle by calling iAgent::setTraverseCost().

As usual, the collision context mechanism controls which obstacles apply to a given query.

Soft obstacle boundaries are expanded in the same way as hard obstacles, so a path is considered to overlap a soft obstacle whenever the shape of the pathfinding agent would overlap that obstacle.

Assigning costs to regions by surface type

iCollisionContext::setSurfaceTypeTraverseCost() can be used to apply a cost to regions on the basis of surface types in the underlying ground mesh.

Note that surface type regions are not expanded so costs are applied to the parts of a path that will be overlapped by the agent's origin as they move along the path.

Associating a direction with a traversal cost

Both methods of applying traversal costs allow directions to be associated with the traversal cost.
(See iAgent::setTraverseCostDirection() , and iCollisionContext::setSurfaceTypeTraverseCostDirection() .)

When a direction is associated with a traversal cost, the cost is only applied to the component of movement in the specified direction.

This can be used, for example, to represent the effects of slope, running water, or wind.

Burning traversal costs in for inclusion in preprocess

Both ways of representing regions with traversal costs are fully supported by iMesh::burnContextIntoMesh(), with any burnt in traverse cost information then saved out with the mesh data when iMesh::saveGround() or iMesh::saveGroundEx() is called for the mesh.
Burning the traversal costs in enables them to be included in pathfinding preprocess and therefore enables very fast pathfinding around regions with traversal cost.

Special values for traverse cost

A value of exactly zero is used to turn off cost to traverse for surface type regions.
In the context of soft obstacles, a value of exactly -1.f switches an obstacle back to behaving as a straightforward 'hard obstacle'.
In the context of surface type regions, a value of exactly -1.f marks the region as impassible. Note that this can then be associated with a direction to make the region impassible in a specified direction. Note also that surface type regions do not have any effect on collision queries.

Documentation for PathEngine release 6.00 - Copyright © 2002-2016 PathEnginenext: Working with Terrain