Skip to content

Commit

Permalink
submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
idris committed Dec 3, 2009
1 parent b7d02cd commit 025c46a
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 22 deletions.
16 changes: 0 additions & 16 deletions ball.cpp
Expand Up @@ -328,32 +328,16 @@ void Ball::checkCollisions() {
GLdouble dist_from_floor = 0;
for(i=0;i<numObjects;i++) {
if(objects[i].attached) {
// if(true) continue;
// check to see if the attached object collides with the floor
Cube o = objects[i];

/*
GLdouble *oCenter;
oCenter = matrixTimesVector(rotation, o.offset);
oCenter[0] = center[0] - oCenter[0];
oCenter[1] = center[1] - oCenter[1];
oCenter[2] = center[2] - oCenter[2];
*/
GLdouble *oCenter = o.getCenter();
// cout << "CenterZ: " << oCenter[2] << endl;

GLdouble oToFloor = oCenter[2] - o.radius;
free(oCenter);
// cout << "To Floor: " << oToFloor << endl;
// cout << "center: " << oCenter[0] << "\t" << oCenter[1] << "\t" << oCenter[2] << endl;
// cout << "baller: " << center[0] << "\t" << center[1] << "\t" << center[2] << endl;
// cout << "cubeer: " << o.center[0] << "\t" << o.center[1] << "\t" << o.center[2] << endl;
// cout << "offset: " << o.offset[0] << "\t" << o.offset[1] << "\t" << o.offset[2] << endl;

// cout << "center: " << oCenter[2] << " . " << o.offset[2] << endl;
if(oToFloor < 0) {
dist_from_floor -= oToFloor;
// cout << "FLOOR diff: " << diff << endl;
}
} else {
// check for a scollision with this object
Expand Down
2 changes: 1 addition & 1 deletion cloth.cpp
Expand Up @@ -51,7 +51,7 @@ Tested on: Windows Vista / Visual Studio 2005
/* Some physics constants */
#define DAMPING 0.01 // how much to damp the cloth simulation each frame
#define TIME_STEPSIZE2 0.5*0.5 // how large time step each particle takes each frame
#define CONSTRAINT_ITERATIONS 15 // how many iterations of constraint satisfaction each frame (more is rigid, less is soft)
#define CONSTRAINT_ITERATIONS 5 // how many iterations of constraint satisfaction each frame (more is rigid, less is soft)


Vec3::Vec3(float x, float y, float z)
Expand Down
62 changes: 59 additions & 3 deletions objects.txt
@@ -1,4 +1,4 @@
24
80
CUBE 0 2000 0 50 50 100 1 0 0
CUBE 40 1800 -1000 75 75 150 1 0 0
CUBE 0 1400 1200 50 50 100 1 0 0
Expand All @@ -8,7 +8,7 @@ CUBE 30 -1000 -700 50 50 100 1 0.5 0.3
CUBE 200 400 -200 40 40 80 1 0 1
CUBE 120 -1400 1000 50 50 100 0.6 0 1
CUBE 10 1000 -500 100 100 200 0 0 1
CUBE 30 -3000 -100 200 200 400 0 1 1
CUBE 30 -1700 -100 200 200 400 0 1 1
CUBE 20 -1000 500 200 200 400 0 1 1
CUBE 50 -500 -400 100 100 200 0 1 1
CUBE 40 500 400 50 50 100 1 1 0
Expand All @@ -22,4 +22,60 @@ CUBE 120 0 2000 200 200 400 0.0 1.0 0.0
CUBE 10 800 0 20 20 40 0.6 0.05 0.2
CUBE 0 -50 -1000 20 20 40 0.0 0.4 1
CUBE 40 -100 -1200 20 20 40 0.2 0 0.7
CUBE 20 50 -1500 15 15 30 0.6 0.05 0.2
CUBE 20 50 -1500 20 20 40 0.6 0.05 0.2
CUBE 0 2000 -2200 30 30 60 1 0 0
CUBE 40 1800 1000 40 40 80 1 0 0
CUBE 0 1400 -1200 50 50 100 1 0 0
CUBE 50 1100 0 35 35 70 0 0.6 0.8
CUBE 40 100 -400 40 40 80 0.6 0.2 0
CUBE 30 -1000 -300 35 35 70 1 0.5 0.3
CUBE 200 400 -800 40 40 80 1 0 1
CUBE 120 -1400 -2000 49 49 98 0.6 0 1
CUBE 10 1000 -1500 20 20 40 0 0 1
CUBE 30 -2000 -1900 20 20 40 0 1 1
CUBE 20 -1000 -1500 24 24 48 0 1 1
CUBE 50 -500 -600 20 20 40 0 1 1
CUBE 40 500 -1400 22 22 44 1 1 0
CUBE 30 800 -300 45 45 90 0 0.4 1
CUBE 20 100 -1700 30 30 60 1 0 1
CUBE 10 -200 -1200 34 34 68 0 0.3 1
CUBE 50 -1200 -800 25 25 50 0.2 0 0.7
CUBE 30 1700 -400 15 15 30 0 1 1
CUBE 20 1300 -1200 20 20 40 0.6 0.05 0.2
CUBE 120 0 -300 20 20 40 0.0 1.0 0.0
CUBE 10 800 -1300 20 20 40 0.6 0.05 0.2
CUBE 0 -50 -230 20 20 40 0.0 0.4 1
CUBE 40 -100 -1800 20 20 40 0.2 0 0.7
CUBE 20 50 -1500 15 15 30 0.6 0.05 0.2
CUBE 40 -100 -2300 20 20 40 0.2 0 0.7
CUBE 20 50 -2400 15 15 30 0.6 0.05 0.2
CUBE 0 1700 -1500 25 25 50 1 0 0
CUBE 40 2500 -1200 25 25 50 1 0 0
CUBE 0 1050 1800 30 30 60 1 0 0
CUBE 50 700 1000 25 25 50 0 0.6 0.8
CUBE 40 -450 -600 25 20 50 0.6 0.2 0
CUBE 30 -1000 -1900 50 50 100 1 0.5 0.3
CUBE 200 -400 -1200 20 20 40 1 0 1
CUBE 120 -1400 1300 30 30 60 0.6 0 1
CUBE 10 700 -1500 50 50 100 0 0 1
CUBE 30 -2500 -100 30 30 60 0 1 1
CUBE 20 -1500 500 35 35 70 0 1 1
CUBE 50 200 -1400 40 40 80 0 1 1
CUBE 40 -1000 400 50 50 100 1 1 0
CUBE 30 -800 -700 28 28 56 0 0.4 1
CUBE 20 -1000 900 45 45 90 1 0 1
CUBE 10 -150 200 30 30 60 0 0.3 1
CUBE 50 -1200 -200 25 25 50 0.2 0 0.7
CUBE 30 650 -600 40 40 80 0 1 1
CUBE 20 120 0 20 20 40 0.6 0.05 0.2
CUBE 120 -1200 1300 25 25 50 0.0 1.0 0.0
CUBE 10 1800 0 20 20 40 0.6 0.05 0.2
CUBE 0 -550 -1200 20 20 40 0.0 0.4 1
CUBE 40 -950 -1000 20 20 40 0.2 0 0.7
CUBE 20 -1800 -1500 20 20 40 0.6 0.05 0.2
CUBE 0 1500 -1200 25 25 50 1 0 0
CUBE 40 550 1000 20 20 40 1 0 0
CUBE 0 1200 -1900 25 25 50 1 0 0
CUBE 50 1850 -1700 25 25 50 0 0.6 0.8
CUBE 40 -1450 -1300 20 20 40 0.6 0.2 0
CUBE 30 -1800 -1500 30 30 60 1 0.5 0.3
4 changes: 2 additions & 2 deletions readme.txt
Expand Up @@ -31,8 +31,8 @@ the keyboard as follows:
'v' - zoom in


Other Information
=================
Cloth Simulation
================
Because cloth simulation is CPU intensive, it slows down the speed of the
entire system. Therefore, you can press 'p' to pause the cloth simulation:
'p' - pause the cloth
Expand Down

0 comments on commit 025c46a

Please sign in to comment.