Package physics.force
Interface Force
- All Known Implementing Classes:
ConstantForce
,IncrementalForce
public interface Force
Can be applied to a
Dynamics
and should be a unique instance for each object in most cases.
This class is independent from the mass of an object. Each object is- Since:
- 20.06.2021
- Author:
- Juyas
-
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector2f
The direction and strength of this force asVector2f
.A unique identifier for this force, can be used as name as well.boolean
update
(float dt) Called with the update cycle of the related object.
-
Method Details
-
identifier
String identifier()A unique identifier for this force, can be used as name as well.- Returns:
- the unique identifier
-
update
boolean update(float dt) 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.- Parameters:
dt
- the delta time passed by the update cycle- Returns:
- whether the force has changed due to this call
-
direction
org.joml.Vector2f direction()The direction and strength of this force asVector2f
.- Returns:
- the force as vector
-