KinematicRigTest.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Jolt Physics Library (https://github.com/jrouwe/JoltPhysics)
  2. // SPDX-FileCopyrightText: 2021 Jorrit Rouwe
  3. // SPDX-License-Identifier: MIT
  4. #pragma once
  5. #include <Tests/Test.h>
  6. #include <Jolt/Skeleton/Skeleton.h>
  7. #include <Jolt/Skeleton/SkeletalAnimation.h>
  8. #include <Jolt/Skeleton/SkeletonPose.h>
  9. #include <Utils/RagdollLoader.h>
  10. #include <Jolt/Physics/Ragdoll/Ragdoll.h>
  11. class KinematicRigTest : public Test
  12. {
  13. public:
  14. JPH_DECLARE_RTTI_VIRTUAL(JPH_NO_EXPORT, KinematicRigTest)
  15. // Description of the test
  16. virtual const char * GetDescription() const override
  17. {
  18. return "Tests a kinematic ragdoll moving towards a wall of boxes.\n"
  19. "Also demonstrates that kinematic bodies don't get influenced by static bodies.";
  20. }
  21. // Destructor
  22. virtual ~KinematicRigTest() override;
  23. // Number used to scale the terrain and camera movement to the scene
  24. virtual float GetWorldScale() const override { return 0.2f; }
  25. virtual void Initialize() override;
  26. virtual void PrePhysicsUpdate(const PreUpdateParams &inParams) override;
  27. // Saving / restoring state for replay
  28. virtual void SaveState(StateRecorder &inStream) const override;
  29. virtual void RestoreState(StateRecorder &inStream) override;
  30. private:
  31. float mTime = 0.0f;
  32. Ref<RagdollSettings> mRagdollSettings;
  33. Ref<Ragdoll> mRagdoll;
  34. Ref<SkeletalAnimation> mAnimation;
  35. SkeletonPose mPose;
  36. };