BsSliderJoint.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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. /**
  12. * Joint that removes all but a single translational degree of freedom. Bodies are allowed to move along a single axis.
  13. */
  14. class BS_CORE_EXPORT SliderJoint : public Joint
  15. {
  16. public:
  17. /** Flag that controls slider joint's behaviour. */
  18. enum class Flag
  19. {
  20. Limit = 0x1,
  21. };
  22. public:
  23. virtual ~SliderJoint() { }
  24. /** Returns the current position of the slider. */
  25. virtual float getPosition() const = 0;
  26. /** Returns the current speed of the slider. */
  27. virtual float getSpeed() const = 0;
  28. /**
  29. * Returns a limit that constrains the movement of the joint to a specific minimum and maximum distance. You must
  30. * enable the limit flag on the joint in order for this to be recognized.
  31. *
  32. * @see LimitLinearRange
  33. */
  34. virtual LimitLinearRange getLimit() const = 0;
  35. /**
  36. * Sets a limit that constrains the movement of the joint to a specific minimum and maximum distance. You must
  37. * enable the limit flag on the joint in order for this to be recognized.
  38. *
  39. * @see LimitLinearRange
  40. */
  41. virtual void setLimit(const LimitLinearRange& limit) = 0;
  42. /** Enables or disables a flag that controls the joint's behaviour. */
  43. virtual void setFlag(Flag flag, bool enabled) = 0;
  44. /** Checks is the specified flag enabled. */
  45. virtual bool hasFlag(Flag flag) const = 0;
  46. /** Creates a new spherical joint. */
  47. static SPtr<SliderJoint> create();
  48. };
  49. /** @} */
  50. }