java.lang.Object
technology.sola.engine.physics.component.particle.emitter.ParticleEmitterShape
Direct Known Subclasses:
CircleEmitterShape, RectangleEmitterShape, TrapezoidEmitterShape, TriangleEmitterShape

@NullMarked public abstract class ParticleEmitterShape extends Object
ParticleEmitterShape defines the API for a particle emission shape to be used in ParticleEmissionConfiguration.
  • Constructor Details

    • ParticleEmitterShape

      public ParticleEmitterShape()
  • Method Details

    • nextEmission

      public EmissionDetails nextEmission()
      Calculates the position and direction details for the next particle emitted.
      Returns:
      the EmissionDetails for the next particle emitted.
    • isEmitFromShell

      public boolean isEmitFromShell()
      Returns:
      true if particles should only be emitted from the shell of the shape
    • setEmitFromShell

      public ParticleEmitterShape setEmitFromShell(boolean emitFromShell)
      Sets whether particles should only be emitted from the shell of the shape.
      Parameters:
      emitFromShell - true if particles should only be emitted from the shell of the shape
      Returns:
      this
    • isRandomDirection

      public boolean isRandomDirection()
      Returns:
      true if particles should be emitted in a random direction
    • setRandomDirection

      public ParticleEmitterShape setRandomDirection(boolean randomDirection)
      Sets whether particles should be emitted in a random direction. Otherwise, particles will be emitted away from the shape's center.
      Parameters:
      randomDirection - true if particles should be emitted in a random direction
      Returns:
      this
    • getCenter

      protected abstract Vector2D getCenter()
      Returns:
      the center point of the shape
    • randomPointInShape

      protected abstract Vector2D randomPointInShape()
      Returns:
      a random point inside the shape
    • randomPointOnPerimeter

      protected abstract Vector2D randomPointOnPerimeter()
      Returns:
      a random point on the perimeter of the shape