# Name : XYZ Drag # Description: simple Drag Daemon # Author : Brandon Young # Date : Monday, December 10 2007 # Version : 1.0 # Directions: # apply to scripted daemon # adjust dragxco, dragyco, and dragzco to get different results #--------------------------------------------------------------------------------------------- # Function: applyForceToEmitter # This function is called by the simulation engine # when external forces should be applied to the # particles in the emitter. #-------------------------------------------------- def applyForceToEmitter( emitter ): import math particle = emitter.getFirstParticle() dragXco = 0 # adjust these to adjust your drag. dragYco = 0 dragZco = 0 while particle: vel = particle.getVelocity() velx = vel.x vely = vel.y velz = vel.z dragX = -1*dragXco*velx dragY = -1*dragYco*vely dragZ = -1*dragZco*velz drag = Vector.new(dragX,dragY,dragZ) particle.setExternalForce( drag ) particle = particle.getNextParticle() #-------------------------------------------------- # Function: applyForceToBody # This function is called by the simulation engine # when external forces should be applied to the body. #-------------------------------------------------- def applyForceToBody( body ): pass #-------------------------------------------------- # Function: removeParticles # This function is called by the simulation engine # when it is safe to remove particles. #-------------------------------------------------- def removeParticles( emitter ): pass