I am able to resolve collision between an OBB and a plane but can't get it to work when I introduce some bounds on the plane size. I want to have the plane of width and height dimensions defined by a normal and a position.

The code for detecting/resolving is fairly simple if the plane doesn't have any bounds:

function obbIntersectsPlane( obb, plane ) {
  let r = obb.size.x / 2 * Math.abs( dot( obb.right, plane.normal ) ) + 
          obb.size.y / 2 * Math.abs( dot( obb.up, plane.normal ) ) +
          obb.size.z / 2 * Math.abs( dot( obb.forward, plane.normal ) );
  let s = dot( plane.normal, obb.position ) - dot( plane.normal, plane.position );

  if ( Math.abs( s ) < r ) {
    return {
      overlap: r - s,
      vector: plane.normal

  return false;
  • 1
    \$\begingroup\$ Have you considered treating the quad as an extremely thin OBB? \$\endgroup\$
    – DMGregory
    Commented Oct 28, 2020 at 16:51
  • \$\begingroup\$ yeah i have already tried it and it works but am i not doing extra calculations? a quad needs 4 vertices, an obb 8. But I think i shouldn't care about that and let it be like that. I should mention that I had to tweak something in how I calculated overlaps for various axes to account for situations in which the projection of one object was completely inside the projection of the other. This is crucial if the size is close to 0 or you will have extremely slow resolution or no resolution at all when the size is absolutely 0. Edit: I think i should post the new overlap calculation code \$\endgroup\$ Commented Oct 30, 2020 at 8:24

1 Answer 1


Taking the plane as an obb with depth=0 works fine for me. I had to modify how I calculated overlap though to account for cases when the projection of one object was fully inside the other object's projection.

let overlap;

// check for cases when the projection is fully inside the projection of the other object

if ( a_max > b_max && a_min < b_min ) {
    overlap = Math.min( a_max - b_min, b_max - a_min );
} else if ( b_max > a_max && b_min < a_min ) {
    overlap = Math.min( b_max - a_min, a_max - b_min );
} else {
    overlap = Math.min( a_max, b_max ) - Math.max( a_min, b_min );

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .