2
0

BsSliderJoint.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsCorePrerequisites.h"
  5. #include "BsJoint.h"
  6. namespace BansheeEngine
  7. {
  8. /** @addtogroup Physics
  9. * @{
  10. */
  11. struct SLIDER_JOINT_DESC;
  12. /**
  13. * Joint that removes all but a single translational degree of freedom. Bodies are allowed to move along a single axis.
  14. */
  15. class BS_CORE_EXPORT SliderJoint : public Joint
  16. {
  17. public:
  18. /** Flag that controls slider joint's behaviour. */
  19. enum class Flag
  20. {
  21. Limit = 0x1,
  22. };
  23. public:
  24. SliderJoint(const SLIDER_JOINT_DESC& desc) { }
  25. virtual ~SliderJoint() { }
  26. /** Returns the current position of the slider. */
  27. virtual float getPosition() const = 0;
  28. /** Returns the current speed of the slider. */
  29. virtual float getSpeed() const = 0;
  30. /**
  31. * Returns a limit that constrains the movement of the joint to a specific minimum and maximum distance. You must
  32. * enable the limit flag on the joint in order for this to be recognized.
  33. *
  34. * @see LimitLinearRange
  35. */
  36. virtual LimitLinearRange getLimit() const = 0;
  37. /**
  38. * Sets a limit that constrains the movement of the joint to a specific minimum and maximum distance. You must
  39. * enable the limit flag on the joint in order for this to be recognized.
  40. *
  41. * @see LimitLinearRange
  42. */
  43. virtual void setLimit(const LimitLinearRange& limit) = 0;
  44. /** Enables or disables a flag that controls the joint's behaviour. */
  45. virtual void setFlag(Flag flag, bool enabled) = 0;
  46. /** Checks is the specified flag enabled. */
  47. virtual bool hasFlag(Flag flag) const = 0;
  48. /** Creates a new spherical joint. */
  49. static SPtr<SliderJoint> create(const SLIDER_JOINT_DESC& desc);
  50. };
  51. /** Structure used for initializing a new SliderJoint. */
  52. struct SLIDER_JOINT_DESC : JOINT_DESC
  53. {
  54. LimitLinearRange limit;
  55. SliderJoint::Flag flag = (SliderJoint::Flag)0;
  56. };
  57. /** @} */
  58. }