SimShapeFilterTest.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2024 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Tests/Test.h>
  6. #include <Jolt/Physics/Collision/SimShapeFilter.h>
  7. class SimShapeFilterTest : public Test
  8. {
  9. public:
  10. JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, SimShapeFilterTest)
  11. // Description of the test
  12. virtual const char *GetDescription() const override
  13. {
  14. return "Shows how to use a shape filter during the simulation to disable contacts between certain sub shapes.\n"
  15. "The rod and sphere of the dynamic bodies only collide with the floor.";
  16. }
  17. // Destructor
  18. virtual ~SimShapeFilterTest() override;
  19. // See: Test
  20. virtual void Initialize() override;
  21. private:
  22. // A simulation shape filter
  23. class Filter : public SimShapeFilter
  24. {
  25. public:
  26. virtual bool ShouldCollide(const Body &inBody1, const Shape *inShape1, const SubShapeID &inSubShapeIDOfShape1, const Body &inBody2, const Shape *inShape2, const SubShapeID &inSubShapeIDOfShape2) const override;
  27. BodyID mPlatformID;
  28. BodyID mClothID;
  29. BodyID mCompoundID[2];
  30. };
  31. Filter mShapeFilter;
  32. };