| PathEngine home | previous: | next: |
For placing and moving our agent we used iTestBed::testPointCollision().
This tests whether a shape is obstructed at a given position.
For a moving agent, we need to test whether the agent is obstructed for movement along
a line.
For this we can use the following functions, provided by
virtual bool testCollisionTo(iCollisionContext *context, const cPosition &newposition)=0; virtual bool testCollisionTo_XY(iCollisionContext *context, tSigned32 x, tSigned32 y, tSigned32 &cell)=0; virtual iCollisionInfo* firstCollisionTo(iCollisionContext *context, tSigned32 x, tSigned32 y, tSigned32 &cell)=0; |
(Note that corresponding functions are also provided by
The difference between testCollisionTo() and testCollisionTo_XY() is
that testCollisionTo_XY() does not require a fully specified position as an end point of
the line.
testCollisionTo_XY() requires only x and y coordinates for the end of the line and
fills in the cell appropriately.
This is exactly the behaviour we need to move our agent in a direction
from their current position.
firstCollisionTo() also requires only x and y coordinates for the end point.
This method returns an
We will use this information to implement a basic mechanism for sliding against obstructions.
| Documentation for PathEngine release 5.17 - Copyright © 2002-2008 PathEngine | next: |