src/physics.js
/*
 * Test wether a body is touching the ground.
 */
Test wether a body is touching the ground.
Test wether a body is touching the ground .
function isGrounded(world, body) {
	if (body.sleepState === body.SLEEPING) {
		return true;
	}
	var eqs = world.narrowphase.contactEquations;
	var thresh = GroundThreshold;
	for (var i = 0; i < eqs.length; i++){
		var eq = eqs[i];
		if (eq.bodyA === body) {
			if (-eq.normalA[1] >= thresh) {
				return true;
			}
		} else if (eq.bodyB === body) {
			if (eq.normalA[1] >= thresh) {
				return true;
			}
		}
	}
	return false;
}
function isGrounded ( world , body ) { if ( body . sleepState === body . SLEEPING ) { return true ; } var eqs = world . narrowphase . contactEquations ; var thresh = GroundThreshold ; for ( var i = 0 ; i < eqs . length ; i ++ ) { var eq = eqs [ i ] ; if ( eq . bodyA === body ) { if ( - eq . normalA [ 1 ] >= thresh ) { return true ; } } else if ( eq . bodyB === body ) { if ( eq . normalA [ 1 ] >= thresh ) { return true ; } } } return false ; }
Test wether a body is touching the ground.
Test wether a body is touching the ground .