CCollider.generated.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. /// Collider represents physics geometry that can be in multiple states: - Default: Static geometry that physics objects
  11. /// can collide with. - Trigger: Static geometry that can't be collided with but will report touch events. - Dynamic:
  12. /// Dynamic geometry that is a part of a Rigidbody. A set of colliders defines the shape of the parent rigidbody.
  13. /// </summary>
  14. [ShowInInspector]
  15. public partial class Collider : Component
  16. {
  17. private Collider(bool __dummy0) { }
  18. protected Collider() { }
  19. /// <summary>
  20. /// Enables/disables a collider as a trigger. A trigger will not be used for collisions (objects will pass through it),
  21. /// but collision events will still be reported.
  22. /// </summary>
  23. [ShowInInspector]
  24. public bool Trigger
  25. {
  26. get { return Internal_getIsTrigger(mCachedPtr); }
  27. set { Internal_setIsTrigger(mCachedPtr, value); }
  28. }
  29. /// <summary>
  30. /// Determines the mass of the collider. Only relevant if the collider is part of a rigidbody. Ultimately this will
  31. /// determine the total mass, center of mass and inertia tensors of the parent rigidbody (if they're being calculated
  32. /// automatically).
  33. /// </summary>
  34. [ShowInInspector]
  35. public float Mass
  36. {
  37. get { return Internal_getMass(mCachedPtr); }
  38. set { Internal_setMass(mCachedPtr, value); }
  39. }
  40. /// <summary>
  41. /// Determines the physical material of the collider. The material determines how objects hitting the collider behave.
  42. /// </summary>
  43. [ShowInInspector]
  44. public RRef<PhysicsMaterial> Material
  45. {
  46. get { return Internal_getMaterial(mCachedPtr); }
  47. set { Internal_setMaterial(mCachedPtr, value); }
  48. }
  49. /// <summary>
  50. /// Determines how far apart do two shapes need to be away from each other before the physics runtime starts generating
  51. /// repelling impulse for them. This distance will be the sum of contact offsets of the two interacting objects. If
  52. /// objects are moving fast you can increase this value to start generating the impulse earlier and potentially prevent
  53. /// the objects from interpenetrating. This value is in meters. Must be positive and greater than rest offset.
  54. ///
  55. /// Also see setRestOffset().
  56. /// </summary>
  57. [ShowInInspector]
  58. public float ContactOffset
  59. {
  60. get { return Internal_getContactOffset(mCachedPtr); }
  61. set { Internal_setContactOffset(mCachedPtr, value); }
  62. }
  63. /// <summary>
  64. /// Determines at what distance should two objects resting on one another come to an equilibrium. The value used in the
  65. /// runtime will be the sum of rest offsets for both interacting objects. This value is in meters. Cannot be larger than
  66. /// contact offset.
  67. ///
  68. /// Also see setContactOffset().
  69. /// </summary>
  70. [ShowInInspector]
  71. public float RestOffset
  72. {
  73. get { return Internal_getRestOffset(mCachedPtr); }
  74. set { Internal_setRestOffset(mCachedPtr, value); }
  75. }
  76. /// <summary>Determines the layer of the collider. Layer controls with which objects will the collider collide.</summary>
  77. [ShowInInspector]
  78. public ulong Layer
  79. {
  80. get { return Internal_getLayer(mCachedPtr); }
  81. set { Internal_setLayer(mCachedPtr, value); }
  82. }
  83. /// <summary>Determines which (if any) collision events are reported.</summary>
  84. [ShowInInspector]
  85. public CollisionReportMode CollisionReportMode
  86. {
  87. get { return Internal_getCollisionReportMode(mCachedPtr); }
  88. set { Internal_setCollisionReportMode(mCachedPtr, value); }
  89. }
  90. /// <summary>
  91. /// Triggered when some object starts interacting with the collider. Only triggered if proper collision report mode is
  92. /// turned on.
  93. /// </summary>
  94. public event Action<CollisionData> OnCollisionBegin;
  95. /// <summary>
  96. /// Triggered for every frame that an object remains interacting with a collider. Only triggered if proper collision
  97. /// report mode is turned on.
  98. /// </summary>
  99. public event Action<CollisionData> OnCollisionStay;
  100. /// <summary>
  101. /// Triggered when some object stops interacting with the collider. Only triggered if proper collision report mode is
  102. /// turned on.
  103. /// </summary>
  104. public event Action<CollisionData> OnCollisionEnd;
  105. [MethodImpl(MethodImplOptions.InternalCall)]
  106. private static extern void Internal_setIsTrigger(IntPtr thisPtr, bool value);
  107. [MethodImpl(MethodImplOptions.InternalCall)]
  108. private static extern bool Internal_getIsTrigger(IntPtr thisPtr);
  109. [MethodImpl(MethodImplOptions.InternalCall)]
  110. private static extern void Internal_setMass(IntPtr thisPtr, float mass);
  111. [MethodImpl(MethodImplOptions.InternalCall)]
  112. private static extern float Internal_getMass(IntPtr thisPtr);
  113. [MethodImpl(MethodImplOptions.InternalCall)]
  114. private static extern void Internal_setMaterial(IntPtr thisPtr, RRef<PhysicsMaterial> material);
  115. [MethodImpl(MethodImplOptions.InternalCall)]
  116. private static extern RRef<PhysicsMaterial> Internal_getMaterial(IntPtr thisPtr);
  117. [MethodImpl(MethodImplOptions.InternalCall)]
  118. private static extern void Internal_setContactOffset(IntPtr thisPtr, float value);
  119. [MethodImpl(MethodImplOptions.InternalCall)]
  120. private static extern float Internal_getContactOffset(IntPtr thisPtr);
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern void Internal_setRestOffset(IntPtr thisPtr, float value);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern float Internal_getRestOffset(IntPtr thisPtr);
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern void Internal_setLayer(IntPtr thisPtr, ulong layer);
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern ulong Internal_getLayer(IntPtr thisPtr);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern void Internal_setCollisionReportMode(IntPtr thisPtr, CollisionReportMode mode);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern CollisionReportMode Internal_getCollisionReportMode(IntPtr thisPtr);
  133. private void Internal_onCollisionBegin(ref CollisionData p0)
  134. {
  135. OnCollisionBegin?.Invoke(p0);
  136. }
  137. private void Internal_onCollisionStay(ref CollisionData p0)
  138. {
  139. OnCollisionStay?.Invoke(p0);
  140. }
  141. private void Internal_onCollisionEnd(ref CollisionData p0)
  142. {
  143. OnCollisionEnd?.Invoke(p0);
  144. }
  145. }
  146. /** @} */
  147. }