Search Unity

Particle Distance Emission ignoring axis

Discussion in 'Scripting' started by rubeng, Oct 11, 2016.

  1. rubeng

    rubeng

    Joined:
    Apr 20, 2013
    Posts:
    60
    Hi, we are doing a 2d game, and we use the z axis to sort our graphic objects.

    right now its just a simple equation where for each gameobject that needs to be sorted we set its Z coordinate as a function of its Y coordinate (plus a few extra factors to allow for fine tunning)

    The problem here is that when we try to use a particle system with distance emission the distance that you see on the screen doesn't match the distance that the particle system sees due to the change in its Z coordinate as it travels.

    The ideal solution would be to have a way to ignore the Z axis in the particle system for distance calculations.

    Another solution that I am evaluating, is disabling emision for the particle systems that we want to use distance, and add an extra component to the gameobjects with particle system that check the current vs previous position and then fakes the distance emission by moving the particle system to intermediate positions and using emit() several times but not sure what other problems this might create.

    Thanks for any information.

    P.S. we dont use order in layer, because that makes us iterate on the gameobject and change that property in every renderer, so we avoid sorting the graphics, and get child graphics for free

    Rubén
    Ironhide Game Studio