CollisionObject.xml 7.2 KB

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