Search code examples
swiftsprite-kitskphysicsbody

How to get direction of a PhysicsBody SKNode in spritekit


I've got an SKNode with an impulse applied. Is there a way to know in every time the direction that it has?

It collides with many bodies, and I want to know which is his direction in real time.


Solution

  • Try this:

     yourPhysicsBody.velocity
    

    This should return the velocity CGVector of the physics body at any given time.