user3138007
user3138007

Reputation: 637

How to stop a sprites physicsBody from moving?

In my SpriteKit game i move several sprites using [sprite.physicsBody applyImpulse:vector]; but at a specific point i the game i want them to stop. I already tried to apply the exact opposite impulse.. but that did not worked very well.

Thanks

Upvotes: 1

Views: 535

Answers (1)

user4233369
user4233369

Reputation:

You can directly set a physicsBody's velocity via the velocity property. Stop a body by setting it's velocity to (0,0):

sprite.physicsBody.velocity = CGVectorMake(0,0);

Upvotes: 1

Related Questions