Package ecs
Class CollisionHandler
java.lang.Object
ecs.Component
ecs.CollisionHandler
- All Implemented Interfaces:
Comparable<Component>
A component to handle and react to collisions using a collider.
Can be attached to an object if it should react to collisions in any way.
- Since:
- 07.12.2021
- Author:
- Juyas
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ecs.Component
Component.ComponentOrder
-
Field Summary
Fields inherited from class ecs.Component
gameObject
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
collision
(Collider environment, CollisionInformation collisionInformation) Will be called in the update loop if a collision happensCollisionInformation.collision()
with the given environment collider and the defined one of this handler {@link this#getCollider()}.protected Collider
void
start()
Called once on Component initialization.void
update
(float dt) Called once per frame for each Component
-
Constructor Details
-
CollisionHandler
-
-
Method Details
-
start
public void start()Description copied from class:Component
Called once on Component initialization. -
update
public void update(float dt) Description copied from class:Component
Called once per frame for each Component -
getCollider
-
collision
Will be called in the update loop if a collision happensCollisionInformation.collision()
with the given environment collider and the defined one of this handler {@link this#getCollider()}.- Parameters:
environment
- the other collider in the environmentcollisionInformation
- the data about the collision
-