// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Level/Actor.h" #include "Engine/Physics/Collisions.h" struct Collision; /// /// A base class for all physical collider actors. /// /// API_CLASS(Abstract) class FLAXENGINE_API PhysicsColliderActor : public Actor { DECLARE_SCENE_OBJECT_ABSTRACT(PhysicsColliderActor); public: /// /// Occurs when a collision start gets registered for this collider (it collides with something). /// API_EVENT() Delegate CollisionEnter; /// /// Occurs when a collision end gets registered for this collider (it ends colliding with something). /// API_EVENT() Delegate CollisionExit; /// /// Occurs when a trigger touching start gets registered for this collider (the other collider enters it and triggers the event). /// API_EVENT() Delegate TriggerEnter; /// /// Occurs when a trigger touching end gets registered for this collider (the other collider enters it and triggers the event). /// API_EVENT() Delegate TriggerExit; public: /// /// Gets the attached rigid body. /// /// The rigid body or null. API_PROPERTY() virtual RigidBody* GetAttachedRigidBody() const = 0; public: /// /// Called when a collision start gets registered for this collider (it collides with something). /// /// The collision info. API_FUNCTION() virtual void OnCollisionEnter(const Collision& c); /// /// Called when a collision end gets registered for this collider (it ends colliding with something). /// /// The collision info. API_FUNCTION() virtual void OnCollisionExit(const Collision& c); /// /// Called when a trigger touching start gets registered for this collider (the other collider enters it and triggers the event). /// /// The other collider. API_FUNCTION() virtual void OnTriggerEnter(PhysicsColliderActor* c); /// /// Called when a trigger touching end gets registered for this collider (the other collider enters it and triggers the event). /// /// The other collider. API_FUNCTION() virtual void OnTriggerExit(PhysicsColliderActor* c); };