Aego Русский

Camera 3D

Renders a perspective view looking down the node -Z axis.

component engine.Camera3D
On this page

Usage

Add it with Create → Camera → Camera.

Try it

Camera 3D field of view

The camera looks at three meshes. A narrower field of view changes their apparent size and framing.

Change FOV from 70 to 40 degrees and watch the Game View; Reset restores the original view.

Starts the scene; open the example parameters to experiment.
Open in AegoDownload example project
Scene5 nodes
Camera
position[0, 2.5, 7]rotation[-0.17365, 0, 0, 0.98481]scale[1, 1, 1]
Camera 3D
fovfloat70clearColorColor#111827ffactivebooltrue
Cube
position[-2, 0.5, 0]rotation[0, 0.38268, 0, 0.92388]scale[1, 1, 1]
Mesh Renderer
meshMeshasset("ae900000000000000000000000000001")colorColor#e07b39ff
Sphere
position[0, 0.75, 0]rotation[0, 0, 0, 1]scale[1.5, 1.5, 1.5]
Mesh Renderer
meshMeshasset("ae900000000000000000000000000003")colorColor#4aa3ffff
Cylinder
position[2, 0.75, 0]rotation[0, 0, 0, 1]scale[1, 1.5, 1]
Mesh Renderer
meshMeshasset("ae900000000000000000000000000004")colorColor#6fcf97ff
Floor
position[0, 0, 0]rotation[0, 0, 0, 1]scale[10, 1, 10]
Mesh Renderer
meshMeshasset("ae900000000000000000000000000002")colorColor#4b5563ff

Fields

NameTypeDefaultDescription
Fovfloat60

Vertical field of view in degrees.

1 – 179 deg
Nearfloat0.1

Distance to the near clipping plane.

≥ 0.001
Farfloat1000

Distance to the far clipping plane.

≥ 0.01
ViewportRect(0, 0, 1, 1)

Part of the screen the camera draws into, in normalized coordinates.

Maskint-1

Visibility layers this camera renders. -1 renders every layer.

Orderint0

Cameras with a lower order render first.

Clearbooltrue

Clears the viewport before drawing.

Clear ColorColorrgba(0.04, 0.05, 0.07, 1)

Background color used when clear is on.

Activebooltrue

Only active cameras render.

Orthographicboolfalse

Projects without perspective; sprites and meshes keep their size at any depth.

Ortho Sizefloat5

Half of the vertical extent in world units when orthographic is on.

≥ 0.01

From a script

Widen the field of view while sprinting.

package game

import "aego/math"

script SprintFov {
    var Walk float = 60
    var Sprint float = 75
    var Sprinting bool

    func Update(dt float) {
        cam := node.Get<Camera3D>()
        target := Walk
        if Sprinting {
            target = Sprint
        }
        cam.Fov = math.Lerp(cam.Fov, target, math.Clamp(dt*4, 0, 1))
    }
}