mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
852 lines
44 KiB
ReStructuredText
852 lines
44 KiB
ReStructuredText
:github_url: hide
|
||
|
||
.. _class_Camera2D:
|
||
|
||
Camera2D
|
||
========
|
||
|
||
**继承:** :ref:`Node2D<class_Node2D>` **<** :ref:`CanvasItem<class_CanvasItem>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
|
||
|
||
2D 场景的相机节点。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
描述
|
||
----
|
||
|
||
用于 2D 场景的相机节点。它强制屏幕(当前层)跟随该节点滚动。与手动改变基于 :ref:`CanvasItem<class_CanvasItem>` 节点的坐标相比,这使得对可滚动场景进行编程更加容易和快捷。
|
||
|
||
相机会在最近的 :ref:`Viewport<class_Viewport>`\ (在上层树时)节点中注册自己。每个视口只能激活一个相机。如果树上没有可用的视口,相机将在全局视口中注册。
|
||
|
||
这个节点旨在成为简单的辅助工具,让事情便捷,但可能需要更多的功能来改变相机的工作方式。要制作自定义相机节点,则从 :ref:`Node2D<class_Node2D>` 继承,并通过设置 :ref:`Viewport<class_Viewport>` 中的 :ref:`Viewport.canvas_transform<class_Viewport_property_canvas_transform>` 来改变画布的变换(你可以通过使用 :ref:`Node.get_viewport()<class_Node_method_get_viewport>` 获得当前的 :ref:`Viewport<class_Viewport>`\ )。
|
||
|
||
请注意,\ **Camera2D** 节点的 :ref:`Node2D.global_position<class_Node2D_property_global_position>` 并不代表屏幕的实际位置,这可能会因应用的平滑或限制而有所不同。可以使用 :ref:`get_screen_center_position()<class_Camera2D_method_get_screen_center_position>` 获取真实位置。该节点的 :ref:`Node2D.global_rotation<class_Node2D_property_global_rotation>` 亦然,可能由于应用的旋转平滑而有所不同。可以使用 :ref:`get_screen_rotation()<class_Camera2D_method_get_screen_rotation>` 获取屏幕的当前旋转值。
|
||
|
||
.. rst-class:: classref-introduction-group
|
||
|
||
教程
|
||
----
|
||
|
||
- `2D 平台跳跃演示 <https://godotengine.org/asset-library/asset/2727>`__
|
||
|
||
- `2D 等轴演示 <https://godotengine.org/asset-library/asset/2718>`__
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
属性
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`AnchorMode<enum_Camera2D_AnchorMode>` | :ref:`anchor_mode<class_Camera2D_property_anchor_mode>` | ``1`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`Node<class_Node>` | :ref:`custom_viewport<class_Camera2D_property_custom_viewport>` | |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_bottom_margin<class_Camera2D_property_drag_bottom_margin>` | ``0.2`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`drag_horizontal_enabled<class_Camera2D_property_drag_horizontal_enabled>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_horizontal_offset<class_Camera2D_property_drag_horizontal_offset>` | ``0.0`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_left_margin<class_Camera2D_property_drag_left_margin>` | ``0.2`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_right_margin<class_Camera2D_property_drag_right_margin>` | ``0.2`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_top_margin<class_Camera2D_property_drag_top_margin>` | ``0.2`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`drag_vertical_enabled<class_Camera2D_property_drag_vertical_enabled>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`drag_vertical_offset<class_Camera2D_property_drag_vertical_offset>` | ``0.0`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`editor_draw_drag_margin<class_Camera2D_property_editor_draw_drag_margin>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`editor_draw_limits<class_Camera2D_property_editor_draw_limits>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`editor_draw_screen<class_Camera2D_property_editor_draw_screen>` | ``true`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`enabled<class_Camera2D_property_enabled>` | ``true`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`ignore_rotation<class_Camera2D_property_ignore_rotation>` | ``true`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`int<class_int>` | :ref:`limit_bottom<class_Camera2D_property_limit_bottom>` | ``10000000`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`limit_enabled<class_Camera2D_property_limit_enabled>` | ``true`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`int<class_int>` | :ref:`limit_left<class_Camera2D_property_limit_left>` | ``-10000000`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`int<class_int>` | :ref:`limit_right<class_Camera2D_property_limit_right>` | ``10000000`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`limit_smoothed<class_Camera2D_property_limit_smoothed>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`int<class_int>` | :ref:`limit_top<class_Camera2D_property_limit_top>` | ``-10000000`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`offset<class_Camera2D_property_offset>` | ``Vector2(0, 0)`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`position_smoothing_enabled<class_Camera2D_property_position_smoothing_enabled>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`position_smoothing_speed<class_Camera2D_property_position_smoothing_speed>` | ``5.0`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>` | :ref:`process_callback<class_Camera2D_property_process_callback>` | ``1`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`rotation_smoothing_enabled<class_Camera2D_property_rotation_smoothing_enabled>` | ``false`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`float<class_float>` | :ref:`rotation_smoothing_speed<class_Camera2D_property_rotation_smoothing_speed>` | ``5.0`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`zoom<class_Camera2D_property_zoom>` | ``Vector2(1, 1)`` |
|
||
+-----------------------------------------------------------------------+---------------------------------------------------------------------------------------+-------------------+
|
||
|
||
.. rst-class:: classref-reftable-group
|
||
|
||
方法
|
||
----
|
||
|
||
.. table::
|
||
:widths: auto
|
||
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`align<class_Camera2D_method_align>`\ (\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`force_update_scroll<class_Camera2D_method_force_update_scroll>`\ (\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`get_drag_margin<class_Camera2D_method_get_drag_margin>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`int<class_int>` | :ref:`get_limit<class_Camera2D_method_get_limit>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`get_screen_center_position<class_Camera2D_method_get_screen_center_position>`\ (\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`float<class_float>` | :ref:`get_screen_rotation<class_Camera2D_method_get_screen_rotation>`\ (\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`Vector2<class_Vector2>` | :ref:`get_target_position<class_Camera2D_method_get_target_position>`\ (\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| :ref:`bool<class_bool>` | :ref:`is_current<class_Camera2D_method_is_current>`\ (\ ) |const| |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`make_current<class_Camera2D_method_make_current>`\ (\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`reset_smoothing<class_Camera2D_method_reset_smoothing>`\ (\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_drag_margin<class_Camera2D_method_set_drag_margin>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
| |void| | :ref:`set_limit<class_Camera2D_method_set_limit>`\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ ) |
|
||
+-------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
枚举
|
||
----
|
||
|
||
.. _enum_Camera2D_AnchorMode:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **AnchorMode**: :ref:`🔗<enum_Camera2D_AnchorMode>`
|
||
|
||
.. _class_Camera2D_constant_ANCHOR_MODE_FIXED_TOP_LEFT:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`AnchorMode<enum_Camera2D_AnchorMode>` **ANCHOR_MODE_FIXED_TOP_LEFT** = ``0``
|
||
|
||
相机的位置是固定的,所以左上角总是在原点。
|
||
|
||
.. _class_Camera2D_constant_ANCHOR_MODE_DRAG_CENTER:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`AnchorMode<enum_Camera2D_AnchorMode>` **ANCHOR_MODE_DRAG_CENTER** = ``1``
|
||
|
||
相机的位置要考虑垂直/水平偏移和屏幕尺寸。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _enum_Camera2D_Camera2DProcessCallback:
|
||
|
||
.. rst-class:: classref-enumeration
|
||
|
||
enum **Camera2DProcessCallback**: :ref:`🔗<enum_Camera2D_Camera2DProcessCallback>`
|
||
|
||
.. _class_Camera2D_constant_CAMERA2D_PROCESS_PHYSICS:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>` **CAMERA2D_PROCESS_PHYSICS** = ``0``
|
||
|
||
相机在物理帧期间更新(见 :ref:`Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_INTERNAL_PHYSICS_PROCESS>`\ )。
|
||
|
||
.. _class_Camera2D_constant_CAMERA2D_PROCESS_IDLE:
|
||
|
||
.. rst-class:: classref-enumeration-constant
|
||
|
||
:ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>` **CAMERA2D_PROCESS_IDLE** = ``1``
|
||
|
||
相机在进程帧期间更新(见 :ref:`Node.NOTIFICATION_INTERNAL_PROCESS<class_Node_constant_NOTIFICATION_INTERNAL_PROCESS>`\ )。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
属性说明
|
||
--------
|
||
|
||
.. _class_Camera2D_property_anchor_mode:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`AnchorMode<enum_Camera2D_AnchorMode>` **anchor_mode** = ``1`` :ref:`🔗<class_Camera2D_property_anchor_mode>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_anchor_mode**\ (\ value\: :ref:`AnchorMode<enum_Camera2D_AnchorMode>`\ )
|
||
- :ref:`AnchorMode<enum_Camera2D_AnchorMode>` **get_anchor_mode**\ (\ )
|
||
|
||
Camera2D 的锚点。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_custom_viewport:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Node<class_Node>` **custom_viewport** :ref:`🔗<class_Camera2D_property_custom_viewport>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_custom_viewport**\ (\ value\: :ref:`Node<class_Node>`\ )
|
||
- :ref:`Node<class_Node>` **get_custom_viewport**\ (\ )
|
||
|
||
连接到 **Camera2D** 的自定义 :ref:`Viewport<class_Viewport>` 节点。如果为 ``null`` 或者不是 :ref:`Viewport<class_Viewport>`\ ,则使用默认的视口。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_bottom_margin:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_bottom_margin** = ``0.2`` :ref:`🔗<class_Camera2D_property_drag_bottom_margin>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
拖动相机所需的下边距。值为 ``1`` 时,相机仅在到达屏幕底部边缘时移动。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_horizontal_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **drag_horizontal_enabled** = ``false`` :ref:`🔗<class_Camera2D_property_drag_horizontal_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_horizontal_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_drag_horizontal_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,相机仅在到达水平(左或右)拖动边距时移动。如果为 ``false``\ ,则相机水平移动时不考虑边距。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_horizontal_offset:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_horizontal_offset** = ``0.0`` :ref:`🔗<class_Camera2D_property_drag_horizontal_offset>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_horizontal_offset**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_horizontal_offset**\ (\ )
|
||
|
||
相机在右侧(\ ``-1``\ )和左侧(\ ``1``\ )拖动边距之间的相对水平拖动偏移量。
|
||
|
||
\ **注意:**\ 用于设置初始水平拖动偏移量;确定当前偏移量;或强制当前偏移量。当 :ref:`drag_horizontal_enabled<class_Camera2D_property_drag_horizontal_enabled>` 为 ``true`` 或更改拖动边距时,它不会自动更新。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_left_margin:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_left_margin** = ``0.2`` :ref:`🔗<class_Camera2D_property_drag_left_margin>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
拖动相机所需的左边距。值为 ``1`` 时,相机仅在到达屏幕左侧边缘时移动。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_right_margin:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_right_margin** = ``0.2`` :ref:`🔗<class_Camera2D_property_drag_right_margin>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
拖动相机所需的右边距。值为 ``1`` 时,相机仅在到达屏幕右侧边缘时移动。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_top_margin:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_top_margin** = ``0.2`` :ref:`🔗<class_Camera2D_property_drag_top_margin>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
拖动相机所需的上边距。值为 ``1`` 时,相机仅在到达屏幕顶部边缘时移动。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_vertical_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **drag_vertical_enabled** = ``false`` :ref:`🔗<class_Camera2D_property_drag_vertical_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_vertical_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_drag_vertical_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,相机仅在达到垂直(顶部及底部)拖动边距时才移动。如果为 ``false``\ ,相机会垂直移动而不管边距。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_drag_vertical_offset:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **drag_vertical_offset** = ``0.0`` :ref:`🔗<class_Camera2D_property_drag_vertical_offset>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_drag_vertical_offset**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_drag_vertical_offset**\ (\ )
|
||
|
||
相机在底部(\ ``-1``\ )和顶部(\ ``1``\ )拖动边距之间的相对垂直拖动偏移量。
|
||
|
||
\ **注意:**\ 用于设置初始垂直拖动偏移量;确定当前偏移量;或强制当前偏移量。当 :ref:`drag_vertical_enabled<class_Camera2D_property_drag_vertical_enabled>` 为 ``true`` 或更改拖动边距时,它不会自动更新。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_editor_draw_drag_margin:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **editor_draw_drag_margin** = ``false`` :ref:`🔗<class_Camera2D_property_editor_draw_drag_margin>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_margin_drawing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_margin_drawing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,在编辑器中绘制相机的拖动边距矩形。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_editor_draw_limits:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **editor_draw_limits** = ``false`` :ref:`🔗<class_Camera2D_property_editor_draw_limits>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit_drawing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_limit_drawing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,在编辑器中绘制相机的极限矩形。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_editor_draw_screen:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **editor_draw_screen** = ``true`` :ref:`🔗<class_Camera2D_property_editor_draw_screen>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_screen_drawing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_screen_drawing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,在编辑器中绘制相机的画面矩形。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **enabled** = ``true`` :ref:`🔗<class_Camera2D_property_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_enabled**\ (\ )
|
||
|
||
控制该相机是否可以激活。如果为 ``true``\ ,当该 **Camera2D** 进入场景树并且当前没有活动的相机时,它将成为主相机(参见 :ref:`Viewport.get_camera_2d()<class_Viewport_method_get_camera_2d>`\ )。
|
||
|
||
当该相机当前处于活动状态且 :ref:`enabled<class_Camera2D_property_enabled>` 被设置为 ``false`` 时,则场景树中下一个启用的 **Camera2D** 将变为活动状态。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_ignore_rotation:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **ignore_rotation** = ``true`` :ref:`🔗<class_Camera2D_property_ignore_rotation>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_ignore_rotation**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_ignoring_rotation**\ (\ )
|
||
|
||
如果为 ``true`` ,相机的渲染视图不会受到其 :ref:`Node2D.rotation<class_Node2D_property_rotation>` 和 :ref:`Node2D.global_rotation<class_Node2D_property_global_rotation>` 的影响。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_bottom:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **limit_bottom** = ``10000000`` :ref:`🔗<class_Camera2D_property_limit_bottom>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
底部滚动极限,单位为像素。相机会在抵达该值时停止移动,但是 :ref:`offset<class_Camera2D_property_offset>` 可以把视图推过该极限。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **limit_enabled** = ``true`` :ref:`🔗<class_Camera2D_property_limit_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_limit_enabled**\ (\ )
|
||
|
||
如果为 ``true`` 则启用限制。禁用该选项将允许相机聚焦在任何位置,此时四个 ``limit_*`` 属性不起作用。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_left:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **limit_left** = ``-10000000`` :ref:`🔗<class_Camera2D_property_limit_left>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
左侧滚动极限,单位为像素。相机会在抵达该值时停止移动,但是 :ref:`offset<class_Camera2D_property_offset>` 可以把视图推过该极限。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_right:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **limit_right** = ``10000000`` :ref:`🔗<class_Camera2D_property_limit_right>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
右侧滚动极限,单位为像素。相机会在抵达该值时停止移动,但是 :ref:`offset<class_Camera2D_property_offset>` 可以把视图推过该极限。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_smoothed:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **limit_smoothed** = ``false`` :ref:`🔗<class_Camera2D_property_limit_smoothed>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit_smoothing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_limit_smoothing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,相机会在达到极限时平滑地停止。
|
||
|
||
如果 :ref:`position_smoothing_enabled<class_Camera2D_property_position_smoothing_enabled>` 为 ``false``\ ,则该属性无效。
|
||
|
||
\ **注意:**\ 要立即将相机的位置更新到限制范围内而不进行平滑,即使启用了该设置,也要调用 :ref:`reset_smoothing()<class_Camera2D_method_reset_smoothing>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_limit_top:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`int<class_int>` **limit_top** = ``-10000000`` :ref:`🔗<class_Camera2D_property_limit_top>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ )
|
||
- :ref:`int<class_int>` **get_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const|
|
||
|
||
顶部滚动极限,单位为像素。相机会在抵达该值时停止移动,但是 :ref:`offset<class_Camera2D_property_offset>` 可以把视图推过该极限。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_offset:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Vector2<class_Vector2>` **offset** = ``Vector2(0, 0)`` :ref:`🔗<class_Camera2D_property_offset>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_offset**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
||
- :ref:`Vector2<class_Vector2>` **get_offset**\ (\ )
|
||
|
||
相机的相对偏移量。用于环顾四周或相机抖动动画。偏移后的相机可以超过 :ref:`limit_top<class_Camera2D_property_limit_top>`\ 、\ :ref:`limit_bottom<class_Camera2D_property_limit_bottom>`\ 、\ :ref:`limit_left<class_Camera2D_property_limit_left>` 和 :ref:`limit_right<class_Camera2D_property_limit_right>` 中定义的限制。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_position_smoothing_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **position_smoothing_enabled** = ``false`` :ref:`🔗<class_Camera2D_property_position_smoothing_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_position_smoothing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_position_smoothing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,相机的视图会以 :ref:`position_smoothing_speed<class_Camera2D_property_position_smoothing_speed>` 的速度,平滑地移向其目标位置。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_position_smoothing_speed:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **position_smoothing_speed** = ``5.0`` :ref:`🔗<class_Camera2D_property_position_smoothing_speed>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_position_smoothing_speed**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_position_smoothing_speed**\ (\ )
|
||
|
||
当 :ref:`position_smoothing_enabled<class_Camera2D_property_position_smoothing_enabled>` 为 ``true`` 时,相机平滑效果的速度,单位为每秒像素。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_process_callback:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>` **process_callback** = ``1`` :ref:`🔗<class_Camera2D_property_process_callback>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_process_callback**\ (\ value\: :ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>`\ )
|
||
- :ref:`Camera2DProcessCallback<enum_Camera2D_Camera2DProcessCallback>` **get_process_callback**\ (\ )
|
||
|
||
相机的处理回调。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_rotation_smoothing_enabled:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`bool<class_bool>` **rotation_smoothing_enabled** = ``false`` :ref:`🔗<class_Camera2D_property_rotation_smoothing_enabled>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_rotation_smoothing_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
|
||
- :ref:`bool<class_bool>` **is_rotation_smoothing_enabled**\ (\ )
|
||
|
||
如果为 ``true``\ ,相机的视图会通过渐近平滑的方式平滑地旋转,以 :ref:`rotation_smoothing_speed<class_Camera2D_property_rotation_smoothing_speed>` 的速度与其目标旋转对齐。
|
||
|
||
\ **注意:**\ 如果 :ref:`ignore_rotation<class_Camera2D_property_ignore_rotation>` 为 ``true``\ ,则该属性无效。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_rotation_smoothing_speed:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`float<class_float>` **rotation_smoothing_speed** = ``5.0`` :ref:`🔗<class_Camera2D_property_rotation_smoothing_speed>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_rotation_smoothing_speed**\ (\ value\: :ref:`float<class_float>`\ )
|
||
- :ref:`float<class_float>` **get_rotation_smoothing_speed**\ (\ )
|
||
|
||
当 :ref:`rotation_smoothing_enabled<class_Camera2D_property_rotation_smoothing_enabled>` 为 ``true`` 时,相机旋转平滑效果的角度渐近速度。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_property_zoom:
|
||
|
||
.. rst-class:: classref-property
|
||
|
||
:ref:`Vector2<class_Vector2>` **zoom** = ``Vector2(1, 1)`` :ref:`🔗<class_Camera2D_property_zoom>`
|
||
|
||
.. rst-class:: classref-property-setget
|
||
|
||
- |void| **set_zoom**\ (\ value\: :ref:`Vector2<class_Vector2>`\ )
|
||
- :ref:`Vector2<class_Vector2>` **get_zoom**\ (\ )
|
||
|
||
相机的缩放。值越高,放大效果越明显。例如,\ ``Vector2(2.0, 2.0)`` 的缩放将在各个轴上放大两倍(视图覆盖的区域缩小四倍)。相反,\ ``Vector2(0.5, 0.5)`` 的缩放将在各个轴上缩小两倍(视图覆盖的区域扩大四倍)。X 和 Y 分量通常应始终设置为相同的值,除非你希望拉伸相机视图。
|
||
|
||
\ **注意:**\ :ref:`FontFile.oversampling<class_FontFile_property_oversampling>` *不会*\ 考虑 **Camera2D** 的缩放值。这意味着放大/缩小将导致位图字体和光栅化(非 MSDF)动态字体看起来模糊或像素化,除非字体是\ :ref:`CanvasLayer<class_CanvasLayer>`\ 的一部分从而使其忽略相机缩放。为了确保文本无论如何缩放都保持清晰,你可以通过启用 :ref:`ProjectSettings.gui/theme/default_font_multichannel_signed_distance_field<class_ProjectSettings_property_gui/theme/default_font_multichannel_signed_distance_field>` (仅适用于默认项目字体)来启用 MSDF 字体渲染,或在自定义字体的动态字体导入选项中启用\ **多通道带符号距离场**\ 。对于系统字体,可以在检查器中启用 :ref:`SystemFont.multichannel_signed_distance_field<class_SystemFont_property_multichannel_signed_distance_field>` 。
|
||
|
||
.. rst-class:: classref-section-separator
|
||
|
||
----
|
||
|
||
.. rst-class:: classref-descriptions-group
|
||
|
||
方法说明
|
||
--------
|
||
|
||
.. _class_Camera2D_method_align:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **align**\ (\ ) :ref:`🔗<class_Camera2D_method_align>`
|
||
|
||
将相机与跟踪的节点对齐。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_force_update_scroll:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **force_update_scroll**\ (\ ) :ref:`🔗<class_Camera2D_method_force_update_scroll>`
|
||
|
||
强制相机立即更新滚动。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_get_drag_margin:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`float<class_float>` **get_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| :ref:`🔗<class_Camera2D_method_get_drag_margin>`
|
||
|
||
返回指定边 :ref:`Side<enum_@GlobalScope_Side>` 的边距。另见 :ref:`drag_bottom_margin<class_Camera2D_property_drag_bottom_margin>`\ 、\ :ref:`drag_top_margin<class_Camera2D_property_drag_top_margin>`\ 、\ :ref:`drag_left_margin<class_Camera2D_property_drag_left_margin>` 和 :ref:`drag_right_margin<class_Camera2D_property_drag_right_margin>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_get_limit:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`int<class_int>` **get_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`\ ) |const| :ref:`🔗<class_Camera2D_method_get_limit>`
|
||
|
||
返回指定边 :ref:`Side<enum_@GlobalScope_Side>` 的相机极限。另见 :ref:`limit_bottom<class_Camera2D_property_limit_bottom>`\ 、\ :ref:`limit_top<class_Camera2D_property_limit_top>`\ 、\ :ref:`limit_left<class_Camera2D_property_limit_left>` 和 :ref:`limit_right<class_Camera2D_property_limit_right>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_get_screen_center_position:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2<class_Vector2>` **get_screen_center_position**\ (\ ) |const| :ref:`🔗<class_Camera2D_method_get_screen_center_position>`
|
||
|
||
返回该 **Camera2D** 视角下的屏幕中心位置,使用全局坐标。
|
||
|
||
\ **注意:**\ 相机实际的目标位置可能与此不同。见 :ref:`get_target_position()<class_Camera2D_method_get_target_position>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_get_screen_rotation:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`float<class_float>` **get_screen_rotation**\ (\ ) |const| :ref:`🔗<class_Camera2D_method_get_screen_rotation>`
|
||
|
||
从该相机的视角返回当前的屏幕旋转。
|
||
|
||
\ **注意:**\ 如果相机由于 :ref:`rotation_smoothing_enabled<class_Camera2D_property_rotation_smoothing_enabled>` 平滑旋转,则屏幕旋转可能与 :ref:`Node2D.global_rotation<class_Node2D_property_global_rotation>` 不同。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_get_target_position:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`Vector2<class_Vector2>` **get_target_position**\ (\ ) |const| :ref:`🔗<class_Camera2D_method_get_target_position>`
|
||
|
||
返回该相机的目标位置,使用全局坐标。
|
||
|
||
\ **注意:**\ 返回值与 :ref:`Node2D.global_position<class_Node2D_property_global_position>` 不同,因为会受到拖动属性的影响。如果 :ref:`position_smoothing_enabled<class_Camera2D_property_position_smoothing_enabled>` 为 ``true`` ,也不等同于当前位置(见 :ref:`get_screen_center_position()<class_Camera2D_method_get_screen_center_position>`\ )。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_is_current:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
:ref:`bool<class_bool>` **is_current**\ (\ ) |const| :ref:`🔗<class_Camera2D_method_is_current>`
|
||
|
||
如果该 **Camera2D** 为活动相机,则返回 ``true``\ (见 :ref:`Viewport.get_camera_2d()<class_Viewport_method_get_camera_2d>`\ )。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_make_current:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **make_current**\ (\ ) :ref:`🔗<class_Camera2D_method_make_current>`
|
||
|
||
强制该 **Camera2D** 成为当前的活动相机。\ :ref:`enabled<class_Camera2D_property_enabled>` 必须为 ``true``\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_reset_smoothing:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **reset_smoothing**\ (\ ) :ref:`🔗<class_Camera2D_method_reset_smoothing>`
|
||
|
||
将相机的位置立即设置为其当前平滑的目标位置。
|
||
|
||
当 :ref:`position_smoothing_enabled<class_Camera2D_property_position_smoothing_enabled>` 为 ``false`` 时,本方法无效。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_set_drag_margin:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_drag_margin**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, drag_margin\: :ref:`float<class_float>`\ ) :ref:`🔗<class_Camera2D_method_set_drag_margin>`
|
||
|
||
设置指定边 :ref:`Side<enum_@GlobalScope_Side>` 的边距。另见 :ref:`drag_bottom_margin<class_Camera2D_property_drag_bottom_margin>`\ 、\ :ref:`drag_top_margin<class_Camera2D_property_drag_top_margin>`\ 、\ :ref:`drag_left_margin<class_Camera2D_property_drag_left_margin>` 和 :ref:`drag_right_margin<class_Camera2D_property_drag_right_margin>`\ 。
|
||
|
||
.. rst-class:: classref-item-separator
|
||
|
||
----
|
||
|
||
.. _class_Camera2D_method_set_limit:
|
||
|
||
.. rst-class:: classref-method
|
||
|
||
|void| **set_limit**\ (\ margin\: :ref:`Side<enum_@GlobalScope_Side>`, limit\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Camera2D_method_set_limit>`
|
||
|
||
设置指定边 :ref:`Side<enum_@GlobalScope_Side>` 的相机极限。另见 :ref:`limit_bottom<class_Camera2D_property_limit_bottom>`\ 、\ :ref:`limit_top<class_Camera2D_property_limit_top>`\ 、\ :ref:`limit_left<class_Camera2D_property_limit_left>` 和 :ref:`limit_right<class_Camera2D_property_limit_right>`\ 。
|
||
|
||
.. |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 (无返回值。)`
|