BsFJoint.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 "BsVector3.h"
  6. #include "BsQuaternion.h"
  7. namespace BansheeEngine
  8. {
  9. /** @addtogroup Physics
  10. * @{
  11. */
  12. /** Specifies first or second body referenced by a Joint. */
  13. enum class JointBody
  14. {
  15. A, B
  16. };
  17. /** @} */
  18. /** @addtogroup Physics-Internal
  19. * @{
  20. */
  21. /** Provides common functionality used by all Joint types. */
  22. class BS_CORE_EXPORT FJoint
  23. {
  24. public:
  25. virtual ~FJoint() { }
  26. /** Returns one of the bodies managed by the joint. */
  27. virtual Rigidbody* getBody(JointBody body) const = 0;
  28. /** Sets a body managed by the joint. One of the bodies must be movable (non-kinematic). */
  29. virtual void setBody(JointBody body, Rigidbody* value) = 0;
  30. /** Returns the position relative to the body, at which the body is anchored to the joint. */
  31. virtual Vector3 getPosition(JointBody body) const = 0;
  32. /** Returns the rotation relative to the body, at which the body is anchored to the joint. */
  33. virtual Quaternion getRotation(JointBody body) const = 0;
  34. /** Sets the position and rotation relative to the body, at which the body is anchored to the joint. */
  35. virtual void setTransform(JointBody body, const Vector3& position, const Quaternion& rotation) = 0;
  36. /**
  37. * Returns the maximum force the joint can apply before breaking. Broken joints no longer participate in physics
  38. * simulation.
  39. */
  40. virtual float getBreakForce() const = 0;
  41. /**
  42. * Sets the maximum force the joint can apply before breaking. Broken joints no longer participate in physics
  43. * simulation.
  44. */
  45. virtual void setBreakForce(float force) = 0;
  46. /**
  47. * Returns the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  48. * simulation.
  49. */
  50. virtual float getBreakTorque() const = 0;
  51. /**
  52. * Sets the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  53. * simulation.
  54. */
  55. virtual void setBreakTorque(float torque) = 0;
  56. /** Checks whether collisions between the two bodies managed by the joint are enabled. */
  57. virtual bool getEnableCollision() const = 0;
  58. /** Sets whether collision between the two bodies managed by the joint are enabled. */
  59. virtual void setEnableCollision(bool value) = 0;
  60. };
  61. /** @} */
  62. }