Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Solver.OnParticleCollision not work + mix 3 color
#5
Triste 
I'm not sure if i got it right, but it not working so well  Huh

First of all, i using 2 emitters, 2 blueprints

Then i put color data into userdata when particle emit
Code:
private void _actor_OnEmitParticle(ObiEmitter emitter, int particleIndex)
    {
        if (emitter.solver != null)
        {
            int k = emitter.solverIndices[particleIndex];

            Vector4 userData = emitter.solver.userData[k];

            userData[0] = emitter.solver.colors[k].r;
            userData[1] = emitter.solver.colors[k].g;
            userData[2] = emitter.solver.colors[k].b;

            emitter.solver.userData[k] = userData;
        }
    }

After that, i set color in LateUpdate
Code:
private void LateUpdate()
    {
        for (int i = 0; i < _actor.solverIndices.Length; ++i)
        {

            int k = _actor.solverIndices[i];

            Vector4 userData = _actor.solver.userData[k];

            _actor.solver.colors[k] = new Color(userData[0], userData[1], userData[2]);
        }
    }

Nvm, i figure it out now.

My code is working fine, but color field in "Obi Particle Renderer" component mess it up, after set it back to "White", it look good now !

Btw, thanks for your help, great asset but lack of documents  Gran sonrisa

I think you should update document with these info, that'll be great !  Corazón
Reply


Messages In This Thread
RE: Solver.OnParticleCollision not work + mix 3 color - by hungseparate - 18-06-2020, 02:02 PM