Search Unity

Can we exclude a collider from Particle collisions?

Discussion in 'Physics' started by SoftwareGeezers, Jan 28, 2020.

  1. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    We can use Physics.IgnoreCollision to prevent self collisions from spawned objects, but can we do the same with particles?
     
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    Well it should be clear that you can't use that because it controls collider/collider collisions and is part of the physics system and not the particle system. It doesn't refer to particle systems.

    Particle collisions are not controlled by the physics system (2D or 3D) but by the particle system itself. The particle system simply runs queries just like you would in scripts; it's not part of the physics simulation. In other words, it's just a user of it so no physics API will control it.

    The API docs for the CollisionModule of the ParticleSystem shows what's available: https://docs.unity3d.com/ScriptReference/ParticleSystem.CollisionModule.html which is the ability to filter by layer.
     
  3. SoftwareGeezers

    SoftwareGeezers

    Joined:
    Jun 22, 2013
    Posts:
    902
    Yeah I got that it wasn't possible with the physics system. Was asking if there was something similar for particles. Filtering by layer isn't suitable as you'll have agents that should be colliding with particles also spawning them, such as 'Spellcaster' or 'spacecraft' layers.

    My particular problem may not be as big an issue as it seemed though. I can do collisions checks in scripts for specific object occlusion, and, if I'm right, particle collisions don't collide with colliders they start inside?
     
  4. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,497
    You get a message saying it's already collided, not a callback allow you to control if it collides which lets you perform additional game logic.

    Yes, they both do (or at least did) because overlap is processed to move the particle out of overlap.