Skip to content

Commit

Permalink
Various improvements to Camera2D's documentation
Browse files Browse the repository at this point in the history
A summary of the tweaked descriptions:
* "get_camera_position()" is explains what the camera position is, and mitigates the confusion between this method and Node2D.position;
* "get_camera_screen_center()" links to the "get_camera_position" method;
* "reset_smoothing()" links to the "smoothing_enabled" propriety;

* "drag_horizontal_offset" and "drag_vertical_offset" link to their respective _enabled_ properties;
* "limit_smoothed" links to the "smoothing_enabled" propriety;
* "rotating" clarifies that the camera _view_ rotates when enabled.

Partially closes godotengine/godot-docs#5417, as some of the issues described are no longer present in 4.0, or are not fully solved in this PR.

Further tweaks are welcome, as I'm afraid this could be a too verbose. A few of these could be split into their PR if necessary.

(cherry picked from commit 6cf2623)
  • Loading branch information
Mickeon authored and akien-mga committed Dec 21, 2021
1 parent f874df5 commit 9fc2bc6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions doc/classes/Camera2D.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
<method name="get_camera_position" qualifiers="const">
<return type="Vector2" />
<description>
Returns the camera position.
Returns the camera's [code]position[/code] (the tracked point the camera attempts to follow), relative to the origin.
[b]Note:[/b] The returned value is not the same as [member Node2D.position] or [member Node2D.global_position], as it is affected by the [code]drag[/code] properties.
</description>
</method>
<method name="get_camera_screen_center" qualifiers="const">
<return type="Vector2" />
<description>
Returns the location of the [Camera2D]'s screen-center, relative to the origin.
[b]Note:[/b] The real [code]position[/code] of the camera may be different, see [method get_camera_position].
</description>
</method>
<method name="get_drag_margin" qualifiers="const">
Expand All @@ -68,7 +70,7 @@
<return type="void" />
<description>
Sets the camera's position immediately to its current smoothing destination.
This has no effect if smoothing is disabled.
This method has no effect if [member smoothing_enabled] is [code]false[/code].
</description>
</method>
<method name="set_drag_margin">
Expand Down Expand Up @@ -136,7 +138,7 @@
</member>
<member name="limit_smoothed" type="bool" setter="set_limit_smoothing_enabled" getter="is_limit_smoothing_enabled" default="false">
If [code]true[/code], the camera smoothly stops when reaches its limits.
This has no effect if smoothing is disabled.
This property has no effect if [member smoothing_enabled] is [code]false[/code].
[b]Note:[/b] To immediately update the camera's position to be within limits without smoothing, even with this setting enabled, invoke [method reset_smoothing].
</member>
<member name="limit_top" type="int" setter="set_limit" getter="get_limit" default="-10000000">
Expand All @@ -157,7 +159,7 @@
The camera's process callback. See [enum Camera2DProcessMode].
</member>
<member name="rotating" type="bool" setter="set_rotating" getter="is_rotating" default="false">
If [code]true[/code], the camera rotates with the target.
If [code]true[/code], the camera view rotates with the target.
</member>
<member name="smoothing_enabled" type="bool" setter="set_enable_follow_smoothing" getter="is_follow_smoothing_enabled" default="false">
If [code]true[/code], the camera smoothly moves towards the target at [member smoothing_speed].
Expand Down

0 comments on commit 9fc2bc6

Please sign in to comment.