Package physics.force

Class IncrementalForce

java.lang.Object
physics.force.IncrementalForce
All Implemented Interfaces:
Force

public class IncrementalForce extends Object implements Force
Since:
07.12.2021
Author:
Juyas
  • Constructor Details

    • IncrementalForce

      public IncrementalForce(String identifier, org.joml.Vector2f direction, float increment, float limit)
  • Method Details

    • identifier

      public String identifier()
      Description copied from interface: Force
      A unique identifier for this force, can be used as name as well.
      Specified by:
      identifier in interface Force
      Returns:
      the unique identifier
    • update

      public boolean update(float dt)
      Description copied from interface: Force
      Called with the update cycle of the related object. If assigned to multiple objects, this will be called multiple times per update cycles. The order in the calls happen is undefined and therefore its not recommended to assign a force, which changes over time or in relation to anything else, to multiple objects. Constant forces like gravity however can be reused of course.
      Specified by:
      update in interface Force
      Parameters:
      dt - the delta time passed by the update cycle
      Returns:
      whether the force has changed due to this call
    • direction

      public org.joml.Vector2f direction()
      Description copied from interface: Force
      The direction and strength of this force as Vector2f.
      Specified by:
      direction in interface Force
      Returns:
      the force as vector
    • reset

      public void reset()