Function GridGraph.SnappedLinecast

SnappedLinecast (Vector3 from, Vector3 to, GraphNode hint, outGraphHitInfo hit)

Returns if there is an obstacle between from and to on the graph.

Public
bool SnappedLinecast (

Vector3

from

Point to linecast from.

Vector3

to

Point to linecast to.

GraphNode

hint

This parameter is deprecated. It will be ignored.

outGraphHitInfo

hit

Contains info on what was hit, see GraphHitInfo.

)

Returns if there is an obstacle between from and to on the graph.

This function is different from the other Linecast functions since it snaps the start and end positions to the centers of the closest nodes on the graph. This is not the same as Physics.Linecast, this function traverses the graph and looks for collisions.

Version

Since 3.6.8 this method uses the same implementation as the other linecast methods so there is no performance boost to using it.

In 3.6.8 this method was rewritten and that fixed a large number of bugs. Previously it had not always followed the line exactly as it should have and the hit output was not very accurate (for example the hit point was just the node position instead of a point on the edge which was hit).

Deprecated

Use Linecast instead.

A* Pro Feature

This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited.
The Pro version can be bought here