All Implemented Interfaces:
Destructible, Printable, ApplicationContext, ApplicationProvider, ComponentsContext, ComponentsProvider, EntityContext, EntityProvider, ColoredDrawable, Drawable, SceneContext, SceneProvider

public class RectCollider extends Collider
An axis-aligned bounding box collider.
  • Field Details

  • Constructor Details

  • Method Details

    • collidesWith

      @Experimental public boolean collidesWith(RectCollider other)
    • collidesWith

      @Experimental public boolean collidesWith(CircleCollider other)
    • collidesWith

      @Experimental public boolean collidesWith(Collider other)
      Description copied from class: Collider
      Checks if this collider collides with another collider.
      Overrides:
      collidesWith in class Collider
      Parameters:
      other - The other collider
      Returns:
      true if the colliders are colliding.
    • isInside

      public boolean isInside(Vector2f point)
      Checks if a given point is inside this rectangle.
      Returns:
      true if the point is inside this rectangle.
    • isInside

      public boolean isInside(float x, float y)
      Checks if a given point is inside this rectangle.
      Parameters:
      x - The x value of the point
      y - The y value of the point
      Returns:
      true if the point is inside this rectangle.
    • getCenter

      public Vector2f getCenter()
      Calculates the point at the center of this rectangle.
      Returns:
      The point at the center of this rectangle.
    • getCenterX

      public float getCenterX()
      Calculates the x value of the center of this rectangle.
      Returns:
      The horizontal center of this rectangle.
    • getCenterY

      public float getCenterY()
      Calculates the y value of the center of this rectangle.
      Returns:
      The vertical center of this rectangle.
    • getRight

      public float getRight()
      Calculates the x value of the right edge of this rectangle.
      Returns:
      The maximum x value.
    • getLeft

      public float getLeft()
      Calculates the x value of the left edge of this rectangle.
      Returns:
      The minimum x value.
    • getTop

      public float getTop()
      Calculates the y value of the top edge of this rectangle.
      Returns:
      The maximum y value.
    • getBottom

      public float getBottom()
      Calculates the y value of the bottom edge of this rectangle.
      Returns:
      The minimum y value.
    • draw

      public void draw(Renderer renderer, Color color, float depth)
      Description copied from class: Collider
      Draws this collider in a given color.
      Specified by:
      draw in interface ColoredDrawable
      Overrides:
      draw in class Collider
      Parameters:
      renderer - The renderer
      color - The color to draw with
      depth - The depth of the entity