SimShapeFilterTest.h 954 B

12345678910111213141516171819202122232425262728293031323334
  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 mCompoundID;
  24. };
  25. Filter mShapeFilter;
  26. };