Class Collisions

java.lang.Object
buildengine.math.collision.Collisions

public class Collisions extends Object
Handling Collisions using the BuildEngine shape system.
  • Method Details

    • compare

      @Unstable public static Contact compare(Shape a, Shape b)
      Compare two shapes for collision. This method applies the fastest method to do that, but is still pretty performance intensive if used extensively. If so, make sure you do proximity checks first, than use this method for possible collisions.
      Parameters:
      a - The first shape.
      b - The second shape.
      Returns:
      The contact object containing the vector to move a out of b. Returns null if there is no collision.
      Throws:
      IllegalArgumentException - If there is not (yet) a way to compare the two shape objects.
    • compareRectangle

      public static Contact compareRectangle(Rectangle a, Rectangle b)
      Compare two rectangles for collision. Does a lazy check first.
      Parameters:
      a - The first rectangle.
      b - The second rectangle.
      Returns:
      The contact object containing the vector to move a out of b. Returns null if there is no collision.
    • contain

      @Unstable public static Contact contain(Shape a, Vector2f point)
      Contains a point in a shape for collision. This method applies the fastest method to do that, but is still pretty performance intensive if used extensively. If so, make sure you do proximity checks first, than use this method for possible collisions.
      Parameters:
      a - The shape
      point - The point
      Returns:
      A contact object if there is collision containing the vector to move a out of point. Otherwise null.
      Throws:
      IllegalArgumentException - If there is not (yet) a way to contain the shape object.