2
0

CollisionObject3D.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="CollisionObject3D" inherits="Node3D" version="4.0">
  3. <brief_description>
  4. Base node for collision objects.
  5. </brief_description>
  6. <description>
  7. CollisionObject3D is the base class for physics objects. It can hold any number of collision [Shape3D]s. Each shape must be assigned to a [i]shape owner[/i]. The CollisionObject3D 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="Camera3D" />
  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_value" qualifiers="const">
  31. <return type="bool" />
  32. <argument index="0" name="layer_number" type="int" />
  33. <description>
  34. Returns whether or not the specified layer of the [member collision_layer] is enabled, given a [code]layer_number[/code] between 1 and 32.
  35. </description>
  36. </method>
  37. <method name="get_collision_mask_value" qualifiers="const">
  38. <return type="bool" />
  39. <argument index="0" name="layer_number" type="int" />
  40. <description>
  41. Returns whether or not the specified layer of the [member collision_mask] is enabled, given a [code]layer_number[/code] between 1 and 32.
  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_value">
  71. <return type="void" />
  72. <argument index="0" name="layer_number" type="int" />
  73. <argument index="1" name="value" type="bool" />
  74. <description>
  75. Based on [code]value[/code], enables or disables the specified layer in the [member collision_layer], given a [code]layer_number[/code] between 1 and 32.
  76. </description>
  77. </method>
  78. <method name="set_collision_mask_value">
  79. <return type="void" />
  80. <argument index="0" name="layer_number" type="int" />
  81. <argument index="1" name="value" type="bool" />
  82. <description>
  83. Based on [code]value[/code], enables or disables the specified layer in the [member collision_mask], given a [code]layer_number[/code] between 1 and 32.
  84. </description>
  85. </method>
  86. <method name="shape_find_owner" qualifiers="const">
  87. <return type="int" />
  88. <argument index="0" name="shape_index" type="int" />
  89. <description>
  90. Returns the [code]owner_id[/code] of the given shape.
  91. </description>
  92. </method>
  93. <method name="shape_owner_add_shape">
  94. <return type="void" />
  95. <argument index="0" name="owner_id" type="int" />
  96. <argument index="1" name="shape" type="Shape3D" />
  97. <description>
  98. Adds a [Shape3D] to the shape owner.
  99. </description>
  100. </method>
  101. <method name="shape_owner_clear_shapes">
  102. <return type="void" />
  103. <argument index="0" name="owner_id" type="int" />
  104. <description>
  105. Removes all shapes from the shape owner.
  106. </description>
  107. </method>
  108. <method name="shape_owner_get_owner" qualifiers="const">
  109. <return type="Object" />
  110. <argument index="0" name="owner_id" type="int" />
  111. <description>
  112. Returns the parent object of the given shape owner.
  113. </description>
  114. </method>
  115. <method name="shape_owner_get_shape" qualifiers="const">
  116. <return type="Shape3D" />
  117. <argument index="0" name="owner_id" type="int" />
  118. <argument index="1" name="shape_id" type="int" />
  119. <description>
  120. Returns the [Shape3D] with the given id from the given shape owner.
  121. </description>
  122. </method>
  123. <method name="shape_owner_get_shape_count" qualifiers="const">
  124. <return type="int" />
  125. <argument index="0" name="owner_id" type="int" />
  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. <argument index="0" name="owner_id" type="int" />
  133. <argument index="1" name="shape_id" type="int" />
  134. <description>
  135. Returns the child index of the [Shape3D] with the given id from the given shape owner.
  136. </description>
  137. </method>
  138. <method name="shape_owner_get_transform" qualifiers="const">
  139. <return type="Transform3D" />
  140. <argument index="0" name="owner_id" type="int" />
  141. <description>
  142. Returns the shape owner's [Transform3D].
  143. </description>
  144. </method>
  145. <method name="shape_owner_remove_shape">
  146. <return type="void" />
  147. <argument index="0" name="owner_id" type="int" />
  148. <argument index="1" name="shape_id" type="int" />
  149. <description>
  150. Removes a shape from the given shape owner.
  151. </description>
  152. </method>
  153. <method name="shape_owner_set_disabled">
  154. <return type="void" />
  155. <argument index="0" name="owner_id" type="int" />
  156. <argument index="1" name="disabled" type="bool" />
  157. <description>
  158. If [code]true[/code], disables the given shape owner.
  159. </description>
  160. </method>
  161. <method name="shape_owner_set_transform">
  162. <return type="void" />
  163. <argument index="0" name="owner_id" type="int" />
  164. <argument index="1" name="transform" type="Transform3D" />
  165. <description>
  166. Sets the [Transform3D] of the given shape owner.
  167. </description>
  168. </method>
  169. </methods>
  170. <members>
  171. <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer" default="1">
  172. The physics layers this CollisionObject3D [b]is in[/b]. Collision objects can exist in one or more of 32 different layers. See also [member collision_mask].
  173. [b]Note:[/b] Object A can detect a contact with object B only if object B is in any of the 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.
  174. </member>
  175. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask" default="1">
  176. The physics layers this CollisionObject3D [b]scans[/b]. Collision objects can scan one or more of 32 different layers. See also [member collision_layer].
  177. [b]Note:[/b] Object A can detect a contact with object B only if object B is in any of the 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.
  178. </member>
  179. <member name="disable_mode" type="int" setter="set_disable_mode" getter="get_disable_mode" enum="CollisionObject3D.DisableMode" default="0">
  180. Defines the behavior in physics when [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED]. See [enum DisableMode] for more details about the different modes.
  181. </member>
  182. <member name="input_capture_on_drag" type="bool" setter="set_capture_input_on_drag" getter="get_capture_input_on_drag" default="false">
  183. If [code]true[/code], the [CollisionObject3D] will continue to receive input events as the mouse is dragged across its shapes.
  184. </member>
  185. <member name="input_ray_pickable" type="bool" setter="set_ray_pickable" getter="is_ray_pickable" default="true">
  186. If [code]true[/code], the [CollisionObject3D]'s shapes will respond to [RayCast3D]s.
  187. </member>
  188. </members>
  189. <signals>
  190. <signal name="input_event">
  191. <argument index="0" name="camera" type="Node" />
  192. <argument index="1" name="event" type="InputEvent" />
  193. <argument index="2" name="position" type="Vector3" />
  194. <argument index="3" name="normal" type="Vector3" />
  195. <argument index="4" name="shape_idx" type="int" />
  196. <description>
  197. 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.
  198. </description>
  199. </signal>
  200. <signal name="mouse_entered">
  201. <description>
  202. Emitted when the mouse pointer enters any of this object's shapes.
  203. </description>
  204. </signal>
  205. <signal name="mouse_exited">
  206. <description>
  207. Emitted when the mouse pointer exits all this object's shapes.
  208. </description>
  209. </signal>
  210. </signals>
  211. <constants>
  212. <constant name="DISABLE_MODE_REMOVE" value="0" enum="DisableMode">
  213. When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], remove from the physics simulation to stop all physics interactions with this [CollisionObject3D].
  214. Automatically re-added to the physics simulation when the [Node] is processed again.
  215. </constant>
  216. <constant name="DISABLE_MODE_MAKE_STATIC" value="1" enum="DisableMode">
  217. When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], make the body static. Doesn't affect [Area2D]. [PhysicsBody3D] can't be affected by forces or other bodies while static.
  218. Automatically set [PhysicsBody3D] back to its original mode when the [Node] is processed again.
  219. </constant>
  220. <constant name="DISABLE_MODE_KEEP_ACTIVE" value="2" enum="DisableMode">
  221. When [member Node.process_mode] is set to [constant Node.PROCESS_MODE_DISABLED], do not affect the physics simulation.
  222. </constant>
  223. </constants>
  224. </class>