CJoint.generated.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. [NativeWrapper]
  24. public float BreakForce
  25. {
  26. get { return Internal_getBreakForce(mCachedPtr); }
  27. set { Internal_setBreakForce(mCachedPtr, value); }
  28. }
  29. /// <summary>
  30. /// Determines the maximum torque the joint can apply before breaking. Broken joints no longer participate in physics
  31. /// simulation.
  32. /// </summary>
  33. [ShowInInspector]
  34. [NativeWrapper]
  35. public float BreakTorque
  36. {
  37. get { return Internal_getBreakTorque(mCachedPtr); }
  38. set { Internal_setBreakTorque(mCachedPtr, value); }
  39. }
  40. /// <summary>Determines whether collision between the two bodies managed by the joint are enabled.</summary>
  41. [ShowInInspector]
  42. [NativeWrapper]
  43. public bool EnableCollision
  44. {
  45. get { return Internal_getEnableCollision(mCachedPtr); }
  46. set { Internal_setEnableCollision(mCachedPtr, value); }
  47. }
  48. /// <summary>Triggered when the joint's break force or torque is exceeded.</summary>
  49. public event Action OnJointBreak;
  50. /// <summary>Determines a body managed by the joint. One of the bodies must be movable (non-kinematic).</summary>
  51. public Rigidbody GetBody(JointBody body)
  52. {
  53. return Internal_getBody(mCachedPtr, body);
  54. }
  55. /// <summary>Determines a body managed by the joint. One of the bodies must be movable (non-kinematic).</summary>
  56. public void SetBody(JointBody body, Rigidbody value)
  57. {
  58. Internal_setBody(mCachedPtr, body, value);
  59. }
  60. /// <summary>Returns the position relative to the body, at which the body is anchored to the joint.</summary>
  61. public Vector3 GetPosition(JointBody body)
  62. {
  63. Vector3 temp;
  64. Internal_getPosition(mCachedPtr, body, out temp);
  65. return temp;
  66. }
  67. /// <summary>Returns the rotation relative to the body, at which the body is anchored to the joint.</summary>
  68. public Quaternion GetRotation(JointBody body)
  69. {
  70. Quaternion temp;
  71. Internal_getRotation(mCachedPtr, body, out temp);
  72. return temp;
  73. }
  74. /// <summary>Sets the position and rotation relative to the body, at which the body is anchored to the joint.</summary>
  75. public void SetTransform(JointBody body, Vector3 position, Quaternion rotation)
  76. {
  77. Internal_setTransform(mCachedPtr, body, ref position, ref rotation);
  78. }
  79. [MethodImpl(MethodImplOptions.InternalCall)]
  80. private static extern Rigidbody Internal_getBody(IntPtr thisPtr, JointBody body);
  81. [MethodImpl(MethodImplOptions.InternalCall)]
  82. private static extern void Internal_setBody(IntPtr thisPtr, JointBody body, Rigidbody value);
  83. [MethodImpl(MethodImplOptions.InternalCall)]
  84. private static extern void Internal_getPosition(IntPtr thisPtr, JointBody body, out Vector3 __output);
  85. [MethodImpl(MethodImplOptions.InternalCall)]
  86. private static extern void Internal_getRotation(IntPtr thisPtr, JointBody body, out Quaternion __output);
  87. [MethodImpl(MethodImplOptions.InternalCall)]
  88. private static extern void Internal_setTransform(IntPtr thisPtr, JointBody body, ref Vector3 position, ref Quaternion rotation);
  89. [MethodImpl(MethodImplOptions.InternalCall)]
  90. private static extern float Internal_getBreakForce(IntPtr thisPtr);
  91. [MethodImpl(MethodImplOptions.InternalCall)]
  92. private static extern void Internal_setBreakForce(IntPtr thisPtr, float force);
  93. [MethodImpl(MethodImplOptions.InternalCall)]
  94. private static extern float Internal_getBreakTorque(IntPtr thisPtr);
  95. [MethodImpl(MethodImplOptions.InternalCall)]
  96. private static extern void Internal_setBreakTorque(IntPtr thisPtr, float torque);
  97. [MethodImpl(MethodImplOptions.InternalCall)]
  98. private static extern bool Internal_getEnableCollision(IntPtr thisPtr);
  99. [MethodImpl(MethodImplOptions.InternalCall)]
  100. private static extern void Internal_setEnableCollision(IntPtr thisPtr, bool value);
  101. private void Internal_onJointBreak()
  102. {
  103. OnJointBreak?.Invoke();
  104. }
  105. }
  106. /** @} */
  107. }