Update of /cvsroot/plib/plib/src/sg
In directory usw-pr-cvs1:/tmp/cvs-serv1434/plib/src/sg
Modified Files:
sg.h
Log Message:
Added collisions to dynamics demo.
Index: sg.h
===================================================================
RCS file: /cvsroot/plib/plib/src/sg/sg.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- sg.h 11 Aug 2002 18:34:54 -0000 1.43
+++ sg.h 11 Aug 2002 19:52:07 -0000 1.44
@@ -2707,6 +2707,15 @@
void subForce ( sgVec3 f ) { sgSubVec3 ( force, f ) ; }
void gravityOnly () { sgScaleVec3 ( force, sgGetGravityVec3 (), ooMass ) ; }
+ void bounce ( sgVec3 normal, float coefRestitution )
+ {
+ sgVec3 vn, vt ;
+ sgScaleVec3 ( vn, normal,
+ sgScalarProductVec3 ( normal, vel ) ) ;
+ sgSubVec3 ( vt, vel, vn ) ;
+ sgAddScaledVec3 ( vel, vt, vn, -coefRestitution ) ;
+ }
+
void update ( float dt )
{
sgAddScaledVec3 ( vel, force, dt * ooMass ) ;
|