CJoint.generated.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Physics
  7. * @{
  8. */
  9. /// <summary>
  10. /// Base class for all Joint types. Joints constrain how two rigidbodies move relative to one another (for example a door
  11. /// hinge). One of the bodies in the joint must always be movable (non-kinematic).
  12. /// </summary>
  13. [ShowInInspector]
  14. public partial class Joint : Component
  15. {
  16. private Joint(bool __dummy0) { }
  17. protected Joint() { }
  18. /// <summary>
  19. /// Determines the maximum force the joint can apply before breaking. Broken joints no longer participate in physics
  20. /// simulation.
  21. /// </summary>
  22. [ShowInInspector]
  23. public float BreakForce
  24. {
  25. get { return Internal_getBreakForce(mCachedPtr); }
  26. set { Internal_setBreakForce(mCachedPtr, value); }
  27. }
  28. /// <summary>
  29. /// Determines the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  30. /// simulation.
  31. /// </summary>
  32. [ShowInInspector]
  33. public float BreakTorque
  34. {
  35. get { return Internal_getBreakTorque(mCachedPtr); }
  36. set { Internal_setBreakTorque(mCachedPtr, value); }
  37. }
  38. /// <summary>Determines whether collision between the two bodies managed by the joint are enabled.</summary>
  39. [ShowInInspector]
  40. public bool EnableCollision
  41. {
  42. get { return Internal_getEnableCollision(mCachedPtr); }
  43. set { Internal_setEnableCollision(mCachedPtr, value); }
  44. }
  45. /// <summary>Triggered when the joint's break force or torque is exceeded.</summary>
  46. public event Action OnJointBreak;
  47. /// <summary>Determines a body managed by the joint. One of the bodies must be movable (non-kinematic).</summary>
  48. public Rigidbody GetBody(JointBody body)
  49. {
  50. return Internal_getBody(mCachedPtr, body);
  51. }
  52. /// <summary>Determines a body managed by the joint. One of the bodies must be movable (non-kinematic).</summary>
  53. public void SetBody(JointBody body, Rigidbody value)
  54. {
  55. Internal_setBody(mCachedPtr, body, value);
  56. }
  57. /// <summary>Returns the position relative to the body, at which the body is anchored to the joint.</summary>
  58. public Vector3 GetPosition(JointBody body)
  59. {
  60. Vector3 temp;
  61. Internal_getPosition(mCachedPtr, body, out temp);
  62. return temp;
  63. }
  64. /// <summary>Returns the rotation relative to the body, at which the body is anchored to the joint.</summary>
  65. public Quaternion GetRotation(JointBody body)
  66. {
  67. Quaternion temp;
  68. Internal_getRotation(mCachedPtr, body, out temp);
  69. return temp;
  70. }
  71. /// <summary>Sets the position and rotation relative to the body, at which the body is anchored to the joint.</summary>
  72. public void SetTransform(JointBody body, Vector3 position, Quaternion rotation)
  73. {
  74. Internal_setTransform(mCachedPtr, body, ref position, ref rotation);
  75. }
  76. [MethodImpl(MethodImplOptions.InternalCall)]
  77. private static extern Rigidbody Internal_getBody(IntPtr thisPtr, JointBody body);
  78. [MethodImpl(MethodImplOptions.InternalCall)]
  79. private static extern void Internal_setBody(IntPtr thisPtr, JointBody body, Rigidbody value);
  80. [MethodImpl(MethodImplOptions.InternalCall)]
  81. private static extern void Internal_getPosition(IntPtr thisPtr, JointBody body, out Vector3 __output);
  82. [MethodImpl(MethodImplOptions.InternalCall)]
  83. private static extern void Internal_getRotation(IntPtr thisPtr, JointBody body, out Quaternion __output);
  84. [MethodImpl(MethodImplOptions.InternalCall)]
  85. private static extern void Internal_setTransform(IntPtr thisPtr, JointBody body, ref Vector3 position, ref Quaternion rotation);
  86. [MethodImpl(MethodImplOptions.InternalCall)]
  87. private static extern float Internal_getBreakForce(IntPtr thisPtr);
  88. [MethodImpl(MethodImplOptions.InternalCall)]
  89. private static extern void Internal_setBreakForce(IntPtr thisPtr, float force);
  90. [MethodImpl(MethodImplOptions.InternalCall)]
  91. private static extern float Internal_getBreakTorque(IntPtr thisPtr);
  92. [MethodImpl(MethodImplOptions.InternalCall)]
  93. private static extern void Internal_setBreakTorque(IntPtr thisPtr, float torque);
  94. [MethodImpl(MethodImplOptions.InternalCall)]
  95. private static extern bool Internal_getEnableCollision(IntPtr thisPtr);
  96. [MethodImpl(MethodImplOptions.InternalCall)]
  97. private static extern void Internal_setEnableCollision(IntPtr thisPtr, bool value);
  98. private void Internal_onJointBreak()
  99. {
  100. OnJointBreak?.Invoke();
  101. }
  102. }
  103. /** @} */
  104. }