Apply RayCast modifier... to only a subset of the Path

Hi there,

I have a path over a pointgraph that traverses a bunch of nodes, some with tag ‘0’, some with tag ‘1’. Is there a way to only apply the raycast modifier to the segments of the path that pass through the ‘1’ tagged nodes?

(Basically, I have regions of the graph where it’s ‘safe’ for the AI to wander off the edges, and other regions where I want the AI to rigidly stick to passing through the nodes)

Assuming this isn’t possible, would you mind giving some code pointers how I could make the edits myself? I have been playing around with RaycastModifier for a while but am not having too much luck.

My first attempt was to modify ValidateLine so it returned false if n1.Tag == 1 && n2.Tag == 1. However, it’s getting called a bunch of times with n1,n2==null and still seems to successfully contract the whole path :wink: I also considered subdividing the input Path into segments where Tag==1, and selectively applying the modifier to only those segments - however it wasn’t immediately apparently to me how to cleanly do that…

Any pointers greatly appreciated!

Hi

I think your approach should work if you use graph raycasting. It will not work with physics raycasting though, because then ValidateLine doesn’t get called with nodes (as you found out).