Support Forum

RaycastModifier Not Respecting TraversalProvider

I implemented an ITraversalProvider similar to the one in BlockManager, (mine just handles blocking all nodes in a radius around an object, instead of the node directly under a SingleNodeBlocker). RaycastModifier doesn’t seem to be respecting it when node size is < 1, or when quality is anywhere above Low.

Are there any settings I can tweak to make this behave better when node size is small?

nodeSize=0.5 with raycastmodifier enabled:

nodeSize=1 with raycastmodifier enabled:

This seems to only be a problem with Graph Raycasting. I added a Collider and switched the Raycast Modifier to Physics Raycasting. It’s working well enough now.

Hi

This has been fixed in 4.3.20 in the beta.
See https://www.arongranberg.com/astar/download

I’m actually on version 4.3.26 (I upgraded specifically for the change in 4.3.20). It’s only working consistently with the Collider + Physics raycasting enabled.

That’s odd. The physics raycasting mode specifically does not take the ITraversalProvider into account.

Yep. It’s specifically when I have both raycast options enabled that it works correctly. I tried to reproduce with a super simple new project, but it’s working as expected there, so it seems like it’s something I’m doing wrong with my main project.
I definitely thought it was strange that enabling the physics raycast option fixed it though.

So, I did a little more investigation and was able to reproduce it in a simple project. It looks like the problem is being caused from having 2 grid graphs that overlap each other.

The SingleNodeBlocker uses NNConstraint.None when it’s finding which node to block, so it appears to sometimes blocks the wrong node. I edited it to use an NNConstraint with a graphMask, and that works until I add the RaycastModifier, at which point it gets into the weird state that my main project is in.

So maybe the problem is that LineCasting is also using the default NNConstraint? I’ve tried adding a constraint with graphMask set to the path itself, but that doesn’t seem to fix the problem. I’ve also got the seeker set to only be able to traverse one graph.