ShapeFilter.h 721 B

123456789101112131415161718192021222324252627282930
  1. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  2. // SPDX-License-Identifier: MIT
  3. #pragma once
  4. #include <Physics/Body/BodyID.h>
  5. #include <Core/NonCopyable.h>
  6. namespace JPH {
  7. class SubShapeID;
  8. /// Filter class
  9. class ShapeFilter : public NonCopyable
  10. {
  11. public:
  12. /// Destructor
  13. virtual ~ShapeFilter() = default;
  14. /// Filter function to determine if two shapes should collide. Returns true if the filter passes.
  15. virtual bool ShouldCollide(const SubShapeID &inSubShapeID1, const SubShapeID &inSubShapeID2) const
  16. {
  17. return true;
  18. }
  19. /// Set by the collision detection functions to the body ID of the body that we're colliding against before calling the ShouldCollide function
  20. mutable BodyID mBodyID2;
  21. };
  22. } // JPH