Camera3D
- Game Development course
- Intermediate
- Lesson 62/83
- 4 min
Learn the Camera3D node and viewpoint.
Camera3D Node and its Purpose
In Godot 3D scenes, the Camera3D node determines the viewpoint through which the player observes the world. Multiple cameras can exist in a scene, but for a camera to actively render its view to the viewport, its Current property must be true.
Camera3D cam = new Camera3D();
cam.Current = true;Field of View (FOV) and Projection
The Camera3D node supports two primary projection modes: perspective and orthogonal. In perspective mode, the Fov (Field of View) property sets the camera's viewing angle in degrees (such as 70 or 90). Wider angles display more scenery while narrower angles create a zoom effect.
cam.Fov = 75.0f;
GD.Print("Field of view: " + cam.Fov);Practice Enable Camera and Read Fov
Set cam.Current to true and then print the field of view with GD.Print("Kamera Fov: " + cam.Fov);.
Starter code
using System;
public class Camera3D
{
public bool Current { get; set; } = false;
public float Fov { get; set; } = 70f;
}
public static class GD
{
public static void Print(object message) => Console.WriteLine(message);
}
public class Program
{
public static void Main()
{
Camera3D cam = new Camera3D();
// Kamerayi aktif yap ve gorus acisini yazdir
}
}Sample solution
using System;
public class Camera3D
{
public bool Current { get; set; } = false;
public float Fov { get; set; } = 70f;
}
public static class GD
{
public static void Print(object message) => Console.WriteLine(message);
}
public class Program
{
public static void Main()
{
Camera3D cam = new Camera3D();
cam.Current = true;
GD.Print("Kamera Fov: " + cam.Fov);
}
}Expected output
Kamera Fov: 70
Questions and answers
Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.
1 Which property must be set to true for a Camera3D node to actively render the scene to the screen in Godot?
- Enabled
- Active
- Current Correct answer
- Visible
Explanation: In Godot, the Current property must be true for Camera3D to project its view onto the screen.
2 Set Active Camera
kamera.____ = true;
kamera.Current = true;
Explanation: The Current property is used to make the camera the primary view source of the scene.
3 Camera Properties Matching
| Term | Meaning |
|---|---|
Camera3D |
Renders 3D scene to player screen |
Current |
Camera being active view source |
Fov |
Field of view angle in degrees |
Perspective |
Projection mode with realistic depth |