java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.physics.collision.Collider
All Implemented Interfaces:
Destructible, Printable, ApplicationContext, ApplicationProvider, ComponentsContext, ComponentsProvider, EntityContext, EntityProvider, ColoredDrawable, Drawable, SceneContext, SceneProvider
Direct Known Subclasses:
CircleCollider, RectCollider

public class Collider extends Component implements ColoredDrawable
  • Field Details

    • offset

      public Vector2f offset
      The offset of this collider from the entity's position.
    • DEFAULT_COLOR

      public static final Color DEFAULT_COLOR
  • Constructor Details

    • Collider

      public Collider(Vector2f offset)
      Creates a collider with a given offset.
      Parameters:
      offset - The offset of the collider
  • Method Details

    • collidesWith

      @Experimental public boolean collidesWith(Collider other)
      Checks if this collider collides with another collider.
      Parameters:
      other - The other collider
      Returns:
      true if the colliders are colliding.
    • getOrigin

      public Vector2f getOrigin()
    • getOriginX

      public float getOriginX()
    • getOriginY

      public float getOriginY()
    • draw

      public void draw(Renderer renderer)
      Draws this collider in a green tint.
      Parameters:
      renderer - The renderer
    • draw

      public void draw(Renderer renderer, float depth)
      Draws this collider in a green tint.
      Specified by:
      draw in interface ColoredDrawable
      Specified by:
      draw in interface Drawable
      Parameters:
      renderer - The renderer
      depth - The depth of the entity
    • draw

      public void draw(Renderer renderer, Color color)
      Draws this collider in a given color.
      Parameters:
      renderer - The renderer
      color - The color to draw with
    • draw

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