/*******************************************************
 
 
createBallWorld
 
 
created 3/29/04
by Isaac Holze
 
 
- creates passive body box for balls to bounce in.
 
 
input:
None
 
 
 
 
********************************************************/
 
 
global int $layer = 0;
 
 
global proc createBallWorld () {
 
 
// create Cube
polyCube -w 20 -h 20 -d 20 -sx 1 -sy 1 -sz 1 -ax 0 1 0 -tx 1 -ch 1;
 
 
// reverse the Normals
polyNormal -normalMode 0 -ch 1 pCube1;
 
 
hilite -u pCube1 ;
select -r pCube1 ;
 
 
// create Passive Rigid body
rigidBody -passive -m 1 -dp 0 -sf 0.2 -df 0.2 -b 1 -l -1 -tf 200 -iv 0 0 0 -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ;
 
 
 
 
 
 
}
 
 
/******************************************************
createBall
 
 
created 3/29/04
by Isaac Holze
 
 
-creates a rigid body ball
 
 
Inputs:
$ix - initial x position
$iy - initial y position
$iz - initial z position
$vx - initial x velocity
$vy - initial y velocity
$vz - initial z velocity
 
 
*****************************************************/
 
 
 
 
global proc createBall (float $ix, float $iy, float $iz,
float $vx, float $vy, float $vz) {
global int $layer;
 
 
sphere -r 1 -ax 0 1 0 -ch 1;
move -r $ix $iy $iz;
rigidBody -active -m 1 -dp 0 -sf 0.2 -df 0.2 -b 1 -l $layer -tf 200 -iv $vx $vy $vz -iav 0 0 0 -c 0 -pc 0 -i 0 0 0 -imp 0 0 0 -si 0 0 0 -sio none ;
 
 
$layer++;
 
 
}
 
 
 
 
createBallWorld ();
int $i;
float $rx, $ry, $rz, $rvx, $rvy, $rvz;
for ($i = 0; $i < 5; $i++) {
$rx = rand(-8, 8);
$ry = rand(-8, 8);
$rz = rand(-8, 8);
$rvx = rand(-100, 100);
$rvy = rand(-100, 100);
$rvz = rand(-100, 100);
createBall ($rx, $ry, $rz, $rvx, $rvy, $rvz);
}