Confetti Template

  • PP MEL SCRIPT

    vector $tempVector;
    vector $tempPosition;
    
    $tempPosition = nParticleShape1.position;
    
    float $randomPosition = rand(1,5);
    float $rotationThreshold = -60;
    
    float $positionX;
    float $positionY;
    float $positionZ;
    
    float $randomRotation = rand(160,180);
    
    float $rotationsX;
    float $rotationsY;
    float $rotationsZ;
    
    if (nParticleShape1.moveTrigger == 1){
    	nParticleShape1.randRotation += nParticleShape1.velocity;
    
    	if ($tempPosition.y <= $rotationThreshold){
    		nParticleShape1.timeTrigger = time;
    		nParticleShape1.endTimeTrigger = nParticleShape1.timeTrigger + .75;
    
    		nParticleShape1.startRotation = nParticleShape1.randRotation;
    
    		$tempVector = nParticleShape1.startRotation;
    		$rotationsX = $tempVector.x / 180;
    		$rotationsY = $tempVector.y / 180;
    		$rotationsZ = $tempVector.z / 180;
    		$rotationsX = floor($rotationsX);
    		$rotationsY = floor($rotationsY);
    		$rotationsZ = floor($rotationsZ);
    
    		$tempVector = << ($rotationsX * 180), ($rotationsY * $randomRotation), ($rotationsZ * 180) >>;
    
    		nParticleShape1.endRotation = $tempVector;
    
    		nParticleShape1.moveTrigger = 0;
    	}
    
    
    }
    
    if (nParticleShape1.moveTrigger == 0){
    	nParticleShape1.randRotation = hermite(nParticleShape1.startRotation, nParticleShape1.endRotation, <<0,0,0>>, <<0,0,0>>, linstep(nParticleShape1.timeTrigger, nParticleShape1.endTimeTrigger, time));
    }


I created a very basic setup for confetti bursting in to the air and falling back. This can be used to speed up the process of implementing simple dynamic confetti simulation which include nCloth streamers and nParticle glitter.


Landing Rotation

Simply stopping the rotation increment on the confetti instances will appear as if it gets stabbed in to the ground and sticks there. So I decided to write a PP MEL script that will step it’s rotation towards an end rotation after it passes a certain height. The following is the result and source of the PP MEL script.