By Bret A. Hughes, Autodesk (formerly Alias) Santa Barbara Development Center.
This script, dynFuncBoundary.mel, tests the particle collision boundary for a mesh plane. The script creates an emitter above a sphere that is above a plane. The emitted particles are affected by gravity as they bounce off the sphere and the plane.
// dynFuncBoundary.mel // // Alias Script File // MODIFY THIS AT YOUR OWN RISK // // Creation Date: 09 September 1996; Modified 08 January 2000 // Author: bah // // Procedure Name: // dynFuncBoundary // // Description: // Creates scene to test the particle collision boundary for a mesh // plane. // // Input Arguments: // None. // // Return Value: // None. // // // ========== dynFuncBoundary ========== // // SYNOPSIS // Creates scene to test the particle collision boundary for // a mesh plane. // global proc dynFuncBoundary() { // Clear the scene and reset the timeline. // file -f -new; currentTime -e 1; // Display information to the user about what to expect from this // subtest and give some time for the user to read this information. // print( "\nParticles fall and collide with ball and plane.\n" ); system( "sleep 1" ); // Create the bottom plane. // nurbsPlane -name plane; scale 7.01291 7.01291 7.01291; rotate 0rad 0rad -1.5708rad; move 0 0.2 0; // Create the ball above the plane. // polySphere -name ball; scale 1.20479 1.20479 1.20479; move 0 2.7 0; // Create the emitter above the ball and plane. Make the particles // affected by gravity and have them bounce off the ball and the // bottom plane. // emitter -type omni -r 100 -mnd 0 -mxd 0.7 -spd 1 -pos 0 5 0 -name emitter; particle -name particles; connectDynamic -em emitter particles; gravity -dx 0 -dy -1 -dz 0 -m 9.8 -pos 10 10 0 -name gravity; connectDynamic -f gravity particles; collision -r 0.50 -f 0.14 plane; collision -r 0.50 -f 0.14 ball; connectDynamic -c plane -c ball particles; // Make the picture a pretty one and play the test. // select -r particles; selectMode -component; hide plane ball; // Set up the playback options. // float $frames = 150; playbackOptions -min 1 -max $frames -loop once; // Time how long it takes to play the scene and then determine the // playback frame rate. Make sure when getting the frame rate // that no values are divided by zero. // float $startTime = `timerX`; play -wait; float $elapsed = `timerX -st $startTime`; float $fps = ($elapsed == 0.0 ? 0.0 : $frames/$elapsed); // Print the frames per second (fps) of the subtest in the form X.X. // print("dynFuncBoundary: Done. ("); print( (int)($fps * 10)/10.0 + " fps)\n" ); } // dynFuncBoundary //
Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License