Search Results for

    Show / Hide Table of Contents

    Class Camera

    Describes the camera projection and view. Provides information about how to render scene (viewport location and direction, etc.).

    Inheritance
    System.Object
    Object
    SceneObject
    Actor
    Camera
    Implements
    ISerializable
    Inherited Members
    Actor.SetLayerRecursive(Int32)
    Actor.SetLayerNameRecursive(String)
    Actor.HasTag()
    Actor.HasTag(Tag)
    Actor.HasTag(String)
    Actor.AddTag(Tag)
    Actor.AddTagRecursive(Tag)
    Actor.RemoveTag(Tag)
    Actor.SetParent(Actor, Boolean, Boolean)
    Actor.GetChild(Int32)
    Actor.GetChild(String)
    Actor.GetChild(Type)
    Actor.GetChildren(Type)
    Actor.DestroyChildren(Single)
    Actor.GetScript(Int32)
    Actor.GetScript(Type)
    Actor.GetScripts(Type)
    Actor.AddMovement(Vector3)
    Actor.AddMovement(Vector3, Quaternion)
    Actor.GetWorldToLocalMatrix(Matrix)
    Actor.GetLocalToWorldMatrix(Matrix)
    Actor.OnDebugDraw()
    Actor.OnDebugDrawSelected()
    Actor.GetPrefabRoot()
    Actor.FindActor(String)
    Actor.FindActor(Type, Boolean)
    Actor.FindActor(Type, String)
    Actor.FindActor(Type, Tag, Boolean)
    Actor.FindScript(Type)
    Actor.HasActorInHierarchy(Actor)
    Actor.HasActorInChildren(Actor)
    Actor.IntersectsItself(Ray, Single, Vector3)
    Actor.Intersects(Ray, Single, Vector3)
    Actor.LookAt(Vector3)
    Actor.LookAt(Vector3, Vector3)
    Actor.LookingAt(Vector3)
    Actor.LookingAt(Vector3, Vector3)
    Actor.ToBytes(Actor[])
    Actor.FromBytes(Byte[])
    Actor.FromBytes(Byte[], Dictionary<Guid, Guid>)
    Actor.TryGetSerializedObjectsIds(Byte[])
    Actor.ToJson()
    Actor.FromJson(String)
    Actor.Clone()
    Actor.OnEnable()
    Actor.OnDisable()
    Actor.OnParentChanged()
    Actor.OnTransformChanged()
    Actor.OnActiveChanged()
    Actor.OnActiveInTreeChanged()
    Actor.OnOrderInParentChanged()
    Actor.OnStaticFlagsChanged()
    Actor.OnLayerChanged()
    Actor.OnBeginPlay()
    Actor.OnEndPlay()
    Actor.AddStaticFlags(StaticFlags)
    Actor.RemoveStaticFlags(StaticFlags)
    Actor.SetStaticFlag(StaticFlags, Boolean)
    Actor.HasStaticFlag(StaticFlags)
    Actor.ResetLocalTransform()
    Actor.AddChild(Type)
    Actor.AddChild<T>()
    Actor.GetChild<T>()
    Actor.TryGetChild<T>(T)
    Actor.GetOrAddChild<T>()
    Actor.AddScript(Type)
    Actor.AddScript<T>()
    Actor.GetScript<T>()
    Actor.TryGetScript<T>(T)
    Actor.FindScript<T>()
    Actor.FindActor<T>(Boolean)
    Actor.FindActor<T>(String)
    Actor.FindActor<T>(Tag, Boolean)
    Actor.GetChildren<T>()
    Actor.GetScripts<T>()
    Actor.RotateAround(Vector3, Vector3, Single, Boolean)
    Actor.ToString()
    Actor.Children
    Actor.Tags
    Actor.Layer
    Actor.Name
    Actor.IsActive
    Actor.StaticFlags
    Actor.PerInstanceRandom
    Actor.LocalPosition
    Actor.LocalOrientation
    Actor.LocalScale
    Actor.Sphere
    Actor.Box
    Actor.BoxWithChildren
    Actor.EditorBox
    Actor.EditorBoxChildren
    Actor.HasContentLoaded
    Actor.IsPrefabRoot
    Actor.IsStatic
    Actor.IsTransformStatic
    Actor.WorldToLocalMatrix
    Actor.LocalToWorldMatrix
    SceneObject.SetParent(Actor, Boolean)
    SceneObject.LinkPrefab(Guid, Guid)
    SceneObject.BreakPrefabLink()
    SceneObject.GetNamePath(Char)
    SceneObject.IsDuringPlay
    SceneObject.HasParent
    SceneObject.HasPrefabLink
    SceneObject.PrefabID
    SceneObject.PrefabObjectID
    Object.__unmanagedPtr
    Object.__internalId
    Object.Finalize()
    Object.As<T>()
    Object.NewValue(Type)
    Object.New(String)
    Object.Find<T>(Guid, Boolean)
    Object.Find(Guid, Type, Boolean)
    Object.TryFind<T>(Guid)
    Object.TryFind(Guid, Type)
    Object.Destroy(Object, Single)
    Object.DestroyNow(Object)
    Object.Destroy<T>(T, Single)
    Object.Equals(Object)
    Object.GetUnmanagedPtr(Object)
    Object.GetUnmanagedInterface(Object, Type)
    Object.FromUnmanagedPtr(IntPtr)
    Object.MapObjectID(Guid)
    Object.RemapObjectID(Guid)
    Object.GetHashCode()
    Object.ID
    Object.TypeName
    Namespace: FlaxEngine
    Assembly: FlaxEngine.CSharp.dll
    Syntax
    [ActorContextMenu("New/Camera")]
    [ActorToolbox("Visuals")]
    [Unmanaged]
    public sealed class Camera : Actor, ISerializable

    Constructors

    Camera()

    Initializes a new instance of the Camera.

    Declaration
    public Camera()

    Properties

    CustomAspectRatio

    Gets or sets the custom aspect ratio. 0 if not use custom value.

    Declaration
    [EditorOrder(50)]
    [Limit(0F, 10F, 0.01F)]
    [EditorDisplay("Camera", null)]
    [Unmanaged]
    public float CustomAspectRatio { get; set; }
    Property Value
    System.Single

    FarPlane

    Gets or sets camera's far plane distance.

    Declaration
    [EditorOrder(40)]
    [Limit(0F, 3.40282347E+38F, 5F)]
    [EditorDisplay("Camera", null)]
    [ValueCategory]
    [Unmanaged]
    public float FarPlane { get; set; }
    Property Value
    System.Single

    FieldOfView

    Gets or sets the camera's field of view (in degrees).

    Declaration
    [EditorOrder(20)]
    [Limit(0F, 179F, 1F)]
    [EditorDisplay("Camera", "Field Of View")]
    [VisibleIf("UsePerspective", false)]
    [ValueCategory]
    [Unmanaged]
    public float FieldOfView { get; set; }
    Property Value
    System.Single

    Frustum

    Gets the frustum.

    Declaration
    [Unmanaged]
    public BoundingFrustum Frustum { get; }
    Property Value
    BoundingFrustum

    MainCamera

    Gets the main camera.

    Declaration
    [Unmanaged]
    public static Camera MainCamera { get; }
    Property Value
    Camera

    NearPlane

    Gets or sets camera's near plane distance.

    Declaration
    [EditorOrder(30)]
    [Limit(0F, 1000F, 0.05F)]
    [EditorDisplay("Camera", null)]
    [ValueCategory]
    [Unmanaged]
    public float NearPlane { get; set; }
    Property Value
    System.Single

    OrthographicScale

    Gets or sets the orthographic projection scale.

    Declaration
    [EditorOrder(60)]
    [Limit(0.0001F, 1000F, 0.01F)]
    [EditorDisplay("Camera", null)]
    [VisibleIf("UsePerspective", true)]
    [Unmanaged]
    public float OrthographicScale { get; set; }
    Property Value
    System.Single

    OrthographicSize

    Gets or sets the orthographic projection view height (width is based on the aspect ratio). Use 0 for size to be based on the viewport size.

    Declaration
    [EditorOrder(59)]
    [Limit(0F, 3.40282347E+38F, 1F)]
    [EditorDisplay("Camera", null)]
    [VisibleIf("UsePerspective", true)]
    [Unmanaged]
    public float OrthographicSize { get; set; }
    Property Value
    System.Single

    OverrideMainCamera

    The overriden main camera.

    Declaration
    [Unmanaged]
    public static Camera OverrideMainCamera { get; set; }
    Property Value
    Camera

    RenderFlags

    Frame rendering flags used to switch between graphics features for this camera.

    Declaration
    [EditorOrder(110)]
    [EditorDisplay("Camera", null)]
    [Unmanaged]
    public ViewFlags RenderFlags { get; set; }
    Property Value
    ViewFlags

    RenderLayersMask

    The layers mask used for rendering using this camera. Can be used to include or exclude specific actor layers from the drawing.

    Declaration
    [EditorOrder(100)]
    [EditorDisplay("Camera", null)]
    [Unmanaged]
    public LayersMask RenderLayersMask { get; set; }
    Property Value
    LayersMask

    RenderMode

    Describes frame rendering modes for this camera.

    Declaration
    [EditorOrder(120)]
    [EditorDisplay("Camera", null)]
    [Unmanaged]
    public ViewMode RenderMode { get; set; }
    Property Value
    ViewMode

    UsePerspective

    Gets or sets the value indicating if camera should use perspective rendering mode, otherwise it will use orthographic projection.

    Declaration
    [EditorOrder(10)]
    [EditorDisplay("Camera", null)]
    [Unmanaged]
    public bool UsePerspective { get; set; }
    Property Value
    System.Boolean

    Viewport

    Gets the camera viewport.

    Declaration
    [Unmanaged]
    public Viewport Viewport { get; }
    Property Value
    Viewport

    Methods

    ConvertMouseToRay(Float2)

    Converts the mouse position to 3D ray.

    Declaration
    [Unmanaged]
    public Ray ConvertMouseToRay(Float2 mousePosition)
    Parameters
    Float2 mousePosition

    The mouse position.

    Returns
    Ray

    Mouse ray

    ConvertMouseToRay(Float2, ref Viewport)

    Converts the mouse position to 3D ray.

    Declaration
    [Unmanaged]
    public Ray ConvertMouseToRay(Float2 mousePosition, ref Viewport viewport)
    Parameters
    Float2 mousePosition

    The mouse position.

    Viewport viewport

    The viewport.

    Returns
    Ray

    Mouse ray

    GetMatrices(out Matrix, out Matrix)

    Calculates the view and the projection matrices for the camera.

    Declaration
    [Unmanaged]
    public void GetMatrices(out Matrix view, out Matrix projection)
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    GetMatrices(out Matrix, out Matrix, ref Viewport)

    Calculates the view and the projection matrices for the camera. Support using custom viewport.

    Declaration
    [Unmanaged]
    public void GetMatrices(out Matrix view, out Matrix projection, ref Viewport viewport)
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    Viewport viewport

    The custom output viewport.

    GetMatrices(out Matrix, out Matrix, ref Viewport, ref Vector3)

    Calculates the view and the projection matrices for the camera. Support using custom viewport and view origin.

    Declaration
    [Unmanaged]
    public void GetMatrices(out Matrix view, out Matrix projection, ref Viewport viewport, ref Vector3 origin)
    Parameters
    Matrix view

    The result camera view matrix.

    Matrix projection

    The result camera projection matrix.

    Viewport viewport

    The custom output viewport.

    Vector3 origin

    The rendering view origin (for relative-to-camera rendering).

    IntersectsItselfEditor(ref Ray, out Single)

    Intersection check for editor picking the camera

    Declaration
    [Unmanaged]
    public bool IntersectsItselfEditor(ref Ray ray, out float distance)
    Parameters
    Ray ray

    System.Single distance

    Returns
    System.Boolean

    IsPointOnView(Vector3)

    Checks if the 3d point of the world is in the camera's field of view.

    Declaration
    [Unmanaged]
    public bool IsPointOnView(Vector3 worldSpaceLocation)
    Parameters
    Vector3 worldSpaceLocation

    World Position (XYZ).

    Returns
    System.Boolean

    Returns true if the point is within the field of view.

    ProjectPoint(Vector3, out Float2)

    Projects the point from 3D world-space to game window coordinates (in screen pixels for default viewport calculated from Viewport).

    Declaration
    [Unmanaged]
    public void ProjectPoint(Vector3 worldSpaceLocation, out Float2 gameWindowSpaceLocation)
    Parameters
    Vector3 worldSpaceLocation

    The input world-space location (XYZ in world).

    Float2 gameWindowSpaceLocation

    The output game window coordinates (XY in screen pixels).

    ProjectPoint(Vector3, out Float2, ref Viewport)

    Projects the point from 3D world-space to the camera viewport-space (in screen pixels for given viewport).

    Declaration
    [Unmanaged]
    public void ProjectPoint(Vector3 worldSpaceLocation, out Float2 cameraViewportSpaceLocation, ref Viewport viewport)
    Parameters
    Vector3 worldSpaceLocation

    The input world-space location (XYZ in world).

    Float2 cameraViewportSpaceLocation

    The output camera viewport-space location (XY in screen pixels).

    Viewport viewport

    The viewport.

    UnprojectPoint(Float2, Single, out Vector3)

    Converts a game window-space point into a corresponding point in world space.

    Declaration
    [Unmanaged]
    public void UnprojectPoint(Float2 gameWindowSpaceLocation, float depth, out Vector3 worldSpaceLocation)
    Parameters
    Float2 gameWindowSpaceLocation

    The input game window coordinates (XY in screen pixels).

    System.Single depth

    The input camera-relative depth position (eg. clipping plane).

    Vector3 worldSpaceLocation

    The output world-space location (XYZ in world).

    UnprojectPoint(Float2, Single, out Vector3, ref Viewport)

    Converts a camera viewport-space point into a corresponding point in world space.

    Declaration
    [Unmanaged]
    public void UnprojectPoint(Float2 cameraViewportSpaceLocation, float depth, out Vector3 worldSpaceLocation, ref Viewport viewport)
    Parameters
    Float2 cameraViewportSpaceLocation

    The input camera viewport-space location (XY in screen pixels).

    System.Single depth

    The input camera-relative depth position (eg. clipping plane).

    Vector3 worldSpaceLocation

    The output world-space location (XYZ in world).

    Viewport viewport

    The viewport.

    Extension Methods

    Extensions.ReflectiveCompare<T>(T, T)
    Extensions.DeepClone<T>(T)
    Extensions.RawClone<T>(T)
    In This Article
    Back to top Copyright © 2012-2024 Wojciech Figat