PathEngine home previous: iAgent::findShortestPathTo_WithQueryCallBack()next: iAgent::generateCurvedPath()
Contents, API Reference, Interfaces, iAgent, firstCollisionTo

iAgent::firstCollisionTo()

Description

Determines the first contact, if any, for movement by the agent along a line to a specified target position.

Syntax

bool firstCollisionTo(const iCollisionContext* context, int32_t x, int32_t y, int32_t& cell, cCollidingLine& collidingLine, std::unique_ptr<iAgent>& agent) const

Parameters

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.
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. If there is no collision, this is set to zero.

Requirements

Requires that the agent is moveable and that collision preprocess has been generated on the agent's mesh for the agent's collision shape.

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::firstCollision(), iAgent::testCollisionTo_XY()

C# Mapping

bool firstCollisionTo(CollisionContext context, int x, int y, out int cell, out PathEngine.CollidingLine collidingLine, out Agent agent);

Java Mapping

boolean firstCollisionTo(CollisionContext context, int x, int y, int_OutArgument cell, Object_OutArgument collidingLine, Object_OutArgument agent);

Documentation for PathEngine release 6.04 - Copyright © 2002-2024 PathEnginenext: iAgent::generateCurvedPath()