:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/../../GodotApplePlugins/doc_classes/ARCamera.xml. .. _class_ARCamera: ARCamera ======== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` Provides camera tracking state and pose information from an AR session. .. rst-class:: classref-introduction-group Description ----------- Wraps the AR camera data, including the device pose, tracking state, and on iOS, camera intrinsics and projection matrices. \ **Platform availability:**\ - **iOS:** Full support including intrinsics, projection matrices, exposure, and image resolution. - **visionOS/macOS:** Only :ref:`transform`, :ref:`euler_angles`, :ref:`tracking_state`, :ref:`tracking_state_reason`, and :ref:`timestamp` are available. Camera intrinsics, projection matrices, exposure, and image resolution return empty/zero values because the system compositor owns the camera pipeline and Apple does not expose lens parameters to applications. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Vector3` | :ref:`euler_angles` | ``Vector3(0, 0, 0)`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`float` | :ref:`exposure_duration` | ``0.0`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`float` | :ref:`exposure_offset` | ``0.0`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Vector2` | :ref:`image_resolution` | ``Vector2(0, 0)`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`PackedFloat32Array` | :ref:`intrinsics` | ``PackedFloat32Array()`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`PackedFloat32Array` | :ref:`projection_matrix` | ``PackedFloat32Array()`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`float` | :ref:`timestamp` | ``0.0`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`tracking_state` | ``0`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`tracking_state_reason` | ``0`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Transform3D` | :ref:`transform` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` | +-----------------------------------------------------+-----------------------------------------------------------------------------+-----------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector2` | :ref:`project_point`\ (\ point\: :ref:`Vector3`, orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedFloat32Array` | :ref:`projection_matrix_for_orientation`\ (\ orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`, zNear\: :ref:`float`, zFar\: :ref:`float`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`unproject_point`\ (\ point\: :ref:`Vector2`, ontoPlaneWithTransform\: :ref:`Transform3D`, orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform3D` | :ref:`view_matrix_for_orientation`\ (\ orientation\: :ref:`int`\ ) | +-----------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_ARCamera_TrackingState: .. rst-class:: classref-enumeration enum **TrackingState**: :ref:`🔗` .. _class_ARCamera_constant_NOT_AVAILABLE: .. rst-class:: classref-enumeration-constant :ref:`TrackingState` **NOT_AVAILABLE** = ``0`` Camera tracking is not available. .. _class_ARCamera_constant_LIMITED: .. rst-class:: classref-enumeration-constant :ref:`TrackingState` **LIMITED** = ``1`` Camera tracking is available but currently limited. .. _class_ARCamera_constant_NORMAL: .. rst-class:: classref-enumeration-constant :ref:`TrackingState` **NORMAL** = ``2`` Camera tracking is operating normally. .. rst-class:: classref-item-separator ---- .. _enum_ARCamera_TrackingStateReason: .. rst-class:: classref-enumeration enum **TrackingStateReason**: :ref:`🔗` .. _class_ARCamera_constant_NONE: .. rst-class:: classref-enumeration-constant :ref:`TrackingStateReason` **NONE** = ``0`` No specific reason is reported for limited tracking. .. _class_ARCamera_constant_INITIALIZING: .. rst-class:: classref-enumeration-constant :ref:`TrackingStateReason` **INITIALIZING** = ``1`` Tracking is limited because the session is still initializing. .. _class_ARCamera_constant_EXCESSIVE_MOTION: .. rst-class:: classref-enumeration-constant :ref:`TrackingStateReason` **EXCESSIVE_MOTION** = ``2`` Tracking is limited because the device is moving too quickly. .. _class_ARCamera_constant_INSUFFICIENT_FEATURES: .. rst-class:: classref-enumeration-constant :ref:`TrackingStateReason` **INSUFFICIENT_FEATURES** = ``3`` Tracking is limited because the scene lacks enough visual features. .. _class_ARCamera_constant_RELOCALIZING: .. rst-class:: classref-enumeration-constant :ref:`TrackingStateReason` **RELOCALIZING** = ``4`` Tracking is limited because ARKit is attempting to relocalize in a known map. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_ARCamera_property_euler_angles: .. rst-class:: classref-property :ref:`Vector3` **euler_angles** = ``Vector3(0, 0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`Vector3` **get_euler_angles**\ (\ ) The camera orientation expressed as Euler angles in radians. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_exposure_duration: .. rst-class:: classref-property :ref:`float` **exposure_duration** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`float` **get_exposure_duration**\ (\ ) Exposure time in seconds. **iOS 13+ only.** Returns zero on visionOS/macOS. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_exposure_offset: .. rst-class:: classref-property :ref:`float` **exposure_offset** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`float` **get_exposure_offset**\ (\ ) Exposure EV offset. **iOS 13+ only.** Returns zero on visionOS/macOS. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_image_resolution: .. rst-class:: classref-property :ref:`Vector2` **image_resolution** = ``Vector2(0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`Vector2` **get_image_resolution**\ (\ ) The camera image resolution in pixels. **iOS only.** Returns zero on visionOS/macOS. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_intrinsics: .. rst-class:: classref-property :ref:`PackedFloat32Array` **intrinsics** = ``PackedFloat32Array()`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`PackedFloat32Array` **get_intrinsics**\ (\ ) The camera intrinsic matrix (3x3). **iOS only.** Returns empty on visionOS/macOS. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array` for more details. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_projection_matrix: .. rst-class:: classref-property :ref:`PackedFloat32Array` **projection_matrix** = ``PackedFloat32Array()`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`PackedFloat32Array` **get_projection_matrix**\ (\ ) The camera projection matrix (4x4). **iOS only.** Returns empty on visionOS/macOS. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedFloat32Array` for more details. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_timestamp: .. rst-class:: classref-property :ref:`float` **timestamp** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`float` **get_timestamp**\ (\ ) The frame timestamp associated with this camera sample. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_tracking_state: .. rst-class:: classref-property :ref:`int` **tracking_state** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`int` **get_tracking_state**\ (\ ) The current quality of camera tracking. See :ref:`TrackingState`. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_tracking_state_reason: .. rst-class:: classref-property :ref:`int` **tracking_state_reason** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`int` **get_tracking_state_reason**\ (\ ) If tracking is limited, explains why. See :ref:`TrackingStateReason`. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_property_transform: .. rst-class:: classref-property :ref:`Transform3D` **transform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - :ref:`Transform3D` **get_transform**\ (\ ) The camera transform in world space. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_ARCamera_method_project_point: .. rst-class:: classref-method :ref:`Vector2` **project_point**\ (\ point\: :ref:`Vector3`, orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`\ ) :ref:`🔗` Projects a 3D point to 2D screen coordinates. **iOS only.** Returns zero on visionOS/macOS because camera intrinsics are not available. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_method_projection_matrix_for_orientation: .. rst-class:: classref-method :ref:`PackedFloat32Array` **projection_matrix_for_orientation**\ (\ orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`, zNear\: :ref:`float`, zFar\: :ref:`float`\ ) :ref:`🔗` Returns a projection matrix for the given orientation and viewport. **iOS only.** Returns empty on visionOS/macOS. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_method_unproject_point: .. rst-class:: classref-method :ref:`Vector3` **unproject_point**\ (\ point\: :ref:`Vector2`, ontoPlaneWithTransform\: :ref:`Transform3D`, orientation\: :ref:`int`, viewportSize\: :ref:`Vector2`\ ) :ref:`🔗` Unprojects a 2D point onto a plane in 3D space. **iOS only.** Returns zero on visionOS/macOS. .. rst-class:: classref-item-separator ---- .. _class_ARCamera_method_view_matrix_for_orientation: .. rst-class:: classref-method :ref:`Transform3D` **view_matrix_for_orientation**\ (\ orientation\: :ref:`int`\ ) :ref:`🔗` Returns a view transform for the given interface orientation. **iOS only.** Returns the default transform on visionOS/macOS. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`