CollisionObject.xml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  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. <argument index="0" name="camera" type="Object" />
  15. <argument index="1" name="event" type="InputEvent" />
  16. <argument index="2" name="position" type="Vector3" />
  17. <argument index="3" name="normal" type="Vector3" />
  18. <argument index="4" name="shape_idx" type="int" />
  19. <description>
  20. 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.
  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_collision_layer_bit" qualifiers="const">
  31. <return type="bool" />
  32. <argument index="0" name="bit" type="int" />
  33. <description>
  34. Returns whether or not the specified [code]bit[/code] of the [member collision_layer] is set.
  35. </description>
  36. </method>
  37. <method name="get_collision_mask_bit" qualifiers="const">
  38. <return type="bool" />
  39. <argument index="0" name="bit" type="int" />
  40. <description>
  41. Returns whether or not the specified [code]bit[/code] of the [member collision_mask] is set.
  42. </description>
  43. </method>
  44. <method name="get_rid" qualifiers="const">
  45. <return type="RID" />
  46. <description>
  47. Returns the object's [RID].
  48. </description>
  49. </method>
  50. <method name="get_shape_owners">
  51. <return type="Array" />
  52. <description>
  53. 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.
  54. </description>
  55. </method>
  56. <method name="is_shape_owner_disabled" qualifiers="const">
  57. <return type="bool" />
  58. <argument index="0" name="owner_id" type="int" />
  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. <argument index="0" name="owner_id" type="int" />
  66. <description>
  67. Removes the given shape owner.
  68. </description>
  69. </method>
  70. <method name="set_collision_layer_bit">
  71. <return type="void" />
  72. <argument index="0" name="bit" type="int" />
  73. <argument index="1" name="value" type="bool" />
  74. <description>
  75. If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_layer].
  76. If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_layer].
  77. </description>
  78. </method>
  79. <method name="set_collision_mask_bit">
  80. <return type="void" />
  81. <argument index="0" name="bit" type="int" />
  82. <argument index="1" name="value" type="bool" />
  83. <description>
  84. If [code]value[/code] is [code]true[/code], sets the specified [code]bit[/code] in the the [member collision_mask].
  85. If [code]value[/code] is [code]false[/code], clears the specified [code]bit[/code] in the the [member collision_mask].
  86. </description>
  87. </method>
  88. <method name="shape_find_owner" qualifiers="const">
  89. <return type="int" />
  90. <argument index="0" name="shape_index" type="int" />
  91. <description>
  92. Returns the [code]owner_id[/code] of the given shape.
  93. </description>
  94. </method>
  95. <method name="shape_owner_add_shape">
  96. <return type="void" />
  97. <argument index="0" name="owner_id" type="int" />
  98. <argument index="1" name="shape" type="Shape" />
  99. <description>
  100. Adds a [Shape] to the shape owner.
  101. </description>
  102. </method>
  103. <method name="shape_owner_clear_shapes">
  104. <return type="void" />
  105. <argument index="0" name="owner_id" type="int" />
  106. <description>
  107. Removes all shapes from the shape owner.
  108. </description>
  109. </method>
  110. <method name="shape_owner_get_owner" qualifiers="const">
  111. <return type="Object" />
  112. <argument index="0" name="owner_id" type="int" />
  113. <description>
  114. Returns the parent object of the given shape owner.
  115. </description>
  116. </method>
  117. <method name="shape_owner_get_shape" qualifiers="const">
  118. <return type="Shape" />
  119. <argument index="0" name="owner_id" type="int" />
  120. <argument index="1" name="shape_id" type="int" />
  121. <description>
  122. Returns the [Shape] with the given id from the given shape owner.
  123. </description>
  124. </method>
  125. <method name="shape_owner_get_shape_count" qualifiers="const">
  126. <return type="int" />
  127. <argument index="0" name="owner_id" type="int" />
  128. <description>
  129. Returns the number of shapes the given shape owner contains.
  130. </description>
  131. </method>
  132. <method name="shape_owner_get_shape_index" qualifiers="const">
  133. <return type="int" />
  134. <argument index="0" name="owner_id" type="int" />
  135. <argument index="1" name="shape_id" type="int" />
  136. <description>
  137. Returns the child index of the [Shape] with the given id from the given shape owner.
  138. </description>
  139. </method>
  140. <method name="shape_owner_get_transform" qualifiers="const">
  141. <return type="Transform" />
  142. <argument index="0" name="owner_id" type="int" />
  143. <description>
  144. Returns the shape owner's [Transform].
  145. </description>
  146. </method>
  147. <method name="shape_owner_remove_shape">
  148. <return type="void" />
  149. <argument index="0" name="owner_id" type="int" />
  150. <argument index="1" name="shape_id" type="int" />
  151. <description>
  152. Removes a shape from the given shape owner.
  153. </description>
  154. </method>
  155. <method name="shape_owner_set_disabled">
  156. <return type="void" />
  157. <argument index="0" name="owner_id" type="int" />
  158. <argument index="1" name="disabled" type="bool" />
  159. <description>
  160. If [code]true[/code], disables the given shape owner.
  161. </description>
  162. </method>
  163. <method name="shape_owner_set_transform">
  164. <return type="void" />
  165. <argument index="0" name="owner_id" type="int" />
  166. <argument index="1" name="transform" type="Transform" />
  167. <description>
  168. Sets the [Transform] of the given shape owner.
  169. </description>
  170. </method>
  171. </methods>
  172. <members>
  173. <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1">
  174. The physics layers this CollisionObject3D is in. Collision objects can exist in one or more of 32 different layers. See also [member collision_mask].
  175. [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.
  176. </member>
  177. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
  178. The physics layers this CollisionObject3D scans. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
  179. [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.
  180. </member>
  181. <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
  182. If [code]true[/code], the [CollisionObject] will continue to receive input events as the mouse is dragged across its shapes.
  183. </member>
  184. <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
  185. If [code]true[/code], the [CollisionObject]'s shapes will respond to [RayCast]s.
  186. </member>
  187. </members>
  188. <signals>
  189. <signal name="input_event">
  190. <argument index="0" name="camera" type="Node" />
  191. <argument index="1" name="event" type="InputEvent" />
  192. <argument index="2" name="position" type="Vector3" />
  193. <argument index="3" name="normal" type="Vector3" />
  194. <argument index="4" name="shape_idx" type="int" />
  195. <description>
  196. 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.
  197. </description>
  198. </signal>
  199. <signal name="mouse_entered">
  200. <description>
  201. Emitted when the mouse pointer enters any of this object's shapes.
  202. </description>
  203. </signal>
  204. <signal name="mouse_exited">
  205. <description>
  206. Emitted when the mouse pointer exits all this object's shapes.
  207. </description>
  208. </signal>
  209. </signals>
  210. <constants>
  211. </constants>
  212. </class>