class_collisionobject.rst 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the CollisionObject.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_CollisionObject:
  5. CollisionObject
  6. ===============
  7. **Inherits:** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Inherited By:** :ref:`PhysicsBody<class_physicsbody>`, :ref:`Area<class_area>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Base node for collision objects.
  13. Member Functions
  14. ----------------
  15. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  16. | void | :ref:`_input_event<class_CollisionObject__input_event>` **(** :ref:`Object<class_object>` camera, :ref:`InputEvent<class_inputevent>` event, :ref:`Vector3<class_vector3>` click_position, :ref:`Vector3<class_vector3>` click_normal, :ref:`int<class_int>` shape_idx **)** virtual |
  17. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  18. | :ref:`int<class_int>` | :ref:`create_shape_owner<class_CollisionObject_create_shape_owner>` **(** :ref:`Object<class_object>` owner **)** |
  19. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | :ref:`bool<class_bool>` | :ref:`get_capture_input_on_drag<class_CollisionObject_get_capture_input_on_drag>` **(** **)** const |
  21. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`RID<class_rid>` | :ref:`get_rid<class_CollisionObject_get_rid>` **(** **)** const |
  23. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Array<class_array>` | :ref:`get_shape_owners<class_CollisionObject_get_shape_owners>` **(** **)** |
  25. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | :ref:`bool<class_bool>` | :ref:`is_ray_pickable<class_CollisionObject_is_ray_pickable>` **(** **)** const |
  27. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`is_shape_owner_disabled<class_CollisionObject_is_shape_owner_disabled>` **(** :ref:`int<class_int>` owner_id **)** const |
  29. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`remove_shape_owner<class_CollisionObject_remove_shape_owner>` **(** :ref:`int<class_int>` owner_id **)** |
  31. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`set_capture_input_on_drag<class_CollisionObject_set_capture_input_on_drag>` **(** :ref:`bool<class_bool>` enable **)** |
  33. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`set_ray_pickable<class_CollisionObject_set_ray_pickable>` **(** :ref:`bool<class_bool>` ray_pickable **)** |
  35. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`shape_find_owner<class_CollisionObject_shape_find_owner>` **(** :ref:`int<class_int>` shape_index **)** const |
  37. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`shape_owner_add_shape<class_CollisionObject_shape_owner_add_shape>` **(** :ref:`int<class_int>` owner_id, :ref:`Shape<class_shape>` shape **)** |
  39. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`shape_owner_clear_shapes<class_CollisionObject_shape_owner_clear_shapes>` **(** :ref:`int<class_int>` owner_id **)** |
  41. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Object<class_object>` | :ref:`shape_owner_get_owner<class_CollisionObject_shape_owner_get_owner>` **(** :ref:`int<class_int>` owner_id **)** const |
  43. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Shape<class_shape>` | :ref:`shape_owner_get_shape<class_CollisionObject_shape_owner_get_shape>` **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const |
  45. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`shape_owner_get_shape_count<class_CollisionObject_shape_owner_get_shape_count>` **(** :ref:`int<class_int>` owner_id **)** const |
  47. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`shape_owner_get_shape_index<class_CollisionObject_shape_owner_get_shape_index>` **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const |
  49. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`Transform<class_transform>` | :ref:`shape_owner_get_transform<class_CollisionObject_shape_owner_get_transform>` **(** :ref:`int<class_int>` owner_id **)** const |
  51. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`shape_owner_remove_shape<class_CollisionObject_shape_owner_remove_shape>` **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** |
  53. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | void | :ref:`shape_owner_set_disabled<class_CollisionObject_shape_owner_set_disabled>` **(** :ref:`int<class_int>` owner_id, :ref:`bool<class_bool>` disabled **)** |
  55. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | void | :ref:`shape_owner_set_transform<class_CollisionObject_shape_owner_set_transform>` **(** :ref:`int<class_int>` owner_id, :ref:`Transform<class_transform>` transform **)** |
  57. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. Signals
  59. -------
  60. .. _class_CollisionObject_input_event:
  61. - **input_event** **(** :ref:`Object<class_object>` camera, :ref:`Object<class_object>` event, :ref:`Vector3<class_vector3>` click_position, :ref:`Vector3<class_vector3>` click_normal, :ref:`int<class_int>` shape_idx **)**
  62. .. _class_CollisionObject_mouse_entered:
  63. - **mouse_entered** **(** **)**
  64. Emitted when the mouse pointer enters any of this object's shapes.
  65. .. _class_CollisionObject_mouse_exited:
  66. - **mouse_exited** **(** **)**
  67. Emitted when the mouse pointer exits all this object's shapes.
  68. Member Variables
  69. ----------------
  70. .. _class_CollisionObject_input_capture_on_drag:
  71. - :ref:`bool<class_bool>` **input_capture_on_drag**
  72. .. _class_CollisionObject_input_ray_pickable:
  73. - :ref:`bool<class_bool>` **input_ray_pickable**
  74. Description
  75. -----------
  76. CollisionObject is the base class for physics objects. It can hold any number of collision :ref:`Shape<class_shape>`\ s. Each shape must be assigned to a *shape owner*. 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 ``shape_owner\_\*`` methods.
  77. Member Function Description
  78. ---------------------------
  79. .. _class_CollisionObject__input_event:
  80. - void **_input_event** **(** :ref:`Object<class_object>` camera, :ref:`InputEvent<class_inputevent>` event, :ref:`Vector3<class_vector3>` click_position, :ref:`Vector3<class_vector3>` click_normal, :ref:`int<class_int>` shape_idx **)** virtual
  81. .. _class_CollisionObject_create_shape_owner:
  82. - :ref:`int<class_int>` **create_shape_owner** **(** :ref:`Object<class_object>` owner **)**
  83. Creates a new shape owner for the given object. Returns ``owner_id`` of the new owner for future reference.
  84. .. _class_CollisionObject_get_capture_input_on_drag:
  85. - :ref:`bool<class_bool>` **get_capture_input_on_drag** **(** **)** const
  86. .. _class_CollisionObject_get_rid:
  87. - :ref:`RID<class_rid>` **get_rid** **(** **)** const
  88. Returns the object's :ref:`RID<class_rid>`.
  89. .. _class_CollisionObject_get_shape_owners:
  90. - :ref:`Array<class_array>` **get_shape_owners** **(** **)**
  91. Returns an :ref:`Array<class_array>` of ``owner_id`` identifiers. You can use these ids in other methods that take ``owner_id`` as an argument.
  92. .. _class_CollisionObject_is_ray_pickable:
  93. - :ref:`bool<class_bool>` **is_ray_pickable** **(** **)** const
  94. .. _class_CollisionObject_is_shape_owner_disabled:
  95. - :ref:`bool<class_bool>` **is_shape_owner_disabled** **(** :ref:`int<class_int>` owner_id **)** const
  96. If ``true`` the shape owner and its shapes are disabled.
  97. .. _class_CollisionObject_remove_shape_owner:
  98. - void **remove_shape_owner** **(** :ref:`int<class_int>` owner_id **)**
  99. Removes the given shape owner.
  100. .. _class_CollisionObject_set_capture_input_on_drag:
  101. - void **set_capture_input_on_drag** **(** :ref:`bool<class_bool>` enable **)**
  102. .. _class_CollisionObject_set_ray_pickable:
  103. - void **set_ray_pickable** **(** :ref:`bool<class_bool>` ray_pickable **)**
  104. .. _class_CollisionObject_shape_find_owner:
  105. - :ref:`int<class_int>` **shape_find_owner** **(** :ref:`int<class_int>` shape_index **)** const
  106. Returns the ``owner_id`` of the given shape.
  107. .. _class_CollisionObject_shape_owner_add_shape:
  108. - void **shape_owner_add_shape** **(** :ref:`int<class_int>` owner_id, :ref:`Shape<class_shape>` shape **)**
  109. Adds a :ref:`Shape<class_shape>` to the shape owner.
  110. .. _class_CollisionObject_shape_owner_clear_shapes:
  111. - void **shape_owner_clear_shapes** **(** :ref:`int<class_int>` owner_id **)**
  112. Removes all shapes from the shape owner.
  113. .. _class_CollisionObject_shape_owner_get_owner:
  114. - :ref:`Object<class_object>` **shape_owner_get_owner** **(** :ref:`int<class_int>` owner_id **)** const
  115. Returns the parent object of the given shape owner.
  116. .. _class_CollisionObject_shape_owner_get_shape:
  117. - :ref:`Shape<class_shape>` **shape_owner_get_shape** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const
  118. Returns the :ref:`Shape<class_shape>` with the given id from the given shape owner.
  119. .. _class_CollisionObject_shape_owner_get_shape_count:
  120. - :ref:`int<class_int>` **shape_owner_get_shape_count** **(** :ref:`int<class_int>` owner_id **)** const
  121. Returns the number of shapes the given shape owner contains.
  122. .. _class_CollisionObject_shape_owner_get_shape_index:
  123. - :ref:`int<class_int>` **shape_owner_get_shape_index** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const
  124. .. _class_CollisionObject_shape_owner_get_transform:
  125. - :ref:`Transform<class_transform>` **shape_owner_get_transform** **(** :ref:`int<class_int>` owner_id **)** const
  126. Returns the shape owner's :ref:`Transform<class_transform>`.
  127. .. _class_CollisionObject_shape_owner_remove_shape:
  128. - void **shape_owner_remove_shape** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)**
  129. Removes a shape from the given shape owner.
  130. .. _class_CollisionObject_shape_owner_set_disabled:
  131. - void **shape_owner_set_disabled** **(** :ref:`int<class_int>` owner_id, :ref:`bool<class_bool>` disabled **)**
  132. If ``true`` disables the given shape owner.
  133. .. _class_CollisionObject_shape_owner_set_transform:
  134. - void **shape_owner_set_transform** **(** :ref:`int<class_int>` owner_id, :ref:`Transform<class_transform>` transform **)**
  135. Sets the :ref:`Transform<class_transform>` of the given shape owner.