Search Unity

How to make a collider/hitbox fit the shape of a ParticleSystem

Discussion in 'General Graphics' started by FeastSC2, Oct 15, 2017.

  1. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    Though I haven't used it yet I know I could use colliders for every particles but that's expensive so it's not what I want in this case.

    I want to create one collider that roughly fits the particle system, so far I used animation clips to make the collider scale accordingly with effect. The problem comes when I want to change the FX once more, I must also change the clip and it quickly gets tedious to try out many variations in game.

    Is there a solution to this problem? How do you guys make your colliders fit your particle effects?

    (in this example, I created a burst of water, I want to try out different variations where the burst could be wider or the burst takes longer... This affects the ParticleSystem only however, not the hitbox)
    https://i.imgur.com/hkGETZU.gifv
     
  2. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    karl_jones likes this.
  3. FeastSC2

    FeastSC2

    Joined:
    Sep 30, 2016
    Posts:
    978
    Thanks for helping out Richard, that's interesting though it sounds like a complicated solution for what I need right now.
    But I may be wrong.

    My game is entirely 2d.
    The idea is to create a single collider that gets modified over the duration of the effect, is this achievable or must I necessarily create lots of colliders that get activated/deactivated?

    I eventually want this single collider to be used with the OnTriggerEnter2D() method. Having several colliders would complicate this.

    EDIT: I previously did that with Animation clips: simple scale of a boxcollider or a polygonal collider... But that method is quite constraining because the shape can only grow or shrink not drastically change.
     
  4. richardkettlewell

    richardkettlewell

    Unity Technologies

    Joined:
    Sep 9, 2015
    Posts:
    2,285
    FeastSC2 likes this.