CCollider.generated.cs 6.4 KB

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