PathEngine home previous: iAgent::testCollisionDirectlyAgainstPlacedShape()next: iAgent::testCollisionTo_XY()
Contents, API Reference, Interfaces, iAgent, testCollisionTo



Tests whether the agent can move along a line to a specified position.


bool testCollisionTo(const iCollisionContext* context, const cPosition& newPosition) const;


context The state of dynamic collision that will apply for this query.
An empty context can be specified by passing nullptr for this argument.
Note that the agent is not considered to obstruct itself even if included in this context.
newPosition The position for the end of the query line. This position must be a valid position on the agent's mesh.


Requires that the agent is moveable and that collision preprocess has been generated on the agent's mesh for the agent's collision shape. (But see also Performing Collision Queries without Preprocess.)

Return Value

true if the line to the specified position is obstructed, otherwise false.


This method tests collision for a line to a fully specified target position.
In many situations the 'cell' at the target position is not known. In this case, use iAgent::testCollisionTo_XY().

See The PathEngine Movement Model for details about PathEngine collision.

See Also


C# Mapping

bool testCollisionTo(CollisionContext context, PathEngine.Position newPosition);

Java Mapping

boolean testCollisionTo(CollisionContext context, Position newPosition);

Documentation for PathEngine release 6.03 - Copyright © 2002-2021 PathEnginenext: iAgent::testCollisionTo_XY()