CollisionObject.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="CollisionObject" inherits="Spatial" version="3.3">
  3. <brief_description>
  4. Base node for collision objects.
  5. </brief_description>
  6. <description>
  7. CollisionObject is the base class for physics objects. It can hold any number of collision [Shape]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject can have any number of shape owners. Shape owners are not nodes and do not appear in the editor, but are accessible through code using the [code]shape_owner_*[/code] methods.
  8. </description>
  9. <tutorials>
  10. </tutorials>
  11. <methods>
  12. <method name="_input_event" qualifiers="virtual">
  13. <return type="void" />
  14. <argument index="0" name="camera" type="Object" />
  15. <argument index="1" name="event" type="InputEvent" />
  16. <argument index="2" name="click_position" type="Vector3" />
  17. <argument index="3" name="click_normal" type="Vector3" />
  18. <argument index="4" name="shape_idx" type="int" />
  19. <description>
  20. Accepts unhandled [InputEvent]s. [code]click_position[/code] is the clicked location in world space and [code]click_normal[/code] is the normal vector extending from the clicked surface of the [Shape] at [code]shape_idx[/code]. Connect to the [code]input_event[/code] signal to easily pick up these events.
  21. </description>
  22. </method>
  23. <method name="create_shape_owner">
  24. <return type="int" />
  25. <argument index="0" name="owner" type="Object" />
  26. <description>
  27. Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
  28. </description>
  29. </method>
  30. <method name="get_rid" qualifiers="const">
  31. <return type="RID" />
  32. <description>
  33. Returns the object's [RID].
  34. </description>
  35. </method>
  36. <method name="get_shape_owners">
  37. <return type="Array" />
  38. <description>
  39. Returns an [Array] of [code]owner_id[/code] identifiers. You can use these ids in other methods that take [code]owner_id[/code] as an argument.
  40. </description>
  41. </method>
  42. <method name="is_shape_owner_disabled" qualifiers="const">
  43. <return type="bool" />
  44. <argument index="0" name="owner_id" type="int" />
  45. <description>
  46. If [code]true[/code], the shape owner and its shapes are disabled.
  47. </description>
  48. </method>
  49. <method name="remove_shape_owner">
  50. <return type="void" />
  51. <argument index="0" name="owner_id" type="int" />
  52. <description>
  53. Removes the given shape owner.
  54. </description>
  55. </method>
  56. <method name="shape_find_owner" qualifiers="const">
  57. <return type="int" />
  58. <argument index="0" name="shape_index" type="int" />
  59. <description>
  60. Returns the [code]owner_id[/code] of the given shape.
  61. </description>
  62. </method>
  63. <method name="shape_owner_add_shape">
  64. <return type="void" />
  65. <argument index="0" name="owner_id" type="int" />
  66. <argument index="1" name="shape" type="Shape" />
  67. <description>
  68. Adds a [Shape] to the shape owner.
  69. </description>
  70. </method>
  71. <method name="shape_owner_clear_shapes">
  72. <return type="void" />
  73. <argument index="0" name="owner_id" type="int" />
  74. <description>
  75. Removes all shapes from the shape owner.
  76. </description>
  77. </method>
  78. <method name="shape_owner_get_owner" qualifiers="const">
  79. <return type="Object" />
  80. <argument index="0" name="owner_id" type="int" />
  81. <description>
  82. Returns the parent object of the given shape owner.
  83. </description>
  84. </method>
  85. <method name="shape_owner_get_shape" qualifiers="const">
  86. <return type="Shape" />
  87. <argument index="0" name="owner_id" type="int" />
  88. <argument index="1" name="shape_id" type="int" />
  89. <description>
  90. Returns the [Shape] with the given id from the given shape owner.
  91. </description>
  92. </method>
  93. <method name="shape_owner_get_shape_count" qualifiers="const">
  94. <return type="int" />
  95. <argument index="0" name="owner_id" type="int" />
  96. <description>
  97. Returns the number of shapes the given shape owner contains.
  98. </description>
  99. </method>
  100. <method name="shape_owner_get_shape_index" qualifiers="const">
  101. <return type="int" />
  102. <argument index="0" name="owner_id" type="int" />
  103. <argument index="1" name="shape_id" type="int" />
  104. <description>
  105. Returns the child index of the [Shape] with the given id from the given shape owner.
  106. </description>
  107. </method>
  108. <method name="shape_owner_get_transform" qualifiers="const">
  109. <return type="Transform" />
  110. <argument index="0" name="owner_id" type="int" />
  111. <description>
  112. Returns the shape owner's [Transform].
  113. </description>
  114. </method>
  115. <method name="shape_owner_remove_shape">
  116. <return type="void" />
  117. <argument index="0" name="owner_id" type="int" />
  118. <argument index="1" name="shape_id" type="int" />
  119. <description>
  120. Removes a shape from the given shape owner.
  121. </description>
  122. </method>
  123. <method name="shape_owner_set_disabled">
  124. <return type="void" />
  125. <argument index="0" name="owner_id" type="int" />
  126. <argument index="1" name="disabled" type="bool" />
  127. <description>
  128. If [code]true[/code], disables the given shape owner.
  129. </description>
  130. </method>
  131. <method name="shape_owner_set_transform">
  132. <return type="void" />
  133. <argument index="0" name="owner_id" type="int" />
  134. <argument index="1" name="transform" type="Transform" />
  135. <description>
  136. Sets the [Transform] of the given shape owner.
  137. </description>
  138. </method>
  139. </methods>
  140. <members>
  141. <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
  142. If [code]true[/code], the [CollisionObject] will continue to receive input events as the mouse is dragged across its shapes.
  143. </member>
  144. <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
  145. If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s.
  146. </member>
  147. </members>
  148. <signals>
  149. <signal name="input_event">
  150. <argument index="0" name="camera" type="Node" />
  151. <argument index="1" name="event" type="InputEvent" />
  152. <argument index="2" name="click_position" type="Vector3" />
  153. <argument index="3" name="click_normal" type="Vector3" />
  154. <argument index="4" name="shape_idx" type="int" />
  155. <description>
  156. Emitted when [method _input_event] receives an event. See its description for details.
  157. </description>
  158. </signal>
  159. <signal name="mouse_entered">
  160. <description>
  161. Emitted when the mouse pointer enters any of this object's shapes.
  162. </description>
  163. </signal>
  164. <signal name="mouse_exited">
  165. <description>
  166. Emitted when the mouse pointer exits all this object's shapes.
  167. </description>
  168. </signal>
  169. </signals>
  170. <constants>
  171. </constants>
  172. </class>