DoN's 3D-Pathfinding / Flying-AI system (with full source!)

@dxd39

Try changing the check to this:


if (ownerComp->GetActiveInstanceIdx() != payload->ActiveInstanceIdx)
       return NULL;


I haven’t dived into how SimpleParallel actually works, but assuming that the task id is maintained throughout the task’s lifespan (it should be as far as I can tell) then this should work.

To provide some background, that check prevents undefined behavior (via reinterpret_cast) if a bot moves on to a new task by the time the pathfinding result delegate fires. A new task will have a different memory layout so the reinterpret_cast will be rendered unreliable. I’m honestly not a fan of using either “NodeMemory” or C style/reinterpret casts to pass data around but this usage of uint8* NodeMemory seems to be a core part of Unreal’s BT design and the prescribed way of storing task-level data (more on that here)

Thanks for pointing this out!