Search Unity

Manually moved Particles with Streched Billboard mode

Discussion in 'General Graphics' started by kulesz, Jul 12, 2018.

  1. kulesz

    kulesz

    Joined:
    Jul 1, 2012
    Posts:
    140
    Hi,

    I'm trying to manually move particles with the following code
    Code (CSharp):
    1.  
    2. var particleCount = particleSystem.GetParticles(_ParticlesCache);
    3. ParticleSystem.Particle particle;
    4. for (var i = 0; i < particleCount; i++)
    5. {
    6.    particle = _ParticlesCache[i];
    7.    particle.position += delta;
    8.    _ParticlesCache[i] = particle;
    9. }
    10. particleSystem.SetParticles(_ParticlesCache, particleCount);
    11.  
    (delta vector is about 15 units long)

    Everything works fine, the particles do change their location - but when particle Renderer Mode is set to Stretched Billboard there's a glitch (lasting one frame), where particles stretch A LOT in the direction of camera. They cover almost entire screen and it looks like a hyperdrive effect from the old sci-fi movies.
    I suppose it is the effect of applying a large offset and some particle system internal velocity calculation - particles "travel" a large distance over one frame and are stretched accordingly.

    I tried to store velocity of each particle before movement and and then set it afterwards (both velocity and animatedVelocity), but it didn't help.

    Did anyone had similiar issue?
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Hi. Can you file a bug report please and include a simple example project so we can investigate.
    Thanks