BsSliderJoint.h 1.9 KB

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