ChangeMotionQualityTest.h 914 B

123456789101112131415161718192021222324252627282930313233
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2023 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Tests/Test.h>
  6. #include <Jolt/Physics/Body/Body.h>
  7. class ChangeMotionQualityTest : public Test
  8. {
  9. public:
  10. JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, ChangeMotionQualityTest)
  11. // Description of the test
  12. virtual const char *GetDescription() const override
  13. {
  14. return "Switches a body's motion quality from linear to discrete.\n"
  15. "After the switch, the high speed body passes through the wall.";
  16. }
  17. // See: Test
  18. virtual void Initialize() override;
  19. virtual void PrePhysicsUpdate(const PreUpdateParams &inParams) override;
  20. virtual void SaveState(StateRecorder &inStream) const override;
  21. virtual void RestoreState(StateRecorder &inStream) override;
  22. private:
  23. void UpdateMotionQuality();
  24. Body * mBody = nullptr;
  25. float mTime = 0.0f;
  26. };