CollisionObject.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="CollisionObject" inherits="Spatial" version="3.4">
  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="position" type="Vector3">
  20. </argument>
  21. <argument index="3" name="normal" type="Vector3">
  22. </argument>
  23. <argument index="4" name="shape_idx" type="int">
  24. </argument>
  25. <description>
  26. Receives unhandled [InputEvent]s. [code]position[/code] is the location in world space of the mouse pointer on the surface of the shape with index [code]shape_idx[/code] and [code]normal[/code] is the normal vector of the surface at that point. Connect to the [signal input_event] 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_collision_layer_bit" qualifiers="const">
  39. <return type="bool">
  40. </return>
  41. <argument index="0" name="bit" type="int">
  42. </argument>
  43. <description>
  44. Returns whether or not the specified [code]bit[/code] of the [member collision_layer] is set.
  45. </description>
  46. </method>
  47. <method name="get_collision_mask_bit" qualifiers="const">
  48. <return type="bool">
  49. </return>
  50. <argument index="0" name="bit" type="int">
  51. </argument>
  52. <description>
  53. Returns whether or not the specified [code]bit[/code] of the [member collision_mask] is set.
  54. </description>
  55. </method>
  56. <method name="get_rid" qualifiers="const">
  57. <return type="RID">
  58. </return>
  59. <description>
  60. Returns the object's [RID].
  61. </description>
  62. </method>
  63. <method name="get_shape_owners">
  64. <return type="Array">
  65. </return>
  66. <description>
  67. 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.
  68. </description>
  69. </method>
  70. <method name="is_shape_owner_disabled" qualifiers="const">
  71. <return type="bool">
  72. </return>
  73. <argument index="0" name="owner_id" type="int">
  74. </argument>
  75. <description>
  76. If [code]true[/code], the shape owner and its shapes are disabled.
  77. </description>
  78. </method>
  79. <method name="remove_shape_owner">
  80. <return type="void">
  81. </return>
  82. <argument index="0" name="owner_id" type="int">
  83. </argument>
  84. <description>
  85. Removes the given shape owner.
  86. </description>
  87. </method>
  88. <method name="set_collision_layer_bit">
  89. <return type="void">
  90. </return>
  91. <argument index="0" name="bit" type="int">
  92. </argument>
  93. <argument index="1" name="value" type="bool">
  94. </argument>
  95. <description>
  96. If [code]value[/value] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_layer].
  97. If [code]value[/value] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_layer].
  98. </description>
  99. </method>
  100. <method name="set_collision_mask_bit">
  101. <return type="void">
  102. </return>
  103. <argument index="0" name="bit" type="int">
  104. </argument>
  105. <argument index="1" name="value" type="bool">
  106. </argument>
  107. <description>
  108. If [code]value[/value] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_mask].
  109. If [code]value[/value] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_mask].
  110. </description>
  111. </method>
  112. <method name="shape_find_owner" qualifiers="const">
  113. <return type="int">
  114. </return>
  115. <argument index="0" name="shape_index" type="int">
  116. </argument>
  117. <description>
  118. Returns the [code]owner_id[/code] of the given shape.
  119. </description>
  120. </method>
  121. <method name="shape_owner_add_shape">
  122. <return type="void">
  123. </return>
  124. <argument index="0" name="owner_id" type="int">
  125. </argument>
  126. <argument index="1" name="shape" type="Shape">
  127. </argument>
  128. <description>
  129. Adds a [Shape] to the shape owner.
  130. </description>
  131. </method>
  132. <method name="shape_owner_clear_shapes">
  133. <return type="void">
  134. </return>
  135. <argument index="0" name="owner_id" type="int">
  136. </argument>
  137. <description>
  138. Removes all shapes from the shape owner.
  139. </description>
  140. </method>
  141. <method name="shape_owner_get_owner" qualifiers="const">
  142. <return type="Object">
  143. </return>
  144. <argument index="0" name="owner_id" type="int">
  145. </argument>
  146. <description>
  147. Returns the parent object of the given shape owner.
  148. </description>
  149. </method>
  150. <method name="shape_owner_get_shape" qualifiers="const">
  151. <return type="Shape">
  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. Returns the [Shape] with the given id from the given shape owner.
  159. </description>
  160. </method>
  161. <method name="shape_owner_get_shape_count" qualifiers="const">
  162. <return type="int">
  163. </return>
  164. <argument index="0" name="owner_id" type="int">
  165. </argument>
  166. <description>
  167. Returns the number of shapes the given shape owner contains.
  168. </description>
  169. </method>
  170. <method name="shape_owner_get_shape_index" qualifiers="const">
  171. <return type="int">
  172. </return>
  173. <argument index="0" name="owner_id" type="int">
  174. </argument>
  175. <argument index="1" name="shape_id" type="int">
  176. </argument>
  177. <description>
  178. Returns the child index of the [Shape] with the given id from the given shape owner.
  179. </description>
  180. </method>
  181. <method name="shape_owner_get_transform" qualifiers="const">
  182. <return type="Transform">
  183. </return>
  184. <argument index="0" name="owner_id" type="int">
  185. </argument>
  186. <description>
  187. Returns the shape owner's [Transform].
  188. </description>
  189. </method>
  190. <method name="shape_owner_remove_shape">
  191. <return type="void">
  192. </return>
  193. <argument index="0" name="owner_id" type="int">
  194. </argument>
  195. <argument index="1" name="shape_id" type="int">
  196. </argument>
  197. <description>
  198. Removes a shape from the given shape owner.
  199. </description>
  200. </method>
  201. <method name="shape_owner_set_disabled">
  202. <return type="void">
  203. </return>
  204. <argument index="0" name="owner_id" type="int">
  205. </argument>
  206. <argument index="1" name="disabled" type="bool">
  207. </argument>
  208. <description>
  209. If [code]true[/code], disables the given shape owner.
  210. </description>
  211. </method>
  212. <method name="shape_owner_set_transform">
  213. <return type="void">
  214. </return>
  215. <argument index="0" name="owner_id" type="int">
  216. </argument>
  217. <argument index="1" name="transform" type="Transform">
  218. </argument>
  219. <description>
  220. Sets the [Transform] of the given shape owner.
  221. </description>
  222. </method>
  223. </methods>
  224. <members>
  225. <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1">
  226. The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also [member collision_mask].
  227. [b]Note:[/b] A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
  228. </member>
  229. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
  230. The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
  231. [b]Note:[/b] A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See [url=https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html#collision-layers-and-masks]Collision layers and masks[/url] in the documentation for more information.
  232. </member>
  233. <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
  234. If [code]true[/code], the [CollisionObject] will continue to receive input events as the mouse is dragged across its shapes.
  235. </member>
  236. <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
  237. If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s.
  238. </member>
  239. </members>
  240. <signals>
  241. <signal name="input_event">
  242. <argument index="0" name="camera" type="Node">
  243. </argument>
  244. <argument index="1" name="event" type="InputEvent">
  245. </argument>
  246. <argument index="2" name="position" type="Vector3">
  247. </argument>
  248. <argument index="3" name="normal" type="Vector3">
  249. </argument>
  250. <argument index="4" name="shape_idx" type="int">
  251. </argument>
  252. <description>
  253. Emitted when the object receives an unhandled [InputEvent]. [code]position[/code] is the location in world space of the mouse pointer on the surface of the shape with index [code]shape_idx[/code] and [code]normal[/code] is the normal vector of the surface at that point.
  254. </description>
  255. </signal>
  256. <signal name="mouse_entered">
  257. <description>
  258. Emitted when the mouse pointer enters any of this object's shapes.
  259. </description>
  260. </signal>
  261. <signal name="mouse_exited">
  262. <description>
  263. Emitted when the mouse pointer exits all this object's shapes.
  264. </description>
  265. </signal>
  266. </signals>
  267. <constants>
  268. </constants>
  269. </class>