mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
251 lines
13 KiB
ReStructuredText
251 lines
13 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_MobileVRInterface:
|
|
|
|
MobileVRInterface
|
|
=================
|
|
|
|
**繼承:** :ref:`XRInterface<class_XRInterface>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
通用移動 VR 實作。
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
說明
|
|
----
|
|
|
|
This is a generic mobile VR implementation where you need to provide details about the phone and HMD used. It does not rely on any existing framework. This is the most basic interface we have. For the best effect, you need a mobile phone with a gyroscope and accelerometer.
|
|
|
|
Note that even though there is no positional tracking, the camera will assume the headset is at a height of 1.85 meters. You can change this by setting :ref:`eye_height<class_MobileVRInterface_property_eye_height>`.
|
|
|
|
You can initialize this interface as follows:
|
|
|
|
::
|
|
|
|
var interface = XRServer.find_interface("Native mobile")
|
|
if interface and interface.initialize():
|
|
get_viewport().use_xr = true
|
|
|
|
\ **Note:** For Android, :ref:`ProjectSettings.input_devices/sensors/enable_accelerometer<class_ProjectSettings_property_input_devices/sensors/enable_accelerometer>`, :ref:`ProjectSettings.input_devices/sensors/enable_gravity<class_ProjectSettings_property_input_devices/sensors/enable_gravity>`, :ref:`ProjectSettings.input_devices/sensors/enable_gyroscope<class_ProjectSettings_property_input_devices/sensors/enable_gyroscope>` and :ref:`ProjectSettings.input_devices/sensors/enable_magnetometer<class_ProjectSettings_property_input_devices/sensors/enable_magnetometer>` must be enabled.
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
屬性
|
|
----
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`display_to_lens<class_MobileVRInterface_property_display_to_lens>` | ``4.0`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`display_width<class_MobileVRInterface_property_display_width>` | ``14.5`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`eye_height<class_MobileVRInterface_property_eye_height>` | ``1.85`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`iod<class_MobileVRInterface_property_iod>` | ``6.0`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`k1<class_MobileVRInterface_property_k1>` | ``0.215`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`k2<class_MobileVRInterface_property_k2>` | ``0.215`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`Rect2<class_Rect2>` | :ref:`offset_rect<class_MobileVRInterface_property_offset_rect>` | ``Rect2(0, 0, 1, 1)`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`oversample<class_MobileVRInterface_property_oversample>` | ``1.5`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`vrs_min_radius<class_MobileVRInterface_property_vrs_min_radius>` | ``20.0`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`float<class_float>` | :ref:`vrs_strength<class_MobileVRInterface_property_vrs_strength>` | ``1.0`` |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
| :ref:`PlayAreaMode<enum_XRInterface_PlayAreaMode>` | xr_play_area_mode | ``1`` (overrides :ref:`XRInterface<class_XRInterface_property_xr_play_area_mode>`) |
|
|
+----------------------------------------------------+--------------------------------------------------------------------------+------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
屬性說明
|
|
--------
|
|
|
|
.. _class_MobileVRInterface_property_display_to_lens:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **display_to_lens** = ``4.0`` :ref:`🔗<class_MobileVRInterface_property_display_to_lens>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_display_to_lens**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_display_to_lens**\ (\ )
|
|
|
|
顯示器與裝置內部鏡片之間的距離,單位為釐米。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_display_width:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **display_width** = ``14.5`` :ref:`🔗<class_MobileVRInterface_property_display_width>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_display_width**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_display_width**\ (\ )
|
|
|
|
顯示器的寬度,單位為釐米。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_eye_height:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **eye_height** = ``1.85`` :ref:`🔗<class_MobileVRInterface_property_eye_height>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_eye_height**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_eye_height**\ (\ )
|
|
|
|
相機相對於地面所處的高度(即相對於 :ref:`XROrigin3D<class_XROrigin3D>` 節點)。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_iod:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **iod** = ``6.0`` :ref:`🔗<class_MobileVRInterface_property_iod>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_iod**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_iod**\ (\ )
|
|
|
|
眼間距離,也稱為瞳孔間距離。左眼和右眼瞳孔之間的距離。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_k1:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **k1** = ``0.215`` :ref:`🔗<class_MobileVRInterface_property_k1>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_k1**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_k1**\ (\ )
|
|
|
|
k1 鏡頭因數是定義所使用鏡頭強度的兩個常數之一,並直接影響鏡頭失真效果。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_k2:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **k2** = ``0.215`` :ref:`🔗<class_MobileVRInterface_property_k2>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_k2**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_k2**\ (\ )
|
|
|
|
k2 鏡頭因數,見 k1。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_offset_rect:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Rect2<class_Rect2>` **offset_rect** = ``Rect2(0, 0, 1, 1)`` :ref:`🔗<class_MobileVRInterface_property_offset_rect>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_offset_rect**\ (\ value\: :ref:`Rect2<class_Rect2>`\ )
|
|
- :ref:`Rect2<class_Rect2>` **get_offset_rect**\ (\ )
|
|
|
|
Set the offset rect relative to the area being rendered. A length of 1 represents the whole rendering area on that axis.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_oversample:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **oversample** = ``1.5`` :ref:`🔗<class_MobileVRInterface_property_oversample>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_oversample**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_oversample**\ (\ )
|
|
|
|
過取樣設定。由於鏡頭失真,我們必須以比螢幕自然解析度更高的品質算繪我們的緩衝區。介於 1.5 和 2.0 之間的值通常可以提供良好的結果,但會犧牲性能。
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_vrs_min_radius:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **vrs_min_radius** = ``20.0`` :ref:`🔗<class_MobileVRInterface_property_vrs_min_radius>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_vrs_min_radius**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_vrs_min_radius**\ (\ )
|
|
|
|
The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.
|
|
|
|
\ **Note:** Mobile and Forward+ renderers only. Requires :ref:`Viewport.vrs_mode<class_Viewport_property_vrs_mode>` to be set to :ref:`Viewport.VRS_XR<class_Viewport_constant_VRS_XR>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_MobileVRInterface_property_vrs_strength:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`float<class_float>` **vrs_strength** = ``1.0`` :ref:`🔗<class_MobileVRInterface_property_vrs_strength>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_vrs_strength**\ (\ value\: :ref:`float<class_float>`\ )
|
|
- :ref:`float<class_float>` **get_vrs_strength**\ (\ )
|
|
|
|
The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.
|
|
|
|
\ **Note:** Mobile and Forward+ renderers only. Requires :ref:`Viewport.vrs_mode<class_Viewport_property_vrs_mode>` to be set to :ref:`Viewport.VRS_XR<class_Viewport_constant_VRS_XR>`.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
|
|
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
|
|
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
|
|
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
|
|
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
|
|
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
|
|
.. |void| replace:: :abbr:`void (無回傳值。)`
|