Reputation: 119
SKNode has a position property which represents the node's position in parent. Whereas GKAgent2D also has a position property which according to the documentation is its position in 2D space. How are these two related? And how do we convert between each other and is a conversion necessary?
Upvotes: 2
Views: 157
Reputation: 696
You can use GameplayKit without SpriteKit. The Agent's position is internal to GameplayKit and then you synchronize your sprite's position to your agent's position. It means you can also have agents with other frameworks.
Upvotes: 2
Reputation: 16847
GKAgent2D
position is arbitrary to whatever system you are using it for, you so there is no exact need to convert it. Now to keep your game simple and easy to understand, you are probably going to want to keep everything based on the scene coordinates, so you are going to want to convert your SKNode
position to the position it is at on the scene, this way you can keep all of your GKAgent
values based on scene position as well.
Upvotes: 1