BsFJoint.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /** @cond INTERNAL */
  18. /** Provides common functionality used by all Joint types. */
  19. class BS_CORE_EXPORT FJoint
  20. {
  21. public:
  22. virtual ~FJoint() { }
  23. /** Returns one of the bodies managed by the joint. */
  24. virtual Rigidbody* getBody(JointBody body) const = 0;
  25. /** Sets a body managed by the joint. One of the bodies must be movable (i.e. non-kinematic). */
  26. virtual void setBody(JointBody body, Rigidbody* value) = 0;
  27. /** Returns the position relative to the body, at which the body is anchored to the joint. */
  28. virtual Vector3 getPosition(JointBody body) const = 0;
  29. /** Returns the rotation relative to the body, at which the body is anchored to the joint. */
  30. virtual Quaternion getRotation(JointBody body) const = 0;
  31. /** Sets the position and rotation relative to the body, at which the body is anchored to the joint. */
  32. virtual void setTransform(JointBody body, const Vector3& position, const Quaternion& rotation) = 0;
  33. /**
  34. * Returns the maximum force the joint can apply before breaking. Broken joints no longer participate in physics
  35. * simulation.
  36. */
  37. virtual float getBreakForce() const = 0;
  38. /**
  39. * Sets the maximum force the joint can apply before breaking. Broken joints no longer participate in physics
  40. * simulation.
  41. */
  42. virtual void setBreakForce(float force) = 0;
  43. /**
  44. * Returns the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  45. * simulation.
  46. */
  47. virtual float getBreakTorque() const = 0;
  48. /**
  49. * Sets the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  50. * simulation.
  51. */
  52. virtual void setBreakTorque(float torque) = 0;
  53. /** Checks whether collisions between the two bodies managed by the joint are enabled. */
  54. virtual bool getEnableCollision() const = 0;
  55. /** Sets whether collision between the two bodies managed by the joint are enabled. */
  56. virtual void setEnableCollision(bool value) = 0;
  57. };
  58. /** @endcond */
  59. /** @} */
  60. }