Last active
August 29, 2015 13:56
-
-
Save ameliemaia/9131554 to your computer and use it in GitHub Desktop.
A particle simulation setup for Maya.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
# Set the animation playback range | |
pm.playbackOptions(animationEndTime = 500, maxTime = 500, loop = 'once') | |
# Create sphere container which will act as the collider for the particles | |
sphere = pm.polySphere(r = 15, subdivisionsX = 32, subdivisionsY = 32) | |
# Add collision to the sphere | |
pm.runtime.nClothMakeCollide(sphere) | |
# Create the emitter | |
emitter = pm.emitter(cycleInterval = 1, cycleEmission = 'frame', position = (0, 0, 0), rate = 200, type = 'omni') | |
particles = pm.nParticle() | |
# Set particle properties | |
pm.setAttr('%s.radius' % particles[0], 0.2) | |
pm.setAttr('%s.dynamicsWeight' % particles[0], 0) | |
pm.setAttr('%s.viscosity' % particles[0], 0.244094) | |
pm.setAttr('%s.radiusScaleSPH' % particles[0], 1.354331) | |
pm.setAttr('%s.incompressibility' % particles[0], 11) | |
pm.setAttr('%s.blobbyRadiusScale' % particles[0], 10) #Important for converting the particles to polygons | |
# Connect the particles to the emitter | |
pm.connectDynamic(particles, em = emitter) | |
# Group the sphere, emitter and the particles together in the outliner | |
pm.group([sphere, emitter, particles]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment