PathEngine home previous: iAgent::advanceAlongPath()next: iAgent::advanceAlongPathWithPrecision()
Contents, API Reference, Interfaces, iAgent, advanceAlongPathWithCollisionInfo

iAgent::advanceAlongPathWithCollisionInfo()

Description

A version of advanceAlongPath() with extra precision components of the agent's position and collision information.

Syntax

bool advanceAlongPathWithCollisionInfo(iPath* path, float distance, const iCollisionContext* context, float& precisionX, float& precisionY, cCollidingLine& collidingLine, std::unique_ptr<iAgent>& agent)

Parameters

path A path along which to advance the agent.
The path must start at the agent's current position, and the path will then be updated so to start at the agent's new position after the advance.
A null pointer may safely be passed in to this argument, in which case the call will have no effect.
distance The distance to advance along the path.
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.
precisionX Extra precision for the x component of the agent's position is returned in this parameter.
precisionY Extra precision for the y component of the agent's position is returned in this parameter.
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 there was a collision, otherwise false.

Remarks

The agent will be moved along the path and at the same time the path updated to start at the agents new position.

When approximating positions along diagonal path segments, collision checks are used to prevent the agent from getting placed inside obstructed space.

Information is stored within Interface iPath to prevent artifacts due to approximation when small distance values are used.

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.

The precision components returned in precisionX and precisionY can be added to the integer part of the position to obtain higher precision coordinates for rendering purposes.

Refer to Advancing Along Paths for general information about PathEngine's built-in advance along path functionality.

See Also

iAgent::advanceAlongPath(), iAgent::advanceAlongPathWithPrecision()

C# Mapping

bool advanceAlongPathWithCollisionInfo(Path path, float distance, CollisionContext context, out float precisionX, out float precisionY, out PathEngine.CollidingLine collidingLine, out Agent agent);

Java Mapping

boolean advanceAlongPathWithCollisionInfo(Path path, float distance, CollisionContext context, float_OutArgument precisionX, float_OutArgument precisionY, Object_OutArgument collidingLine, Object_OutArgument agent);

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