CJoint.generated.cs 4.3 KB

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