cwisbg

nParticleSplit

Nov 6th, 2018
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. //Check the age
  2. int $randAge = rand(1,7);
  3. if (frame < 400) {
  4. if (particleSplittingTest_original:nParticleShape1.age > $randAge) {
  5. //OK, it's old enough. Let's get the particle's position
  6. vector $pos = particleSplittingTest_original:nParticleShape1.position;
  7. //Let's get some velocity values
  8. //vector $vel0 = rand(-.5,.5) + nParticleShape1.velocity;
  9. //vector $vel1 = rand(-.5,.5) - nParticleShape1.velocity;
  10. float $randP = rand(0,.5);
  11. vector $vel0 = rand(0,1) + particleSplittingTest_original:nParticleShape1.velocity;
  12. vector $vel1 = rand(0,1) - particleSplittingTest_original:nParticleShape1.velocity;
  13. //Now let's kill the particle
  14. particleSplittingTest_original:nParticleShape1.lifespanPP = 0;
  15. //Let's create two new particles at the old position
  16. emit -object nParticle1 -position ($pos.x+$randP) ($pos.y) ($pos.z + $randP)
  17. -position ($pos.x+$randP ) ($pos.y) ($pos.z + $randP)
  18. -attribute velocity -vectorValue ($vel0.x) ($vel0.y) ($vel0.z)
  19. -vectorValue ($vel1.x) ($vel1.y) ($vel1.z);
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment