ref: df9fa964245e5bc1b014c73dcf81aa931abe8c71
parent: e07fbb3904e8194fb620988ee47c32b443884c3a
author: MHS <gek@katherine>
date: Tue Mar 16 16:08:01 EDT 2021
Automatic commit.
--- a/include-demo/chadphys.h
+++ b/include-demo/chadphys.h
@@ -75,6 +75,7 @@
}
if(penvec.d[3] <= 0) return; //No penetration detected, or invalid configuration.
vec3 penvecnormalized = scalev3(1.0/penvec.d[3], downv4(penvec)); //the penetration vector points into B...
+ float friction = a->friction * b->friction;
//We now have the penetration vector. There is a penetration.
//determine how much each should be displaced by.
//The penvec points INTO A and is of length penvec.d[3]
@@ -99,7 +100,7 @@
a->shape.c.d[0] += displacea.d[0];
a->shape.c.d[1] += displacea.d[1];
a->shape.c.d[2] += displacea.d[2];
- a->v = addv3( comvel, scalev3(a->friction, a_planarvel) ); //The center of mass velocity, plus a portion of coplanar velocity.
+ a->v = addv3( comvel, scalev3(1-friction, a_planarvel) ); //The center of mass velocity, plus a portion of coplanar velocity.
a->v = addv3(a->v, scalev3( a->bounciness, downv4(displacea) ) );
}
if(b->mass > 0){
@@ -114,7 +115,7 @@
b->shape.c.d[0] += displaceb.d[0];
b->shape.c.d[1] += displaceb.d[1];
b->shape.c.d[2] += displaceb.d[2];
- b->v = addv3(comvel, scalev3(b->friction, b_planarvel) ); //The center of mass velocity, plus a portion of coplanar velocity.
+ b->v = addv3(comvel, scalev3(1-friction, b_planarvel) ); //The center of mass velocity, plus a portion of coplanar velocity.
b->v = addv3(b->v, scalev3( b->bounciness, downv4(displaceb) ) );
}
}