java.lang.Object
technology.sola.ecs.EcsSystem
technology.sola.engine.physics.system.GravitySystem
@NullMarked
public class GravitySystem
extends technology.sola.ecs.EcsSystem
GravitySystem is an
EcsSystem
that applies a gravity constant of force to all
Entity
that have a DynamicBodyComponent
, are not kinematic and not grounded.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
The order for this system which is one before thePhysicsSystem.ORDER
. -
Constructor Summary
ConstructorsConstructorDescriptionGravitySystem
(EventHub eventHub) Creates a GravitySystem instance and registers event listeners toCollisionEvent
to handle updating the grounding of dynamic bodies.GravitySystem
(EventHub eventHub, float gravityConstant) Creates a GravitySystem instance with desired gravity constant and registers event listeners toCollisionEvent
to handle updating the grounding of dynamic bodies. -
Method Summary
Modifier and TypeMethodDescriptionfloat
int
getOrder()
void
setGravityConstant
(float gravityConstant) Updates the gravity constantvoid
update
(technology.sola.ecs.World world, float deltaTime) Methods inherited from class technology.sola.ecs.EcsSystem
isActive, setActive
-
Field Details
-
ORDER
public static final int ORDERThe order for this system which is one before thePhysicsSystem.ORDER
.- See Also:
-
-
Constructor Details
-
GravitySystem
Creates a GravitySystem instance and registers event listeners toCollisionEvent
to handle updating the grounding of dynamic bodies.- Parameters:
eventHub
- theEventHub
instance
-
GravitySystem
Creates a GravitySystem instance with desired gravity constant and registers event listeners toCollisionEvent
to handle updating the grounding of dynamic bodies.- Parameters:
eventHub
- theEventHub
instancegravityConstant
- the gravity constant to use
-
-
Method Details
-
update
public void update(technology.sola.ecs.World world, float deltaTime) - Specified by:
update
in classtechnology.sola.ecs.EcsSystem
-
getOrder
public int getOrder()- Overrides:
getOrder
in classtechnology.sola.ecs.EcsSystem
-
getGravityConstant
public float getGravityConstant()- Returns:
- the gravity constant
-
setGravityConstant
public void setGravityConstant(float gravityConstant) Updates the gravity constant- Parameters:
gravityConstant
- the new gravity constant
-