void FixedUpdate() { int oil = 1; int water = 0; List <int> upindices = new List <int>(); List <int> downindices = new List <int>(); foreach (LPSystemPartPartContact cont in sys.GetParticleContacts()) { if (cont.ParticleAUserData == oil && cont.ParticleBUserData == water) { if (!upindices.Contains(cont.ParticleAIndex)) { upindices.Add(cont.ParticleAIndex); } if (!downindices.Contains(cont.ParticleBIndex)) { downindices.Add(cont.ParticleBIndex); } } } if (upindices.Count > 0) { upindices.Insert(0, upindices.Count); LPAPIParticles.ApplyForceToSelectedParticles(sys.GetPtr(), upindices.ToArray(), 0f, UpwardsForce); } if (downindices.Count > 0) { downindices.Insert(0, downindices.Count); LPAPIParticles.ApplyForceToSelectedParticles(sys.GetPtr(), downindices.ToArray(), 0f, -UpwardsForce * Mult); } }
void FixedUpdate() { if (Active) { int[] partsinshape = lpman.ParticleSystems[ParticleSystemImIn].GetParticlesInShape(shape, transform); if (partsinshape.Length > 1) { Vector3 diff = getdiff() * Strenght; LPAPIParticles.ApplyForceToSelectedParticles(lpman.ParticleSystems[ParticleSystemImIn].GetPtr(), partsinshape, diff.x, diff.y); } } }
// Update is called once per frame void FixedUpdate() { List <int> indices2 = new List <int>(); if (sys.Particles != null) { for (int i = 0; i < sys.Particles.Length; i++) { if (sys.Particles[i].UserData == 0) { indices2.Add(i); } } } if (indices2.Count > 0) { indices2.Insert(0, indices2.Count); LPAPIParticles.ApplyForceToSelectedParticles(sys.GetPtr(), indices2.ToArray(), 0f, -UpwardsForce * Mult); } }