Search code examples
swiftios9path-findinggameplay-kit

GKGridGraphNode with custom traversal cost


I was following this tutorial

http://blog.lukasjoswiak.com/gameplaykit-for-beginners-part-1/

and when I got to the end, I wanted to try to make the towers not completely impassable, but just have a higher cost.

so, I subclassed GKGridGraphNode and added a cost variable, overrode the costToNode function and tried to insert my cost variable into the equation.

I cannot seem to get it to work. The documentation on this is really doesn't explain having node cost beyond mentioning it in the subclassing notes. I was wondering if anyone has managed to do this?

I am probably going about it wrong, but even reading the Swift headers doesn't really give me any clues.

Thanks for the help

Update: Closed as duplicate


Solution

  • I had a similar question, and I used one of my Apple developer support tickets to try to get an answer.

    Apple responded and told me it was a known issue, and that there was a potential fix in the iOS SDK 9.2 beta 2, released November 3, 2015. I verified that the tests in my test project pass in 9.2b2, and so I expect that version to resolve this issue.