BodyActivationListener.h 1.1 KB

123456789101112131415161718192021222324252627
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. JPH_NAMESPACE_BEGIN
  5. class BodyID;
  6. /// A listener class that receives events when a body activates or deactivates.
  7. /// It can be registered with the BodyManager (or PhysicsSystem).
  8. class BodyActivationListener
  9. {
  10. public:
  11. /// Ensure virtual destructor
  12. virtual ~BodyActivationListener() = default;
  13. /// Called whenever a body activates, note this can be called from any thread so make sure your code is thread safe.
  14. /// At the time of the callback the body inBodyID will be locked and no bodies can be activated/deactivated from the callback.
  15. virtual void OnBodyActivated(const BodyID &inBodyID, uint64 inBodyUserData) = 0;
  16. /// Called whenever a body deactivates, note this can be called from any thread so make sure your code is thread safe.
  17. /// At the time of the callback the body inBodyID will be locked and no bodies can be activated/deactivated from the callback.
  18. virtual void OnBodyDeactivated(const BodyID &inBodyID, uint64 inBodyUserData) = 0;
  19. };
  20. JPH_NAMESPACE_END