class_raycast2d.rst 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_RayCast2D:
  4. RayCast2D
  5. =========
  6. **Inherits:** :ref:`Node2D<class_node2d>` **<** :ref:`CanvasItem<class_canvasitem>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Category:** Core
  8. Brief Description
  9. -----------------
  10. Query the closest object intersecting a ray
  11. Member Functions
  12. ----------------
  13. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  14. | void | :ref:`set_enabled<class_RayCast2D_set_enabled>` **(** :ref:`bool<class_bool>` enabled **)** |
  15. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  16. | :ref:`bool<class_bool>` | :ref:`is_enabled<class_RayCast2D_is_enabled>` **(** **)** const |
  17. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  18. | void | :ref:`set_cast_to<class_RayCast2D_set_cast_to>` **(** :ref:`Vector2<class_vector2>` local_point **)** |
  19. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  20. | :ref:`Vector2<class_vector2>` | :ref:`get_cast_to<class_RayCast2D_get_cast_to>` **(** **)** const |
  21. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  22. | :ref:`bool<class_bool>` | :ref:`is_colliding<class_RayCast2D_is_colliding>` **(** **)** const |
  23. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  24. | :ref:`Object<class_object>` | :ref:`get_collider<class_RayCast2D_get_collider>` **(** **)** const |
  25. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`get_collider_shape<class_RayCast2D_get_collider_shape>` **(** **)** const |
  27. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  28. | :ref:`Vector2<class_vector2>` | :ref:`get_collision_point<class_RayCast2D_get_collision_point>` **(** **)** const |
  29. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  30. | :ref:`Vector2<class_vector2>` | :ref:`get_collision_normal<class_RayCast2D_get_collision_normal>` **(** **)** const |
  31. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  32. | void | :ref:`add_exception_rid<class_RayCast2D_add_exception_rid>` **(** :ref:`RID<class_rid>` rid **)** |
  33. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  34. | void | :ref:`add_exception<class_RayCast2D_add_exception>` **(** :ref:`Object<class_object>` node **)** |
  35. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  36. | void | :ref:`remove_exception_rid<class_RayCast2D_remove_exception_rid>` **(** :ref:`RID<class_rid>` rid **)** |
  37. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  38. | void | :ref:`remove_exception<class_RayCast2D_remove_exception>` **(** :ref:`Object<class_object>` node **)** |
  39. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`clear_exceptions<class_RayCast2D_clear_exceptions>` **(** **)** |
  41. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`set_layer_mask<class_RayCast2D_set_layer_mask>` **(** :ref:`int<class_int>` mask **)** |
  43. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`get_layer_mask<class_RayCast2D_get_layer_mask>` **(** **)** const |
  45. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_type_mask<class_RayCast2D_set_type_mask>` **(** :ref:`int<class_int>` mask **)** |
  47. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_type_mask<class_RayCast2D_get_type_mask>` **(** **)** const |
  49. +--------------------------------+-----------------------------------------------------------------------------------------------------------+
  50. Description
  51. -----------
  52. A RayCast2D represents a line from its origin to its destination position ``cast_to``, it is used to query the 2D space in order to find the closest object intersecting with the ray.
  53. Member Function Description
  54. ---------------------------
  55. .. _class_RayCast2D_set_enabled:
  56. - void **set_enabled** **(** :ref:`bool<class_bool>` enabled **)**
  57. Enables the RayCast2D. Only enabled raycasts will be able to query the space and report collisions.
  58. .. _class_RayCast2D_is_enabled:
  59. - :ref:`bool<class_bool>` **is_enabled** **(** **)** const
  60. Returns whether this raycast is enabled or not
  61. .. _class_RayCast2D_set_cast_to:
  62. - void **set_cast_to** **(** :ref:`Vector2<class_vector2>` local_point **)**
  63. Sets the ray destination point, so that the ray will test from the ray's origin to ``local_point``
  64. .. _class_RayCast2D_get_cast_to:
  65. - :ref:`Vector2<class_vector2>` **get_cast_to** **(** **)** const
  66. Return the destination point of this ray object
  67. .. _class_RayCast2D_is_colliding:
  68. - :ref:`bool<class_bool>` **is_colliding** **(** **)** const
  69. Return whether the closest object the ray is pointing to is colliding with the vector (considering the vector length).
  70. .. _class_RayCast2D_get_collider:
  71. - :ref:`Object<class_object>` **get_collider** **(** **)** const
  72. Return the closest object the ray is pointing to. Note that this does not consider the length of the vector, so you must also use :ref:`is_colliding<class_RayCast2D_is_colliding>` to check if the object returned is actually colliding with the ray.
  73. .. _class_RayCast2D_get_collider_shape:
  74. - :ref:`int<class_int>` **get_collider_shape** **(** **)** const
  75. Returns the collision shape of the closest object the ray is pointing to.
  76. .. _class_RayCast2D_get_collision_point:
  77. - :ref:`Vector2<class_vector2>` **get_collision_point** **(** **)** const
  78. Returns the collision point in which the ray intersects the closest object.
  79. .. _class_RayCast2D_get_collision_normal:
  80. - :ref:`Vector2<class_vector2>` **get_collision_normal** **(** **)** const
  81. Returns the normal of the intersecting object shape face containing the collision point.
  82. .. _class_RayCast2D_add_exception_rid:
  83. - void **add_exception_rid** **(** :ref:`RID<class_rid>` rid **)**
  84. .. _class_RayCast2D_add_exception:
  85. - void **add_exception** **(** :ref:`Object<class_object>` node **)**
  86. Adds a collision exception so the ray does not report collisions with the specified ``node``.
  87. .. _class_RayCast2D_remove_exception_rid:
  88. - void **remove_exception_rid** **(** :ref:`RID<class_rid>` rid **)**
  89. .. _class_RayCast2D_remove_exception:
  90. - void **remove_exception** **(** :ref:`Object<class_object>` node **)**
  91. Removes a collision exception so the ray does report collisions with the specified ``node``.
  92. .. _class_RayCast2D_clear_exceptions:
  93. - void **clear_exceptions** **(** **)**
  94. Removes all collision exception for this ray.
  95. .. _class_RayCast2D_set_layer_mask:
  96. - void **set_layer_mask** **(** :ref:`int<class_int>` mask **)**
  97. .. _class_RayCast2D_get_layer_mask:
  98. - :ref:`int<class_int>` **get_layer_mask** **(** **)** const
  99. Returns the layer mask for this ray.
  100. .. _class_RayCast2D_set_type_mask:
  101. - void **set_type_mask** **(** :ref:`int<class_int>` mask **)**
  102. .. _class_RayCast2D_get_type_mask:
  103. - :ref:`int<class_int>` **get_type_mask** **(** **)** const