PathEngine home previous: iMesh::findShortestPath_WithQueryCallBack()next: iMesh::generateBackgroundConnectedRegionPreprocessFor()
Contents, API Reference, Interfaces, iMesh, firstCollision

iMesh::firstCollision()

Description

Determines the first contact, if any, for an agent with the specified collision shape moving along the specified line.

Syntax

bool firstCollision(const iShape& shape, const iCollisionContext* context, const cPosition& start, int32_t x, int32_t y, int32_t& cell, cCollidingLine& collidingLine, std::unique_ptr<iAgent>& agent) const

Parameters

shape The collision shape to use for this query.
context The state of dynamic collision that will apply for this query.
An empty context can be specified by passing nullptr for this argument.
start The start of the line. This position must be a valid position on this mesh
x X coordinate for the end of the line.
y Y coordinate for the end of the line.
cell If there is no collision then this value will be set to the cell at the end of the line.
collidingLine If there is a collision then this will be filled in to describe a line of first contact.
agent If there is a collision, and first contact is with an agent in the supplied collision context, this returns a pointer to the obstructing agent.

Requirements

Requires that unobstructed space has been generated on this mesh for the collision shape specified.

Return Value

Returns true if movement along the line is obstructed, otherwise false.

Remarks

The start position passed into this query should not be obstructed.

In the case of a collision, the line of contact is guaranteed to cross the direction of travel from right to left, but note the start and end points of this line of contact serve only to describe the position and direction of the 'infinite line' at point of collision, and should not be considered as meaningful in of themselves.

See The PathEngine Movement Model for details about PathEngine collision.

See Also

iMesh::testLineCollision(), iMesh::testLineCollision_XY(), iMesh::firstCollision()

C# Mapping

bool firstCollision(Shape shape, CollisionContext context, PathEngine.Position start, int x, int y, out int cell, out PathEngine.CollidingLine collidingLine, out Agent agent);

Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: iMesh::generateBackgroundConnectedRegionPreprocessFor()