SKAction applyForce not working?

I want to imitate gravity without using physics. However, when I do this,

let applyForce = SKAction.applyForce(CGVector(dx:0,dy:-9.8), duration:duration)
sprite.run(applyForce)

      

Nothing happens. Why is this so?

+3


source to share


1 answer


The function you call is triggered from your sprite, but targets the physical body of the sprite.



You will need to create your own version applyForce()

that does not require a physical body.

+2


source







All Articles