CollisionObject.xml 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="CollisionObject" inherits="Spatial" category="Core" version="3.1">
  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. <demos>
  12. </demos>
  13. <methods>
  14. <method name="_input_event" qualifiers="virtual">
  15. <return type="void">
  16. </return>
  17. <argument index="0" name="camera" type="Object">
  18. </argument>
  19. <argument index="1" name="event" type="InputEvent">
  20. </argument>
  21. <argument index="2" name="click_position" type="Vector3">
  22. </argument>
  23. <argument index="3" name="click_normal" type="Vector3">
  24. </argument>
  25. <argument index="4" name="shape_idx" type="int">
  26. </argument>
  27. <description>
  28. 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.
  29. </description>
  30. </method>
  31. <method name="create_shape_owner">
  32. <return type="int">
  33. </return>
  34. <argument index="0" name="owner" type="Object">
  35. </argument>
  36. <description>
  37. Creates a new shape owner for the given object. Returns [code]owner_id[/code] of the new owner for future reference.
  38. </description>
  39. </method>
  40. <method name="get_rid" qualifiers="const">
  41. <return type="RID">
  42. </return>
  43. <description>
  44. Returns the object's [RID].
  45. </description>
  46. </method>
  47. <method name="get_shape_owners">
  48. <return type="Array">
  49. </return>
  50. <description>
  51. 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.
  52. </description>
  53. </method>
  54. <method name="is_shape_owner_disabled" qualifiers="const">
  55. <return type="bool">
  56. </return>
  57. <argument index="0" name="owner_id" type="int">
  58. </argument>
  59. <description>
  60. If [code]true[/code], the shape owner and its shapes are disabled.
  61. </description>
  62. </method>
  63. <method name="remove_shape_owner">
  64. <return type="void">
  65. </return>
  66. <argument index="0" name="owner_id" type="int">
  67. </argument>
  68. <description>
  69. Removes the given shape owner.
  70. </description>
  71. </method>
  72. <method name="shape_find_owner" qualifiers="const">
  73. <return type="int">
  74. </return>
  75. <argument index="0" name="shape_index" type="int">
  76. </argument>
  77. <description>
  78. Returns the [code]owner_id[/code] of the given shape.
  79. </description>
  80. </method>
  81. <method name="shape_owner_add_shape">
  82. <return type="void">
  83. </return>
  84. <argument index="0" name="owner_id" type="int">
  85. </argument>
  86. <argument index="1" name="shape" type="Shape">
  87. </argument>
  88. <description>
  89. Adds a [Shape] to the shape owner.
  90. </description>
  91. </method>
  92. <method name="shape_owner_clear_shapes">
  93. <return type="void">
  94. </return>
  95. <argument index="0" name="owner_id" type="int">
  96. </argument>
  97. <description>
  98. Removes all shapes from the shape owner.
  99. </description>
  100. </method>
  101. <method name="shape_owner_get_owner" qualifiers="const">
  102. <return type="Object">
  103. </return>
  104. <argument index="0" name="owner_id" type="int">
  105. </argument>
  106. <description>
  107. Returns the parent object of the given shape owner.
  108. </description>
  109. </method>
  110. <method name="shape_owner_get_shape" qualifiers="const">
  111. <return type="Shape">
  112. </return>
  113. <argument index="0" name="owner_id" type="int">
  114. </argument>
  115. <argument index="1" name="shape_id" type="int">
  116. </argument>
  117. <description>
  118. Returns the [Shape] with the given id from the given shape owner.
  119. </description>
  120. </method>
  121. <method name="shape_owner_get_shape_count" qualifiers="const">
  122. <return type="int">
  123. </return>
  124. <argument index="0" name="owner_id" type="int">
  125. </argument>
  126. <description>
  127. Returns the number of shapes the given shape owner contains.
  128. </description>
  129. </method>
  130. <method name="shape_owner_get_shape_index" qualifiers="const">
  131. <return type="int">
  132. </return>
  133. <argument index="0" name="owner_id" type="int">
  134. </argument>
  135. <argument index="1" name="shape_id" type="int">
  136. </argument>
  137. <description>
  138. Returns the child index of the [Shape] with the given id from the given shape owner.
  139. </description>
  140. </method>
  141. <method name="shape_owner_get_transform" qualifiers="const">
  142. <return type="Transform">
  143. </return>
  144. <argument index="0" name="owner_id" type="int">
  145. </argument>
  146. <description>
  147. Returns the shape owner's [Transform].
  148. </description>
  149. </method>
  150. <method name="shape_owner_remove_shape">
  151. <return type="void">
  152. </return>
  153. <argument index="0" name="owner_id" type="int">
  154. </argument>
  155. <argument index="1" name="shape_id" type="int">
  156. </argument>
  157. <description>
  158. Removes a shape from the given shape owner.
  159. </description>
  160. </method>
  161. <method name="shape_owner_set_disabled">
  162. <return type="void">
  163. </return>
  164. <argument index="0" name="owner_id" type="int">
  165. </argument>
  166. <argument index="1" name="disabled" type="bool">
  167. </argument>
  168. <description>
  169. If [code]true[/code], disables the given shape owner.
  170. </description>
  171. </method>
  172. <method name="shape_owner_set_transform">
  173. <return type="void">
  174. </return>
  175. <argument index="0" name="owner_id" type="int">
  176. </argument>
  177. <argument index="1" name="transform" type="Transform">
  178. </argument>
  179. <description>
  180. Sets the [Transform] of the given shape owner.
  181. </description>
  182. </method>
  183. </methods>
  184. <members>
  185. <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag">
  186. If [code]true[/code], the [code]CollisionObject[/code] will continue to receive input events as the mouse is dragged across its shapes. Default value: [code]false[/code].
  187. </member>
  188. <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable">
  189. If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s. Default value: [code]true[/code].
  190. </member>
  191. </members>
  192. <signals>
  193. <signal name="input_event">
  194. <argument index="0" name="camera" type="Node">
  195. </argument>
  196. <argument index="1" name="event" type="InputEvent">
  197. </argument>
  198. <argument index="2" name="click_position" type="Vector3">
  199. </argument>
  200. <argument index="3" name="click_normal" type="Vector3">
  201. </argument>
  202. <argument index="4" name="shape_idx" type="int">
  203. </argument>
  204. <description>
  205. Emitted when [method _input_event] receives an event. See its description for details.
  206. </description>
  207. </signal>
  208. <signal name="mouse_entered">
  209. <description>
  210. Emitted when the mouse pointer enters any of this object's shapes.
  211. </description>
  212. </signal>
  213. <signal name="mouse_exited">
  214. <description>
  215. Emitted when the mouse pointer exits all this object's shapes.
  216. </description>
  217. </signal>
  218. </signals>
  219. <constants>
  220. </constants>
  221. </class>