5

I am a long time user of Stackoverflow but first post.

My question is seemingly simple, is there a way to make particles from an emitter interact with the physics sprites in the scene? (For example, if I am using a particle for rain, and I want it to bounce or bumpy off a sprite of a man with an umbrella. There must be a way, but I don't see a lot of documentation on adding physics to individual particles. Any ideas?

Thanks!

san
  • 3,350
  • 1
  • 28
  • 40

3 Answers3

8

No. There is no way to make SpriteKit's built in particles interact with physics bodies. Every particle property you can control is a property of SKEmitterNode, and it has no properties for setting physics behavior for particles.

The fact is that particles are designed to be very light-weight so that you can have thousands of them on any hardware supported by SpriteKit. Physics simulation is not light-weight.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • Fair enough. it was worth the hope :) It definitely could make particles unwieldily if they can do everything a normal sprite can do. Thanks! – user2090857 Nov 13 '13 at 12:38
  • I have a question that any help would be greatly appreciated, if I really want to make an effect like my particles have physics, can I add my particles to a transparent image and use emitterNodes.targetNode = self property so can use transparent image's physic to detect any collisions & contacts? – Ahmet Hayrullahoglu Jul 16 '14 at 09:49
  • If you have a question, click the “Ask Question” button (at the top right) and post a new top-level question. – rob mayoff Jul 16 '14 at 14:13
0

There is LiquidFun, which is a Box2D extension that simulate the physics of a particle system. This engine is the basis for Apple Spritekit physics engine and you can use it in your game but you have to tweek it a little bit to make it run. There are a lot of tutorials of how to use it in an ios project. I am confident that Apple will have more features added to Spritekit in the future that make the particle system respond to physics.

alniaymy
  • 1
  • 1
0

You could use a SKField to simulate gravity and then another field on your umbrella to repulse it.

Hugues BR
  • 2,238
  • 1
  • 20
  • 26