Package ecs

Class Dynamics

All Implemented Interfaces:
Comparable<Component>

public class Dynamics extends Component
The Dynamics manage movement of a GameObject.
Since:
06.12.2021
Author:
Juyas
  • Field Details

    • DEFAULT_FORCE_CAPACITY

      public static final int DEFAULT_FORCE_CAPACITY
      See Also:
  • Constructor Details

    • Dynamics

      public Dynamics()
  • Method Details

    • velocity

      public final org.joml.Vector2f velocity()
      The current directional velocity of the physical entity.
      Returns:
      the current directional velocity
    • applyForce

      public final void applyForce(Force force)
      Applies another force to the physical entity that will be added to the physical entities effective force.
      Parameters:
      force - a new force effecting this entity
    • removeForce

      public final boolean removeForce(String identifier)
      Removes all forces matching a given identifier. They will no longer effect the force of the entity.
      Parameters:
      identifier - the identifier to find all matching forces
      Returns:
      true if any force got removed
    • update

      public void update(float dt)
      Description copied from class: Component
      Called once per frame for each Component
      Overrides:
      update in class Component
      Parameters:
      dt - Engine.deltaTime