BsSphericalJoint.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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. * A spherical joint removes all translational degrees of freedom but allows all rotational degrees of freedom.
  13. * Essentially this ensures that the anchor points of the two bodies are always coincident. Bodies are allowed to
  14. * rotate around the anchor points, and their rotatation can be limited by an elliptical cone.
  15. */
  16. class BS_CORE_EXPORT SphericalJoint : public Joint
  17. {
  18. public:
  19. /** Flags that control options for the spherical joint */
  20. enum class Flag
  21. {
  22. Limit = 0x1
  23. };
  24. public:
  25. virtual ~SphericalJoint() { }
  26. /**
  27. * Returns the limit of the joint. This clamps the rotation inside an eliptical angular cone. You must enable limit
  28. * flag on the joint in order for this to be recognized.
  29. */
  30. virtual LimitConeRange getLimit() const = 0;
  31. /**
  32. * Sets the limit of the joint. This clamps the rotation inside an eliptical angular cone. You must enable limit
  33. * flag on the joint in order for this to be recognized.
  34. */
  35. virtual void setLimit(const LimitConeRange& limit) = 0;
  36. /** Enables or disables a flag that controls the joint's behaviour. */
  37. virtual void setFlag(Flag flag, bool enabled) = 0;
  38. /** Checks is the specified flag enabled. */
  39. virtual bool hasFlag(Flag flag) const = 0;
  40. /** Creates a new spherical joint. */
  41. static SPtr<SphericalJoint> create();
  42. };
  43. /** @} */
  44. }