summaryrefslogtreecommitdiff
path: root/doc/classes/Camera.xml
blob: 5d6c13498cf60de582308af817fa26e168b60868 (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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<?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="get_cull_mask" qualifiers="const">
			<return type="int">
			</return>
			<description>
				Returns the culling mask, describing which 3D render layers are rendered by this Camera.
			</description>
		</method>
		<method name="get_doppler_tracking" qualifiers="const">
			<return type="int" enum="Camera.DopplerTracking">
			</return>
			<description>
			</description>
		</method>
		<method name="get_environment" qualifiers="const">
			<return type="Environment">
			</return>
			<description>
				Returns the [Environment] used by this Camera.
			</description>
		</method>
		<method name="get_fov" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the [i]FOV[/i] Y angle in degrees (FOV means Field of View).
			</description>
		</method>
		<method name="get_h_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the horizontal (X) offset of the Camera viewport.
			</description>
		</method>
		<method name="get_keep_aspect_mode" qualifiers="const">
			<return type="int" enum="Camera.KeepAspect">
			</return>
			<description>
				Returns the current mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
			</description>
		</method>
		<method name="get_projection" qualifiers="const">
			<return type="int" enum="Camera.Projection">
			</return>
			<description>
				Returns the Camera's projection. See PROJECTION_* constants.
			</description>
		</method>
		<method name="get_size" qualifiers="const">
			<return type="float">
			</return>
			<description>
			</description>
		</method>
		<method name="get_v_offset" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the vertical (Y) offset of the Camera viewport.
			</description>
		</method>
		<method name="get_zfar" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the far clip plane in world space units.
			</description>
		</method>
		<method name="get_znear" qualifiers="const">
			<return type="float">
			</return>
			<description>
				Returns the near clip plane in world space units.
			</description>
		</method>
		<method name="is_current" qualifiers="const">
			<return type="bool">
			</return>
			<description>
				Returns [code]true[/code] if the Camera is the current one in the [Viewport], or plans to become current (if outside the scene tree).
			</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>
			</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_cull_mask">
			<return type="void">
			</return>
			<argument index="0" name="mask" type="int">
			</argument>
			<description>
				Sets the cull mask, describing which 3D render layers are rendered by this Camera.
			</description>
		</method>
		<method name="set_doppler_tracking">
			<return type="void">
			</return>
			<argument index="0" name="mode" type="int" enum="Camera.DopplerTracking">
			</argument>
			<description>
				Changes Doppler effect tracking. See [code]DOPPLER_*[/code] constants.
			</description>
		</method>
		<method name="set_environment">
			<return type="void">
			</return>
			<argument index="0" name="env" type="Environment">
			</argument>
			<description>
				Sets the [Environment] to use for this Camera.
			</description>
		</method>
		<method name="set_h_offset">
			<return type="void">
			</return>
			<argument index="0" name="ofs" type="float">
			</argument>
			<description>
				Sets the horizontal (X) offset of the Camera viewport.
			</description>
		</method>
		<method name="set_keep_aspect_mode">
			<return type="void">
			</return>
			<argument index="0" name="mode" type="int" enum="Camera.KeepAspect">
			</argument>
			<description>
				Sets the mode for keeping the aspect ratio. See [code]KEEP_*[/code] constants.
			</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="set_v_offset">
			<return type="void">
			</return>
			<argument index="0" name="ofs" type="float">
			</argument>
			<description>
				Sets the vertical (Y) offset of the Camera viewport.
			</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>
	<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">
			Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's width by changing the height. Height is [code]sizey[/code] for orthographic projection, [code]fovy[/code] for perspective projection.
		</constant>
		<constant name="KEEP_HEIGHT" value="1" enum="KeepAspect">
			Try to keep the aspect ratio when scaling the Camera's viewport to the screen. If not possible, preserve the viewport's height by changing the width. Width is [code]sizex[/code] for orthographic projection, [code]fovx[/code] for perspective projection.
		</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>