| PathEngine home | previous: | next: |
We need a way for the user to select a desired position to place or move agents on
a mesh.
The testbed provides the following function for detecting which point on a mesh is beneath the mouse cursor:
virtual cPosition positionAtMouse()=0; |
A cPosition uniquely identifies a position on the mesh.
This class is defined in i_pathengine.h, as follows:
(And see
class cPosition
{
public:
cPosition() :cell(-1) {}
tSigned32 x,y,cell;
};
|
The 'x' and 'y' members are horizontal coordinates.
(See
The 'cell' member disambiguates between overlapping geometry at a given horizontal position.
The
(So the position found by intersection of a ray back through view space from the mouse screen position.)
If there are multiple layers underneath the mouse, a position on the top layer is returned.
If there is no position on the mesh currently underneath the mesh then positionAtMouse() returns an invalid position, in other words a position with the 'cell' member set to -1.
Note that there is some cost to calling positionAtMouse(),
so it is better to avoid calling this function on frames where it is not requird.
But it is ok to call it multiple times in a frame because in this case the result is buffered internally
by the testbed and reused.
| Documentation for PathEngine release 5.17 - Copyright © 2002-2008 PathEngine | next: |