Files
godot-docs-l10n/classes/es/class_camera3d.rst
2025-12-19 14:34:07 +01:00

752 lines
42 KiB
ReStructuredText

:github_url: hide
.. _class_Camera3D:
Camera3D
========
**Hereda:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
**Heredado por:** :ref:`XRCamera3D<class_XRCamera3D>`
Nodo de cámara, muestra desde un punto de vista.
.. rst-class:: classref-introduction-group
Descripción
----------------------
**Camera3D** is a special node that displays what is visible from its current location. Cameras register themselves in the nearest :ref:`Viewport<class_Viewport>` node (when ascending the tree). Only one camera can be active per viewport. If no viewport is available ascending the tree, the camera will register in the global viewport. In other words, a camera just provides 3D display capabilities to a :ref:`Viewport<class_Viewport>`, and, without one, a scene registered in that :ref:`Viewport<class_Viewport>` (or higher viewports) can't be displayed.
.. rst-class:: classref-introduction-group
Tutoriales
--------------------
- `Demo de Shooter en Tercera Persona (TPS) <https://godotengine.org/asset-library/asset/2710>`__
.. rst-class:: classref-reftable-group
Propiedades
----------------------
.. table::
:widths: auto
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`CameraAttributes<class_CameraAttributes>` | :ref:`attributes<class_Camera3D_property_attributes>` | |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`Compositor<class_Compositor>` | :ref:`compositor<class_Camera3D_property_compositor>` | |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`int<class_int>` | :ref:`cull_mask<class_Camera3D_property_cull_mask>` | ``1048575`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`bool<class_bool>` | :ref:`current<class_Camera3D_property_current>` | ``false`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` | :ref:`doppler_tracking<class_Camera3D_property_doppler_tracking>` | ``0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`Environment<class_Environment>` | :ref:`environment<class_Camera3D_property_environment>` | |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`far<class_Camera3D_property_far>` | ``4000.0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`fov<class_Camera3D_property_fov>` | ``75.0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`frustum_offset<class_Camera3D_property_frustum_offset>` | ``Vector2(0, 0)`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`h_offset<class_Camera3D_property_h_offset>` | ``0.0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`KeepAspect<enum_Camera3D_KeepAspect>` | :ref:`keep_aspect<class_Camera3D_property_keep_aspect>` | ``1`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`near<class_Camera3D_property_near>` | ``0.05`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`ProjectionType<enum_Camera3D_ProjectionType>` | :ref:`projection<class_Camera3D_property_projection>` | ``0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`size<class_Camera3D_property_size>` | ``1.0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
| :ref:`float<class_float>` | :ref:`v_offset<class_Camera3D_property_v_offset>` | ``0.0`` |
+-------------------------------------------------------+-------------------------------------------------------------------+-------------------+
.. rst-class:: classref-reftable-group
Métodos
--------------
.. table::
:widths: auto
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_current<class_Camera3D_method_clear_current>`\ (\ enable_next\: :ref:`bool<class_bool>` = true\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`get_camera_projection<class_Camera3D_method_get_camera_projection>`\ (\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_camera_rid<class_Camera3D_method_get_camera_rid>`\ (\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`get_camera_transform<class_Camera3D_method_get_camera_transform>`\ (\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`get_cull_mask_value<class_Camera3D_method_get_cull_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`Plane<class_Plane>`\] | :ref:`get_frustum<class_Camera3D_method_get_frustum>`\ (\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`RID<class_RID>` | :ref:`get_pyramid_shape_rid<class_Camera3D_method_get_pyramid_shape_rid>`\ (\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_position_behind<class_Camera3D_method_is_position_behind>`\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_position_in_frustum<class_Camera3D_method_is_position_in_frustum>`\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`make_current<class_Camera3D_method_make_current>`\ (\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`project_local_ray_normal<class_Camera3D_method_project_local_ray_normal>`\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`project_position<class_Camera3D_method_project_position>`\ (\ screen_point\: :ref:`Vector2<class_Vector2>`, z_depth\: :ref:`float<class_float>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`project_ray_normal<class_Camera3D_method_project_ray_normal>`\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`project_ray_origin<class_Camera3D_method_project_ray_origin>`\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_cull_mask_value<class_Camera3D_method_set_cull_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_frustum<class_Camera3D_method_set_frustum>`\ (\ size\: :ref:`float<class_float>`, offset\: :ref:`Vector2<class_Vector2>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_orthogonal<class_Camera3D_method_set_orthogonal>`\ (\ size\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_perspective<class_Camera3D_method_set_perspective>`\ (\ fov\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`unproject_position<class_Camera3D_method_unproject_position>`\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| |
+--------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumeraciones
--------------------------
.. _enum_Camera3D_ProjectionType:
.. rst-class:: classref-enumeration
enum **ProjectionType**: :ref:`🔗<enum_Camera3D_ProjectionType>`
.. _class_Camera3D_constant_PROJECTION_PERSPECTIVE:
.. rst-class:: classref-enumeration-constant
:ref:`ProjectionType<enum_Camera3D_ProjectionType>` **PROJECTION_PERSPECTIVE** = ``0``
Proyección de la perspectiva. Los objetos en la pantalla se hacen más pequeños cuando están lejos.
.. _class_Camera3D_constant_PROJECTION_ORTHOGONAL:
.. rst-class:: classref-enumeration-constant
:ref:`ProjectionType<enum_Camera3D_ProjectionType>` **PROJECTION_ORTHOGONAL** = ``1``
Proyección ortogonal, también conocida como proyección ortográfica. Los objetos permanecen del mismo tamaño en la pantalla sin importar lo lejos que estén.
.. _class_Camera3D_constant_PROJECTION_FRUSTUM:
.. rst-class:: classref-enumeration-constant
:ref:`ProjectionType<enum_Camera3D_ProjectionType>` **PROJECTION_FRUSTUM** = ``2``
Proyección de Frustum. Este modo permite ajustar :ref:`frustum_offset<class_Camera3D_property_frustum_offset>` para crear efectos de "frustum inclinado".
.. rst-class:: classref-item-separator
----
.. _enum_Camera3D_KeepAspect:
.. rst-class:: classref-enumeration
enum **KeepAspect**: :ref:`🔗<enum_Camera3D_KeepAspect>`
.. _class_Camera3D_constant_KEEP_WIDTH:
.. rst-class:: classref-enumeration-constant
:ref:`KeepAspect<enum_Camera3D_KeepAspect>` **KEEP_WIDTH** = ``0``
Preserva la relación de aspecto horizontal; también conocida como escala de Vert-. Esta suele ser la mejor opción para los proyectos que se ejecutan en modo de retrato, ya que las proporciones de aspecto más altas se beneficiarán de un mayor FOV vertical.
.. _class_Camera3D_constant_KEEP_HEIGHT:
.. rst-class:: classref-enumeration-constant
:ref:`KeepAspect<enum_Camera3D_KeepAspect>` **KEEP_HEIGHT** = ``1``
Preserva la relación de aspecto vertical; también conocida como escala Hor+. Esta suele ser la mejor opción para los proyectos que se ejecutan en modo paisaje, ya que las relaciones de aspecto más amplias se beneficiarán automáticamente de un FOV horizontal más amplio.
.. rst-class:: classref-item-separator
----
.. _enum_Camera3D_DopplerTracking:
.. rst-class:: classref-enumeration
enum **DopplerTracking**: :ref:`🔗<enum_Camera3D_DopplerTracking>`
.. _class_Camera3D_constant_DOPPLER_TRACKING_DISABLED:
.. rst-class:: classref-enumeration-constant
:ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` **DOPPLER_TRACKING_DISABLED** = ``0``
Desactiva la simulación del `efecto Doppler <https://en.wikipedia.org/wiki/Doppler_effect>`__ (por defecto).
.. _class_Camera3D_constant_DOPPLER_TRACKING_IDLE_STEP:
.. rst-class:: classref-enumeration-constant
:ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` **DOPPLER_TRACKING_IDLE_STEP** = ``1``
Simulate `Doppler effect <https://en.wikipedia.org/wiki/Doppler_effect>`__ by tracking positions of objects that are changed in ``_process``. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's :ref:`AudioStreamPlayer3D.pitch_scale<class_AudioStreamPlayer3D_property_pitch_scale>`).
.. _class_Camera3D_constant_DOPPLER_TRACKING_PHYSICS_STEP:
.. rst-class:: classref-enumeration-constant
:ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` **DOPPLER_TRACKING_PHYSICS_STEP** = ``2``
Simulate `Doppler effect <https://en.wikipedia.org/wiki/Doppler_effect>`__ by tracking positions of objects that are changed in ``_physics_process``. Changes in the relative velocity of this camera compared to those objects affect how audio is perceived (changing the audio's :ref:`AudioStreamPlayer3D.pitch_scale<class_AudioStreamPlayer3D_property_pitch_scale>`).
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descripciones de Propiedades
--------------------------------------------------------
.. _class_Camera3D_property_attributes:
.. rst-class:: classref-property
:ref:`CameraAttributes<class_CameraAttributes>` **attributes** :ref:`🔗<class_Camera3D_property_attributes>`
.. rst-class:: classref-property-setget
- |void| **set_attributes**\ (\ value\: :ref:`CameraAttributes<class_CameraAttributes>`\ )
- :ref:`CameraAttributes<class_CameraAttributes>` **get_attributes**\ (\ )
Los :ref:`CameraAttributes<class_CameraAttributes>` que se utilizarán para esta cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_compositor:
.. rst-class:: classref-property
:ref:`Compositor<class_Compositor>` **compositor** :ref:`🔗<class_Camera3D_property_compositor>`
.. rst-class:: classref-property-setget
- |void| **set_compositor**\ (\ value\: :ref:`Compositor<class_Compositor>`\ )
- :ref:`Compositor<class_Compositor>` **get_compositor**\ (\ )
El :ref:`Compositor<class_Compositor>` a utilizar para esta cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_cull_mask:
.. rst-class:: classref-property
:ref:`int<class_int>` **cull_mask** = ``1048575`` :ref:`🔗<class_Camera3D_property_cull_mask>`
.. rst-class:: classref-property-setget
- |void| **set_cull_mask**\ (\ value\: :ref:`int<class_int>`\ )
- :ref:`int<class_int>` **get_cull_mask**\ (\ )
The culling mask that describes which :ref:`VisualInstance3D.layers<class_VisualInstance3D_property_layers>` are rendered by this camera. By default, all 20 user-visible layers are rendered.
\ **Note:** Since the :ref:`cull_mask<class_Camera3D_property_cull_mask>` allows for 32 layers to be stored in total, there are an additional 12 layers that are only used internally by the engine and aren't exposed in the editor. Setting :ref:`cull_mask<class_Camera3D_property_cull_mask>` using a script allows you to toggle those reserved layers, which can be useful for editor plugins.
To adjust :ref:`cull_mask<class_Camera3D_property_cull_mask>` more easily using a script, use :ref:`get_cull_mask_value()<class_Camera3D_method_get_cull_mask_value>` and :ref:`set_cull_mask_value()<class_Camera3D_method_set_cull_mask_value>`.
\ **Note:** :ref:`VoxelGI<class_VoxelGI>`, SDFGI and :ref:`LightmapGI<class_LightmapGI>` will always take all layers into account to determine what contributes to global illumination. If this is an issue, set :ref:`GeometryInstance3D.gi_mode<class_GeometryInstance3D_property_gi_mode>` to :ref:`GeometryInstance3D.GI_MODE_DISABLED<class_GeometryInstance3D_constant_GI_MODE_DISABLED>` for meshes and :ref:`Light3D.light_bake_mode<class_Light3D_property_light_bake_mode>` to :ref:`Light3D.BAKE_DISABLED<class_Light3D_constant_BAKE_DISABLED>` for lights to exclude them from global illumination.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_current:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **current** = ``false`` :ref:`🔗<class_Camera3D_property_current>`
.. rst-class:: classref-property-setget
- |void| **set_current**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_current**\ (\ )
If ``true``, the ancestor :ref:`Viewport<class_Viewport>` is currently using this camera.
If multiple cameras are in the scene, one will always be made current. For example, if two **Camera3D** nodes are present in the scene and only one is current, setting one camera's :ref:`current<class_Camera3D_property_current>` to ``false`` will cause the other camera to be made current.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_doppler_tracking:
.. rst-class:: classref-property
:ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` **doppler_tracking** = ``0`` :ref:`🔗<class_Camera3D_property_doppler_tracking>`
.. rst-class:: classref-property-setget
- |void| **set_doppler_tracking**\ (\ value\: :ref:`DopplerTracking<enum_Camera3D_DopplerTracking>`\ )
- :ref:`DopplerTracking<enum_Camera3D_DopplerTracking>` **get_doppler_tracking**\ (\ )
If not :ref:`DOPPLER_TRACKING_DISABLED<class_Camera3D_constant_DOPPLER_TRACKING_DISABLED>`, this camera will simulate the `Doppler effect <https://en.wikipedia.org/wiki/Doppler_effect>`__ for objects changed in particular ``_process`` methods.
\ **Note:** The Doppler effect will only be heard on :ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>`\ s if :ref:`AudioStreamPlayer3D.doppler_tracking<class_AudioStreamPlayer3D_property_doppler_tracking>` is not set to :ref:`AudioStreamPlayer3D.DOPPLER_TRACKING_DISABLED<class_AudioStreamPlayer3D_constant_DOPPLER_TRACKING_DISABLED>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_environment:
.. rst-class:: classref-property
:ref:`Environment<class_Environment>` **environment** :ref:`🔗<class_Camera3D_property_environment>`
.. rst-class:: classref-property-setget
- |void| **set_environment**\ (\ value\: :ref:`Environment<class_Environment>`\ )
- :ref:`Environment<class_Environment>` **get_environment**\ (\ )
El :ref:`Environment<class_Environment>` a utilizar para esta cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_far:
.. rst-class:: classref-property
:ref:`float<class_float>` **far** = ``4000.0`` :ref:`🔗<class_Camera3D_property_far>`
.. rst-class:: classref-property-setget
- |void| **set_far**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_far**\ (\ )
The distance to the far culling boundary for this camera relative to its local Z axis. Higher values allow the camera to see further away, while decreasing :ref:`far<class_Camera3D_property_far>` can improve performance if it results in objects being partially or fully culled.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_fov:
.. rst-class:: classref-property
:ref:`float<class_float>` **fov** = ``75.0`` :ref:`🔗<class_Camera3D_property_fov>`
.. rst-class:: classref-property-setget
- |void| **set_fov**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_fov**\ (\ )
The camera's field of view angle (in degrees). Only applicable in perspective mode. Since :ref:`keep_aspect<class_Camera3D_property_keep_aspect>` locks one axis, :ref:`fov<class_Camera3D_property_fov>` sets the other axis' field of view angle.
For reference, the default vertical field of view value (``75.0``) is equivalent to a horizontal FOV of:
- ~91.31 degrees in a 4:3 viewport
- ~101.67 degrees in a 16:10 viewport
- ~107.51 degrees in a 16:9 viewport
- ~121.63 degrees in a 21:9 viewport
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_frustum_offset:
.. rst-class:: classref-property
:ref:`Vector2<class_Vector2>` **frustum_offset** = ``Vector2(0, 0)`` :ref:`🔗<class_Camera3D_property_frustum_offset>`
.. rst-class:: classref-property-setget
- |void| **set_frustum_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
- :ref:`Vector2<class_Vector2>` **get_frustum_offset**\ (\ )
The camera's frustum offset. This can be changed from the default to create "tilted frustum" effects such as `Y-shearing <https://zdoom.org/wiki/Y-shearing>`__.
\ **Note:** Only effective if :ref:`projection<class_Camera3D_property_projection>` is :ref:`PROJECTION_FRUSTUM<class_Camera3D_constant_PROJECTION_FRUSTUM>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_h_offset:
.. rst-class:: classref-property
:ref:`float<class_float>` **h_offset** = ``0.0`` :ref:`🔗<class_Camera3D_property_h_offset>`
.. rst-class:: classref-property-setget
- |void| **set_h_offset**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_h_offset**\ (\ )
El desplazamiento horizontal (X) de la vista de la cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_keep_aspect:
.. rst-class:: classref-property
:ref:`KeepAspect<enum_Camera3D_KeepAspect>` **keep_aspect** = ``1`` :ref:`🔗<class_Camera3D_property_keep_aspect>`
.. rst-class:: classref-property-setget
- |void| **set_keep_aspect_mode**\ (\ value\: :ref:`KeepAspect<enum_Camera3D_KeepAspect>`\ )
- :ref:`KeepAspect<enum_Camera3D_KeepAspect>` **get_keep_aspect_mode**\ (\ )
El eje a bloquear durante los ajustes de :ref:`fov<class_Camera3D_property_fov>`/:ref:`size<class_Camera3D_property_size>`. Puede ser :ref:`KEEP_WIDTH<class_Camera3D_constant_KEEP_WIDTH>` o :ref:`KEEP_HEIGHT<class_Camera3D_constant_KEEP_HEIGHT>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_near:
.. rst-class:: classref-property
:ref:`float<class_float>` **near** = ``0.05`` :ref:`🔗<class_Camera3D_property_near>`
.. rst-class:: classref-property-setget
- |void| **set_near**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_near**\ (\ )
The distance to the near culling boundary for this camera relative to its local Z axis. Lower values allow the camera to see objects more up close to its origin, at the cost of lower precision across the *entire* range. Values lower than the default can lead to increased Z-fighting.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_projection:
.. rst-class:: classref-property
:ref:`ProjectionType<enum_Camera3D_ProjectionType>` **projection** = ``0`` :ref:`🔗<class_Camera3D_property_projection>`
.. rst-class:: classref-property-setget
- |void| **set_projection**\ (\ value\: :ref:`ProjectionType<enum_Camera3D_ProjectionType>`\ )
- :ref:`ProjectionType<enum_Camera3D_ProjectionType>` **get_projection**\ (\ )
El modo de proyección de la cámara. En el modo :ref:`PROJECTION_PERSPECTIVE<class_Camera3D_constant_PROJECTION_PERSPECTIVE>`, la distancia Z de los objetos al espacio local de la cámara escala su tamaño percibido.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_size:
.. rst-class:: classref-property
:ref:`float<class_float>` **size** = ``1.0`` :ref:`🔗<class_Camera3D_property_size>`
.. rst-class:: classref-property-setget
- |void| **set_size**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_size**\ (\ )
The camera's size in meters measured as the diameter of the width or height, depending on :ref:`keep_aspect<class_Camera3D_property_keep_aspect>`. Only applicable in orthogonal and frustum modes.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_property_v_offset:
.. rst-class:: classref-property
:ref:`float<class_float>` **v_offset** = ``0.0`` :ref:`🔗<class_Camera3D_property_v_offset>`
.. rst-class:: classref-property-setget
- |void| **set_v_offset**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_v_offset**\ (\ )
El desplazamiento vertical (Y) del viewport de la cámara.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Descripciones de Métodos
------------------------------------------------
.. _class_Camera3D_method_clear_current:
.. rst-class:: classref-method
|void| **clear_current**\ (\ enable_next\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_Camera3D_method_clear_current>`
Si esta es la cámara actual, dejar de usarla. Si ``enable_next`` es ``true``, se solicitará usar la siguiente cámara, si existe.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_camera_projection:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **get_camera_projection**\ (\ ) |const| :ref:`🔗<class_Camera3D_method_get_camera_projection>`
Devuelve la matriz de proyección que esta cámara utiliza para renderizar a su viewport asociado. La cámara debe ser parte del árbol de la escena para funcionar.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_camera_rid:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_camera_rid**\ (\ ) |const| :ref:`🔗<class_Camera3D_method_get_camera_rid>`
Devuelve el RID de la cámara desde el :ref:`RenderingServer<class_RenderingServer>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_camera_transform:
.. rst-class:: classref-method
:ref:`Transform3D<class_Transform3D>` **get_camera_transform**\ (\ ) |const| :ref:`🔗<class_Camera3D_method_get_camera_transform>`
Devuelve la transformación de la cámara más los desplazamientos verticales (:ref:`v_offset<class_Camera3D_property_v_offset>`) y horizontales (:ref:`h_offset<class_Camera3D_property_h_offset>`); y cualquier otro ajuste realizado a la posición y orientación de la cámara por las cámaras subclasificadas como :ref:`XRCamera3D<class_XRCamera3D>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_cull_mask_value:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **get_cull_mask_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Camera3D_method_get_cull_mask_value>`
Devuelve si la capa especificada de :ref:`cull_mask<class_Camera3D_property_cull_mask>` está habilitada, dado un ``layer_number`` entre 1 y 20.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_frustum:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`Plane<class_Plane>`\] **get_frustum**\ (\ ) |const| :ref:`🔗<class_Camera3D_method_get_frustum>`
Devuelve los planos del frustum de la cámara en unidades del espacio mundial como un array de :ref:`Plane<class_Plane>`\ s en el siguiente orden: cerca, lejos, izquierda, arriba, derecha, abajo. No confundir con :ref:`frustum_offset<class_Camera3D_property_frustum_offset>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_get_pyramid_shape_rid:
.. rst-class:: classref-method
:ref:`RID<class_RID>` **get_pyramid_shape_rid**\ (\ ) :ref:`🔗<class_Camera3D_method_get_pyramid_shape_rid>`
Devuelve el RID de una forma piramidal que abarca el frustum de visión de la cámara, ignorando el plano cercano de la cámara. La punta de la pirámide representa la posición de la cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_is_position_behind:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_position_behind**\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Camera3D_method_is_position_behind>`
Devuelve ``true`` si la posición dada está detrás de la cámara (la parte azul del diagrama enlazado). `Consulta este diagrama <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png>`__ para obtener una visión general de los métodos de consulta de posición.
\ **Nota:** Una posición que devuelva ``false`` aún puede estar fuera del campo de visión de la cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_is_position_in_frustum:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_position_in_frustum**\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Camera3D_method_is_position_in_frustum>`
Devuelve ``true`` si la posición dada está dentro del frustum de la cámara (la parte verde del diagrama enlazado). `Consulta este diagrama <https://raw.githubusercontent.com/godotengine/godot-docs/master/img/camera3d_position_frustum.png>`__ para obtener una visión general de los métodos de consulta de posición.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_make_current:
.. rst-class:: classref-method
|void| **make_current**\ (\ ) :ref:`🔗<class_Camera3D_method_make_current>`
Hace que esta cámara sea la cámara actual para el :ref:`Viewport<class_Viewport>` (ver descripción de la clase). Si el nodo de la cámara está fuera del árbol de escenas, intentará convertirse en actual una vez que se añada.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_project_local_ray_normal:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **project_local_ray_normal**\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Camera3D_method_project_local_ray_normal>`
Devuelve un vector normal de la ubicación del punto de la pantalla dirigido a lo largo de la cámara. Las cámaras ortogonales están normalizadas. Las cámaras de perspectiva tienen en cuenta la perspectiva, la anchura y la altura de la pantalla, etc.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_project_position:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **project_position**\ (\ screen_point\: :ref:`Vector2<class_Vector2>`, z_depth\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Camera3D_method_project_position>`
Devuelve el punto 3D en el espacio mundial que se corresponde con la coordenada 2D dada en el rectángulo del :ref:`Viewport<class_Viewport>`, en un plano que está a la distancia ``z_depth`` en la escena, alejado de la cámara.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_project_ray_normal:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **project_ray_normal**\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Camera3D_method_project_ray_normal>`
Devuelve un vector normal en el espacio mundial, que es el resultado de proyectar un punto en el rectángulo del :ref:`Viewport<class_Viewport>` mediante la proyección inversa de la cámara. Esto es útil para lanzar rayos en forma de (origen, normal) para la intersección o selección de objetos.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_project_ray_origin:
.. rst-class:: classref-method
:ref:`Vector3<class_Vector3>` **project_ray_origin**\ (\ screen_point\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Camera3D_method_project_ray_origin>`
Devuelve una posición 3D en el espacio mundial, que es el resultado de proyectar un punto en el rectángulo del :ref:`Viewport<class_Viewport>` mediante la proyección inversa de la cámara. Esto es útil para lanzar rayos en forma de (origen, normal) para la intersección o selección de objetos.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_set_cull_mask_value:
.. rst-class:: classref-method
|void| **set_cull_mask_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_Camera3D_method_set_cull_mask_value>`
Según ``value``, activa o desactiva la capa especificada en el :ref:`cull_mask<class_Camera3D_property_cull_mask>`, dado un ``layer_number`` entre 1 y 20.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_set_frustum:
.. rst-class:: classref-method
|void| **set_frustum**\ (\ size\: :ref:`float<class_float>`, offset\: :ref:`Vector2<class_Vector2>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Camera3D_method_set_frustum>`
Establece la proyección de la cámara en modo frustum (véase :ref:`PROJECTION_FRUSTUM<class_Camera3D_constant_PROJECTION_FRUSTUM>`), especificando un ``size``, un ``offset``, y los planos de recorte ``z_near`` y ``z_far`` en unidades del espacio mundial. Véase también :ref:`frustum_offset<class_Camera3D_property_frustum_offset>`.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_set_orthogonal:
.. rst-class:: classref-method
|void| **set_orthogonal**\ (\ size\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Camera3D_method_set_orthogonal>`
Establece la proyección de la cámara en modo ortogonal (véase :ref:`PROJECTION_ORTHOGONAL<class_Camera3D_constant_PROJECTION_ORTHOGONAL>`), especificando un ``size``, y los planos de recorte ``z_near`` y ``z_far`` en unidades del espacio mundial.
Como sugerencia, los juegos 3D que parecen 2D a menudo usan esta proyección, con ``size`` especificado en píxeles.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_set_perspective:
.. rst-class:: classref-method
|void| **set_perspective**\ (\ fov\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Camera3D_method_set_perspective>`
Establece la proyección de la cámara en modo de perspectiva (véase :ref:`PROJECTION_PERSPECTIVE<class_Camera3D_constant_PROJECTION_PERSPECTIVE>`), especificando un ángulo ``fov`` (campo de visión) en grados, y los planos de recorte ``z_near`` y ``z_far`` en unidades del espacio mundial.
.. rst-class:: classref-item-separator
----
.. _class_Camera3D_method_unproject_position:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **unproject_position**\ (\ world_point\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_Camera3D_method_unproject_position>`
Returns the 2D coordinate in the :ref:`Viewport<class_Viewport>` rectangle that maps to the given 3D point in world space.
\ **Note:** When using this to position GUI elements over a 3D viewport, use :ref:`is_position_behind()<class_Camera3D_method_is_position_behind>` to prevent them from appearing if the 3D point is behind the camera:
::
# This code block is part of a script that inherits from Node3D.
# `control` is a reference to a node inheriting from Control.
control.visible = not get_viewport().get_camera_3d().is_position_behind(global_transform.origin)
control.position = get_viewport().get_camera_3d().unproject_position(global_transform.origin)
.. |virtual| replace:: :abbr:`virtual (Normalmente, este método debería ser sobreescrito por el usuario para que tenga algún efecto.)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (Este método no tiene efectos secundarios. No modifica ninguna de las variables miembro de la instancia.)`
.. |vararg| replace:: :abbr:`vararg (Este método permite agregar cualquier número de argumentos después de los descritos aquí.)`
.. |constructor| replace:: :abbr:`constructor (Este método se utiliza para construir un tipo.)`
.. |static| replace:: :abbr:`static (Este método no necesita una instancia para ser llamado, por lo que puede llamarse directamente utilizando el nombre de la clase.)`
.. |operator| replace:: :abbr:`operator (Este método describe un operador válido para usar con este tipo como operando izquierdo.)`
.. |bitfield| replace:: :abbr:`BitField (Este valor es un entero compuesto como una máscara de bits de las siguientes banderas.)`
.. |void| replace:: :abbr:`void (Sin valor de retorno.)`