CCollider.generated.cs 6.2 KB

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