SimShapeFilterTest.h 978 B

1234567891011121314151617181920212223242526272829303132333435
  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. // This test shows how to use a shape filter during the simulation to disable contacts between certain sub shapes
  8. class SimShapeFilterTest : public Test
  9. {
  10. public:
  11. JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, SimShapeFilterTest)
  12. // Destructor
  13. virtual ~SimShapeFilterTest() override;
  14. // See: Test
  15. virtual void Initialize() override;
  16. private:
  17. // A simulation shape filter
  18. class Filter : public SimShapeFilter
  19. {
  20. public:
  21. virtual bool ShouldCollide(const Body &inBody1, const Shape *inShape1, const SubShapeID &inSubShapeIDOfShape1, const Body &inBody2, const Shape *inShape2, const SubShapeID &inSubShapeIDOfShape2) const override;
  22. BodyID mPlatformID;
  23. BodyID mClothID;
  24. BodyID mCompoundID[2];
  25. };
  26. Filter mShapeFilter;
  27. };