ContactListenerTest.h 913 B

12345678910111213141516171819202122232425262728
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Tests/Test.h>
  5. #include <Jolt/Physics/Collision/ContactListener.h>
  6. // Tests the contact listener callbacks
  7. class ContactListenerTest : public Test, public ContactListener
  8. {
  9. public:
  10. JPH_DECLARE_RTTI_VIRTUAL(ContactListenerTest)
  11. // See: Test
  12. virtual void Initialize() override;
  13. // If this test implements a contact listener, it should be returned here
  14. virtual ContactListener *GetContactListener() override { return this; }
  15. // See: ContactListener
  16. virtual ValidateResult OnContactValidate(const Body &inBody1, const Body &inBody2, const CollideShapeResult &inCollisionResult) override;
  17. virtual void OnContactAdded(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) override;
  18. private:
  19. // The 4 bodies that we create
  20. Body * mBody[4];
  21. };