class_collisionobject.rst 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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:`RID<class_rid>` | :ref:`get_rid<class_CollisionObject_get_rid>` **(** **)** const |
  21. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`Array<class_array>` | :ref:`get_shape_owners<class_CollisionObject_get_shape_owners>` **(** **)** |
  23. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`is_shape_owner_disabled<class_CollisionObject_is_shape_owner_disabled>` **(** :ref:`int<class_int>` owner_id **)** const |
  25. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`remove_shape_owner<class_CollisionObject_remove_shape_owner>` **(** :ref:`int<class_int>` owner_id **)** |
  27. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`int<class_int>` | :ref:`shape_find_owner<class_CollisionObject_shape_find_owner>` **(** :ref:`int<class_int>` shape_index **)** const |
  29. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | void | :ref:`shape_owner_add_shape<class_CollisionObject_shape_owner_add_shape>` **(** :ref:`int<class_int>` owner_id, :ref:`Shape<class_shape>` shape **)** |
  31. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`shape_owner_clear_shapes<class_CollisionObject_shape_owner_clear_shapes>` **(** :ref:`int<class_int>` owner_id **)** |
  33. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Object<class_object>` | :ref:`shape_owner_get_owner<class_CollisionObject_shape_owner_get_owner>` **(** :ref:`int<class_int>` owner_id **)** const |
  35. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :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 |
  37. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`shape_owner_get_shape_count<class_CollisionObject_shape_owner_get_shape_count>` **(** :ref:`int<class_int>` owner_id **)** const |
  39. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :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 |
  41. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Transform<class_transform>` | :ref:`shape_owner_get_transform<class_CollisionObject_shape_owner_get_transform>` **(** :ref:`int<class_int>` owner_id **)** const |
  43. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`shape_owner_remove_shape<class_CollisionObject_shape_owner_remove_shape>` **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** |
  45. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`shape_owner_set_disabled<class_CollisionObject_shape_owner_set_disabled>` **(** :ref:`int<class_int>` owner_id, :ref:`bool<class_bool>` disabled **)** |
  47. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`shape_owner_set_transform<class_CollisionObject_shape_owner_set_transform>` **(** :ref:`int<class_int>` owner_id, :ref:`Transform<class_transform>` transform **)** |
  49. +------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. Signals
  51. -------
  52. .. _class_CollisionObject_input_event:
  53. - **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 **)**
  54. Emitted when :ref:`_input_event<class_CollisionObject__input_event>` receives an event. See its description for details.
  55. .. _class_CollisionObject_mouse_entered:
  56. - **mouse_entered** **(** **)**
  57. Emitted when the mouse pointer enters any of this object's shapes.
  58. .. _class_CollisionObject_mouse_exited:
  59. - **mouse_exited** **(** **)**
  60. Emitted when the mouse pointer exits all this object's shapes.
  61. Member Variables
  62. ----------------
  63. .. _class_CollisionObject_input_capture_on_drag:
  64. - :ref:`bool<class_bool>` **input_capture_on_drag** - If ``true`` the ``CollisionObject`` will continue to receive input events as the mouse is dragged across its shapes. Default value: ``false``.
  65. .. _class_CollisionObject_input_ray_pickable:
  66. - :ref:`bool<class_bool>` **input_ray_pickable** - If ``true`` the :ref:`CollisionObject<class_collisionobject>`'s shapes will respond to :ref:`RayCast<class_raycast>`\ s. Default value: ``true``.
  67. Description
  68. -----------
  69. 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.
  70. Member Function Description
  71. ---------------------------
  72. .. _class_CollisionObject__input_event:
  73. - 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
  74. Accepts unhandled :ref:`InputEvent<class_inputevent>`\ s. ``click_position`` is the clicked location in world space and ``click_normal`` is the normal vector extending from the clicked surface of the :ref:`Shape<class_shape>` at ``shape_idx``. Connect to the ``input_event`` signal to easily pick up these events.
  75. .. _class_CollisionObject_create_shape_owner:
  76. - :ref:`int<class_int>` **create_shape_owner** **(** :ref:`Object<class_object>` owner **)**
  77. Creates a new shape owner for the given object. Returns ``owner_id`` of the new owner for future reference.
  78. .. _class_CollisionObject_get_rid:
  79. - :ref:`RID<class_rid>` **get_rid** **(** **)** const
  80. Returns the object's :ref:`RID<class_rid>`.
  81. .. _class_CollisionObject_get_shape_owners:
  82. - :ref:`Array<class_array>` **get_shape_owners** **(** **)**
  83. 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.
  84. .. _class_CollisionObject_is_shape_owner_disabled:
  85. - :ref:`bool<class_bool>` **is_shape_owner_disabled** **(** :ref:`int<class_int>` owner_id **)** const
  86. If ``true`` the shape owner and its shapes are disabled.
  87. .. _class_CollisionObject_remove_shape_owner:
  88. - void **remove_shape_owner** **(** :ref:`int<class_int>` owner_id **)**
  89. Removes the given shape owner.
  90. .. _class_CollisionObject_shape_find_owner:
  91. - :ref:`int<class_int>` **shape_find_owner** **(** :ref:`int<class_int>` shape_index **)** const
  92. Returns the ``owner_id`` of the given shape.
  93. .. _class_CollisionObject_shape_owner_add_shape:
  94. - void **shape_owner_add_shape** **(** :ref:`int<class_int>` owner_id, :ref:`Shape<class_shape>` shape **)**
  95. Adds a :ref:`Shape<class_shape>` to the shape owner.
  96. .. _class_CollisionObject_shape_owner_clear_shapes:
  97. - void **shape_owner_clear_shapes** **(** :ref:`int<class_int>` owner_id **)**
  98. Removes all shapes from the shape owner.
  99. .. _class_CollisionObject_shape_owner_get_owner:
  100. - :ref:`Object<class_object>` **shape_owner_get_owner** **(** :ref:`int<class_int>` owner_id **)** const
  101. Returns the parent object of the given shape owner.
  102. .. _class_CollisionObject_shape_owner_get_shape:
  103. - :ref:`Shape<class_shape>` **shape_owner_get_shape** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const
  104. Returns the :ref:`Shape<class_shape>` with the given id from the given shape owner.
  105. .. _class_CollisionObject_shape_owner_get_shape_count:
  106. - :ref:`int<class_int>` **shape_owner_get_shape_count** **(** :ref:`int<class_int>` owner_id **)** const
  107. Returns the number of shapes the given shape owner contains.
  108. .. _class_CollisionObject_shape_owner_get_shape_index:
  109. - :ref:`int<class_int>` **shape_owner_get_shape_index** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)** const
  110. Returns the child index of the :ref:`Shape<class_shape>` with the given id from the given shape owner.
  111. .. _class_CollisionObject_shape_owner_get_transform:
  112. - :ref:`Transform<class_transform>` **shape_owner_get_transform** **(** :ref:`int<class_int>` owner_id **)** const
  113. Returns the shape owner's :ref:`Transform<class_transform>`.
  114. .. _class_CollisionObject_shape_owner_remove_shape:
  115. - void **shape_owner_remove_shape** **(** :ref:`int<class_int>` owner_id, :ref:`int<class_int>` shape_id **)**
  116. Removes a shape from the given shape owner.
  117. .. _class_CollisionObject_shape_owner_set_disabled:
  118. - void **shape_owner_set_disabled** **(** :ref:`int<class_int>` owner_id, :ref:`bool<class_bool>` disabled **)**
  119. If ``true`` disables the given shape owner.
  120. .. _class_CollisionObject_shape_owner_set_transform:
  121. - void **shape_owner_set_transform** **(** :ref:`int<class_int>` owner_id, :ref:`Transform<class_transform>` transform **)**
  122. Sets the :ref:`Transform<class_transform>` of the given shape owner.