BodyActivationListener.h 1.1 KB

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