code: function createCapsuleFromRenderableShape(params, physicsJob) {
    const scale = params.scale;
    const capsuleEndPointsDistance = params.capsuleEndPointsDistance;
    const isStationary = params.isStationary;
    let radius = params.radius;
  
    let halfDistance;
  
    // There are two modes: either we use scale, or we use radius and capsuleEndPointsDistance.
    if (typeof radius === 'number' && typeof capsuleEndPointsDistance === 'number') {
      halfDistance = capsuleEndPointsDistance / 2;
    } else {
      const copy = vec3.clone(scale);
      copy.sort();
  
      const length = copy[2];
      radius = (copy[0] + copy[1]) / 2;
      halfDistance = length / 2 - radius;
    }
  
    const orientation = quat.create();
    if (scale[0] > scale[1]) {
      if (scale[0] > scale[2]) {
        vec3.rotateY(orientation, orientation, _geometry.HALF_PI);
      } else {
        // Do nothing; the capsule defaults to being aligned with the z-axis.
      }
    } else {
      if (scale[1] > scale[2]) {
        vec3.rotateX(orientation, orientation, -_geometry.HALF_PI);
      } else {
        // Do nothing; the capsule defaults to being aligned with the z-axis.
      }
    }
  
    const capsule = new Capsule(halfDistance, radius, isStationary, physicsJob);
    capsule.orientation = orientation;
  
    return capsule;
  }
docs: The radius of the created capsule will be an average from the two shortest sides.
  
  There are two modes: either we use scale, or we use radius and capsuleEndPointsDistance.
  
  @param {CollidableShapeConfig} params
  @param {CollidablePhysicsJob} [physicsJob]
  @returns {Collidable}