BsFJoint.h 2.4 KB

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