Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Buoyancy diffusion not working
#1
I'm trying to change buoyancy for each particle to make them move upward.

I used user data and map Buoyancy to one of the slots, but when I change the value nothing happens to particles.

Here is part of my code:

Code:
void Start()
{
    solver.OnCollision += Solver_OnCollision;
    emitter.OnEmitParticle += Emitter_OnEmitParticle;
}


void Emitter_OnEmitParticle(ObiEmitter em, int particleIndex)
{
    int k = emitter.solverIndices[particleIndex];
    Vector4 userData = emitter.solver.userData[k];
    userData[0] = solver.buoyancies[k];
    emitter.solver.userData[k] = userData;
}


private void Solver_OnCollision(ObiSolver s, ObiSolver.ObiCollisionEventArgs e)
{
    var world = ObiColliderWorld.GetInstance();
    foreach (Oni.Contact contact in e.contacts)
    {

        if (contact.distance < 0.01f)
        {
            var col = world.colliderHandles[contact.other].owner;
            var userData = solver.userData[contact.particle];
                 
            if (evaporators[0].collider == col)
            {
                userData[0] = 0;
            }

            solver.userData[contact.particle] = userData;
        }
    }
}

Could you please help me?
Reply


Messages In This Thread
Buoyancy diffusion not working - by Booyaka - 05-01-2021, 11:40 AM
RE: Buoyancy diffusion not working - by Booyaka - 05-01-2021, 09:37 PM
RE: Buoyancy diffusion not working - by Booyaka - 06-01-2021, 09:14 AM