src/misc/kinematic-body.js
function (groundBody, groundNormal) {
    let ray,
        hitNormal,
        vFrom = this.body.position,
        vTo = this.body.position.clone();

    ray = new CANNON.Ray(vFrom, vTo);
    ray._updateDirection(); // TODO - Report bug.
    ray.intersectBody(groundBody);

    if (!ray.hasHit) return groundNormal;

    // Compare ABS, in case we're projecting against the inside of the face.
    hitNormal = ray.result.hitNormalWorld;
    return Math.abs(hitNormal.y) > Math.abs(groundNormal.y) ? hitNormal : groundNormal;
  }
function (groundBody, groundNormal) {
    let ray,
        hitNormal,
        vFrom = this.body.position,
        vTo = this.body.position.clone();

    ray = new CANNON.Ray(vFrom, vTo);
    ray._updateDirection(); // TODO - Report bug.
    ray.intersectBody(groundBody);

    if (!ray.hasHit) return groundNormal;

    // Compare ABS, in case we're projecting against the inside of the face.
    hitNormal = ray.result.hitNormalWorld;
    return Math.abs(hitNormal.y) > Math.abs(groundNormal.y) ? hitNormal : groundNormal;
  }
When walking on complex surfaces (trimeshes, borders between two shapes),
the collision normals returned for the player sphere can be very
inconsistent. To address this, raycast straight down, find the collision
normal, and return whichever normal is more vertical.
@param  {CANNON.Body} groundBody
@param  {CANNON.Vec3} groundNormal
@return {CANNON.Vec3}