summaryrefslogtreecommitdiff
path: root/doc/classes/Camera.xml
blob: 91c9ecc774665513109c0a4d2c96057468e97cdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
<?xml version="1.0" encoding="UTF-8" ?>
<class name="Camera" inherits="Spatial" category="Core" version="3.0-beta">
	<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>
	<demos>
	</demos>
	<methods>
		<method name="clear_current">
			<return type="void">
			</return>
			<description>
				If this is the current Camera, remove it from being current. If it is inside the node tree, request to make the next Camera current, if any.
			</description>
		</method>
		<method name="get_camera_transform" qualifiers="const">
			<return type="Transform">
			</return>
			<description>
				Get the camera transform. Subclassed cameras (such as CharacterCamera) may provide different transforms than the [Node] transform.
			</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.
			</description>
		</method>
		<method name="make_current">
			<return type="void">
			</return>
			<description>
				Make 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>
				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>
			<description>
				Returns how a 2D coordinate in the Viewport rectangle maps to a 3D point in worldspace.
			</description>
		</method>
		<method name="project_ray_normal" qualifiers="const">
			<return type="Vector3">
			</return>
			<argument index="0" name="screen_point" type="Vector2">
			</argument>
			<description>
				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>
				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>
		<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>
				Set 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>
				Set 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 how a 3D point in worldspace maps to a 2D coordinate in the [Viewport] rectangle.
			</description>
		</method>
	</methods>
	<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].
		</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">
			Set the [Environment] to use for this Camera.
		</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="h_offset" type="float" setter="set_h_offset" getter="get_h_offset">
			The horizontal (X) offset of the Camear viewport.
		</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.
		</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 horizontal (Y) offset of the Camear viewport.
		</member>
		<member name="vaspect" type="bool" setter="set_vaspect" getter="get_vaspect">
			A boolean representation of [member keep_aspect] in which [code]true[/code] is equivalent to [code]KEEP_WIDTH[/code].
		</member>
	</members>
	<constants>
		<constant name="PROJECTION_PERSPECTIVE" value="0" enum="Projection">
			Perspective Projection (object's size on the screen becomes smaller when far away).
		</constant>
		<constant name="PROJECTION_ORTHOGONAL" value="1" enum="Projection">
			Orthogonal Projection (objects remain the same size on the screen no matter how far away they are).
		</constant>
		<constant name="KEEP_WIDTH" value="0" enum="KeepAspect">
			Preserves the horizontal aspect ratio.
		</constant>
		<constant name="KEEP_HEIGHT" value="1" enum="KeepAspect">
			Preserves the vertical aspect ratio.
		</constant>
		<constant name="DOPPLER_TRACKING_DISABLED" value="0" enum="DopplerTracking">
			Disable Doppler effect simulation (default).
		</constant>
		<constant name="DOPPLER_TRACKING_IDLE_STEP" value="1" enum="DopplerTracking">
			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>
		<constant name="DOPPLER_TRACKING_PHYSICS_STEP" value="2" enum="DopplerTracking">
			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>