ContactListenerTest.h 999 B

1234567891011121314151617181920212223242526272829
  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. virtual void PostPhysicsUpdate(float inDeltaTime) override;
  14. // If this test implements a contact listener, it should be returned here
  15. virtual ContactListener *GetContactListener() override { return this; }
  16. // See: ContactListener
  17. virtual ValidateResult OnContactValidate(const Body &inBody1, const Body &inBody2, RVec3Arg inBaseOffset, const CollideShapeResult &inCollisionResult) override;
  18. virtual void OnContactAdded(const Body &inBody1, const Body &inBody2, const ContactManifold &inManifold, ContactSettings &ioSettings) override;
  19. private:
  20. // The 4 bodies that we create
  21. Body * mBody[4];
  22. };