@@ -1801,6 +1801,8 @@ class Quaternion {
18011801 target . x = bank ;
18021802 }
18031803 /**
1804+ * Set the quaternion components given Euler angle representation.
1805+ *
18041806 * @param order The order to apply angles: 'XYZ' or 'YXZ' or any other combination.
18051807 *
18061808 * See {@link https://www.mathworks.com/matlabcentral/fileexchange/20696-function-to-convert-between-dcm-euler-angles-quaternions-and-euler-vectors MathWorks} reference
@@ -10457,7 +10459,8 @@ class Narrowphase {
1045710459
1045810460 if ( friction > 0 ) {
1045910461 // Create 2 tangent equations
10460- const mug = friction * world . gravity . length ( ) ;
10462+ // Users may provide a force different from global gravity to use when computing contact friction.
10463+ const mug = friction * ( world . frictionGravity || world . gravity ) . length ( ) ;
1046110464 let reducedMass = bodyA . invMass + bodyB . invMass ;
1046210465
1046310466 if ( reducedMass > 0 ) {
@@ -12115,6 +12118,12 @@ class World extends EventTarget {
1211512118 * The gravity of the world.
1211612119 */
1211712120
12121+ /**
12122+ * Gravity to use when approximating the friction max force (mu*mass*gravity).
12123+ * If undefined, global gravity will be used.
12124+ * Use to enable friction in a World with a null gravity vector (no gravity).
12125+ */
12126+
1211812127 /**
1211912128 * The broadphase algorithm to use.
1212012129 * @default NaiveBroadphase
@@ -12191,6 +12200,11 @@ class World extends EventTarget {
1219112200 this . gravity . copy ( options . gravity ) ;
1219212201 }
1219312202
12203+ if ( options . frictionGravity ) {
12204+ this . frictionGravity = new Vec3 ( ) ;
12205+ this . frictionGravity . copy ( options . frictionGravity ) ;
12206+ }
12207+
1219412208 this . broadphase = options . broadphase !== undefined ? options . broadphase : new NaiveBroadphase ( ) ;
1219512209 this . bodies = [ ] ;
1219612210 this . hasActiveBodies = false ;
0 commit comments