BsFJoint.h 2.6 KB

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