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 intThe order for this system which is one before thePhysicsSystem.ORDER. -
Constructor Summary
ConstructorsConstructorDescriptionGravitySystem(EventHub eventHub) Creates a GravitySystem instance and registers event listeners toCollisionEventto handle updating the grounding of dynamic bodies.GravitySystem(EventHub eventHub, float gravityConstant) Creates a GravitySystem instance with desired gravity constant and registers event listeners toCollisionEventto handle updating the grounding of dynamic bodies. -
Method Summary
Modifier and TypeMethodDescriptionfloatintgetOrder()voidsetGravityConstant(float gravityConstant) Updates the gravity constantvoidupdate(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 toCollisionEventto handle updating the grounding of dynamic bodies.- Parameters:
eventHub- theEventHubinstance
-
GravitySystem
Creates a GravitySystem instance with desired gravity constant and registers event listeners toCollisionEventto handle updating the grounding of dynamic bodies.- Parameters:
eventHub- theEventHubinstancegravityConstant- the gravity constant to use
-
-
Method Details
-
update
public void update(technology.sola.ecs.World world, float deltaTime) - Specified by:
updatein classtechnology.sola.ecs.EcsSystem
-
getOrder
public int getOrder()- Overrides:
getOrderin 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
-