godot/doc/classes/Camera.xml

229 lines
11 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" ?>
2019-04-01 18:33:56 +08:00
<class name="Camera" inherits="Spatial" category="Core" version="3.2">
<brief_description>
Camera node, displays from a point of view.
</brief_description>
<description>
Camera is a special node that displays what is visible from its current location. Cameras register themselves in the nearest [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 [i]3D[/i] display capabilities to a [Viewport], and, without one, a scene registered in that [Viewport] (or higher viewports) can't be displayed.
</description>
<tutorials>
</tutorials>
<methods>
<method name="clear_current">
<return type="void">
</return>
2018-04-10 16:12:42 +08:00
<argument index="0" name="enable_next" type="bool" default="true">
</argument>
<description>
2019-04-17 19:42:56 +08:00
If this is the current Camera, remove it from being current. If [code]enable_next[/code] is [code]true[/code], request to make the next Camera current, if any.
</description>
</method>
2019-05-29 00:08:13 +08:00
<method name="get_camera_rid" qualifiers="const">
<return type="RID">
</return>
<description>
Returns the camera's RID from the [VisualServer].
</description>
</method>
<method name="get_camera_transform" qualifiers="const">
<return type="Transform">
</return>
<description>
Gets the camera transform. Subclassed cameras (such as CharacterCamera) may provide different transforms than the [Node] transform.
</description>
</method>
2018-08-21 06:35:30 +08:00
<method name="get_cull_mask_bit" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="layer" type="int">
</argument>
<description>
</description>
</method>
2019-02-10 20:01:03 +08:00
<method name="get_frustum" qualifiers="const">
<return type="Array">
</return>
<description>
</description>
</method>
<method name="is_position_behind" qualifiers="const">
<return type="bool">
</return>
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
Returns [code]true[/code] if the given position is behind the Camera. Note that a position which returns [code]false[/code] may still be outside the Camera's field of view.
</description>
</method>
<method name="make_current">
<return type="void">
</return>
<description>
Makes this camera the current Camera for the [Viewport] (see class description). If the Camera Node is outside the scene tree, it will attempt to become current once it's added.
</description>
</method>
<method name="project_local_ray_normal" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
2017-12-07 14:31:03 +08:00
Returns a normal vector from the screen point location directed along the camera. Orthogonal cameras are normalized. Perspective cameras account for perspective, screen width/height, etc.
</description>
</method>
<method name="project_position" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="screen_point" type="Vector2">
</argument>
<argument index="1" name="z_depth" type="float" default="0">
</argument>
<description>
Returns the 3D point in worldspace that maps to the given 2D coordinate in the [Viewport] rectangle on a plane that is the given distance into the scene away from the camera.
</description>
</method>
<method name="project_ray_normal" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
2017-10-08 00:12:47 +08:00
Returns a normal vector in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
<method name="project_ray_origin" qualifiers="const">
<return type="Vector3">
</return>
<argument index="0" name="screen_point" type="Vector2">
</argument>
<description>
2017-10-08 00:12:47 +08:00
Returns a 3D position in worldspace, that is the result of projecting a point on the [Viewport] rectangle by the camera projection. This is useful for casting rays in the form of (origin, normal) for object intersection or picking.
</description>
</method>
2018-08-21 06:35:30 +08:00
<method name="set_cull_mask_bit">
<return type="void">
</return>
<argument index="0" name="layer" type="int">
</argument>
<argument index="1" name="enable" type="bool">
</argument>
<description>
</description>
</method>
<method name="set_frustum">
<return type="void">
</return>
<argument index="0" name="size" type="float">
</argument>
<argument index="1" name="offset" type="Vector2">
</argument>
<argument index="2" name="z_near" type="float">
</argument>
<argument index="3" name="z_far" type="float">
</argument>
<description>
</description>
</method>
<method name="set_orthogonal">
<return type="void">
</return>
<argument index="0" name="size" type="float">
</argument>
<argument index="1" name="z_near" type="float">
</argument>
<argument index="2" name="z_far" type="float">
</argument>
<description>
Sets the camera projection to orthogonal mode, by specifying a width and the [i]near[/i] and [i]far[/i] clip planes in worldspace units. (As a hint, 2D games often use this projection, with values specified in pixels)
</description>
</method>
<method name="set_perspective">
<return type="void">
</return>
<argument index="0" name="fov" type="float">
</argument>
<argument index="1" name="z_near" type="float">
</argument>
<argument index="2" name="z_far" type="float">
</argument>
<description>
Sets the camera projection to perspective mode, by specifying a [i]FOV[/i] Y angle in degrees (FOV means Field of View), and the [i]near[/i] and [i]far[/i] clip planes in worldspace units.
</description>
</method>
<method name="unproject_position" qualifiers="const">
<return type="Vector2">
</return>
<argument index="0" name="world_point" type="Vector3">
</argument>
<description>
Returns the 2D coordinate in the [Viewport] rectangle that maps to the given 3D point in worldspace.
</description>
</method>
</methods>
2017-12-07 14:31:03 +08:00
<members>
<member name="cull_mask" type="int" setter="set_cull_mask" getter="get_cull_mask">
The culling mask that describes which 3D render layers are rendered by this camera.
</member>
<member name="current" type="bool" setter="set_current" getter="is_current">
If [code]true[/code], the ancestor [Viewport] is currently using this Camera. Default value: [code]false[/code].
2017-12-07 14:31:03 +08:00
</member>
<member name="doppler_tracking" type="int" setter="set_doppler_tracking" getter="get_doppler_tracking" enum="Camera.DopplerTracking">
If not [code]DOPPLER_TRACKING_DISABLED[/code] this Camera will simulate the Doppler effect for objects changed in particular [code]_process[/code] methods. Default value: [code]DOPPLER_TRACKING_DISABLED[/code].
</member>
<member name="environment" type="Environment" setter="set_environment" getter="get_environment">
The [Environment] to use for this Camera.
2017-12-07 14:31:03 +08:00
</member>
<member name="far" type="float" setter="set_zfar" getter="get_zfar">
The distance to the far culling boundary for this Camera relative to its local z-axis.
</member>
<member name="fov" type="float" setter="set_fov" getter="get_fov">
The camera's field of view angle (in degrees). Only applicable in perspective mode. Since [member keep_aspect] locks one axis, [code]fov[/code] sets the other axis' field of view angle.
</member>
<member name="frustum_offset" type="Vector2" setter="set_frustum_offset" getter="get_frustum_offset">
</member>
2017-12-07 14:31:03 +08:00
<member name="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
2018-03-03 00:20:14 +08:00
The horizontal (X) offset of the Camera viewport.
2017-12-07 14:31:03 +08:00
</member>
<member name="keep_aspect" type="int" setter="set_keep_aspect_mode" getter="get_keep_aspect_mode" enum="Camera.KeepAspect">
The axis to lock during [member fov]/[member size] adjustments. Can be either [code]KEEP_WIDTH[/code] or [code]KEEP_HEIGHT[/code].
2017-12-07 14:31:03 +08:00
</member>
<member name="near" type="float" setter="set_znear" getter="get_znear">
The distance to the near culling boundary for this Camera relative to its local z-axis.
</member>
<member name="projection" type="int" setter="set_projection" getter="get_projection" enum="Camera.Projection">
The camera's projection mode. In [code]PROJECTION_PERSPECTIVE[/code] mode, objects' z-distance from the camera's local space scales their perceived size.
</member>
<member name="size" type="float" setter="set_size" getter="get_size">
The camera's size measured as 1/2 the width or height. Only applicable in orthogonal mode. Since [member keep_aspect] locks on axis, [code]size[/code] sets the other axis' size length.
</member>
<member name="v_offset" type="float" setter="set_v_offset" getter="get_v_offset">
The vertical (Y) offset of the Camera viewport.
2017-12-07 14:31:03 +08:00
</member>
</members>
<constants>
2017-11-25 06:16:30 +08:00
<constant name="PROJECTION_PERSPECTIVE" value="0" enum="Projection">
Perspective Projection (object's size on the screen becomes smaller when far away).
</constant>
2017-11-25 06:16:30 +08:00
<constant name="PROJECTION_ORTHOGONAL" value="1" enum="Projection">
2019-05-01 04:32:02 +08:00
Orthogonal Projection (objects remain the same size on the screen no matter how far away they are; also known as orthographic projection).
</constant>
<constant name="PROJECTION_FRUSTUM" value="2" enum="Projection">
</constant>
2017-11-25 06:16:30 +08:00
<constant name="KEEP_WIDTH" value="0" enum="KeepAspect">
2017-12-07 14:31:03 +08:00
Preserves the horizontal aspect ratio.
</constant>
2017-11-25 06:16:30 +08:00
<constant name="KEEP_HEIGHT" value="1" enum="KeepAspect">
2017-12-07 14:31:03 +08:00
Preserves the vertical aspect ratio.
</constant>
2017-11-25 06:16:30 +08:00
<constant name="DOPPLER_TRACKING_DISABLED" value="0" enum="DopplerTracking">
2017-10-08 00:12:47 +08:00
Disable Doppler effect simulation (default).
</constant>
2017-11-25 06:16:30 +08:00
<constant name="DOPPLER_TRACKING_IDLE_STEP" value="1" enum="DopplerTracking">
2017-10-08 00:12:47 +08:00
Simulate Doppler effect by tracking positions of objects that are changed in [code]_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]).
</constant>
2017-11-25 06:16:30 +08:00
<constant name="DOPPLER_TRACKING_PHYSICS_STEP" value="2" enum="DopplerTracking">
2017-10-08 00:12:47 +08:00
Simulate Doppler effect by tracking positions of objects that are changed in [code]_physics_process[/code]. Changes in the relative velocity of this Camera compared to those objects affect how Audio is perceived (changing the Audio's [code]pitch shift[/code]).
</constant>
</constants>
</class>