Camera

class in UnityEngine

/

Hereda de:Behaviour

Cambiar al Manual

Descripción

Una cámara es un dispositivo mediante el cual el jugador ve el mundo.

A screen space point is defined in pixels. The bottom-left of the screen is (0,0); the right-top is (pixelWidth,pixelHeight). The z position is in world units from the Camera.

A viewport space point is normalized and relative to the Camera. The bottom-left of the Camera is (0,0); the top-right is (1,1). The z position is in world units from the Camera.

A world space point is defined in global coordinates (for example, Transform.position).

Note that a class must not inherit from Camera directly. If you need to inherit from Camera see ScriptableCamera.

See Also: camera component.

Variables Estáticas

allCamerasReturns all enabled cameras in the Scene.
allCamerasCountThe number of cameras in the current Scene.
currentThe camera we are currently rendering with, for low-level render control only (Read Only).
mainThe first enabled camera tagged "MainCamera" (Read Only).
onPostRenderEvent that is fired after any camera finishes rendering.
onPreCullOnPreRender se llama antes de que la cámara comience a renderizar la escena.
onPreRenderOnPreRender se llama antes de que la cámara comience a renderizar la escena.

Variables

activeTextureGets the temporary RenderTexture target for this Camera.
actualRenderingPathThe rendering path that is currently being used (Read Only).
allowDynamicResolutionDynamic Resolution Scaling.
allowHDRHigh dynamic range rendering.
allowMSAAMSAA rendering.
areVRStereoViewMatricesWithinSingleCullToleranceDetermines whether the stereo view matrices are suitable to allow for a single pass cull.
aspectThe aspect ratio (width divided by height).
backgroundColorThe color with which the screen will be cleared.
cameraToWorldMatrixMatrix that transforms from camera space to world space (Read Only).
cameraTypeIdentifies what kind of camera this is.
clearFlagsHow the camera clears the background.
clearStencilAfterLightingPassShould the camera clear the stencil buffer after the deferred light pass?
commandBufferCountNumber of command buffers set up on this camera (Read Only).
cullingMaskThis is used to render parts of the Scene selectively.
cullingMatrixSets a custom matrix for the camera to use for all culling queries.
depthCamera's depth in the camera rendering order.
depthTextureModeHow and if camera generates a depth texture.
eventMaskMask to select which layers can trigger events on the camera.
farClipPlaneThe far clipping plane distance.
fieldOfViewThe field of view of the camera in degrees.
focalLengthThe camera focal length, expressed in millimeters. To use this property, enable UsePhysicalProperties.
forceIntoRenderTextureShould camera rendering be forced into a RenderTexture.
gateFitThere are two gates for a camera, the sensor gate and the resolution gate. The physical camera sensor gate is defined by the sensorSize property, the resolution gate is defined by the render target area.
layerCullDistancesPer-layer culling distances.
layerCullSphericalHow to perform per-layer culling for a Camera.
lensShiftThe lens offset of the camera. The lens shift is relative to the sensor size. For example, a lens shift of 0.5 offsets the sensor by half its horizontal size.
nearClipPlaneThe near clipping plane distance.
nonJitteredProjectionMatrixGet or set the raw projection matrix with no camera offset (no jittering).
opaqueSortModeOpaque object sorting mode.
orthographicIs the camera orthographic (true) or perspective (false)?
orthographicSizeCamera's half-size when in orthographic mode.
overrideSceneCullingMaskSets the culling maks used to determine which objects from which Scenes to draw. See EditorSceneManager.SetSceneCullingMask.
pixelHeightHow tall is the camera in pixels (not accounting for dynamic resolution scaling) (Read Only).
pixelRectWhere on the screen is the camera rendered in pixel coordinates.
pixelWidthHow wide is the camera in pixels (not accounting for dynamic resolution scaling) (Read Only).
previousViewProjectionMatrixGet the view projection matrix used on the last frame.
projectionMatrixDefinir una matriz de proyección a medida.
rectWhere on the screen is the camera rendered in normalized coordinates.
renderingPathThe rendering path that should be used, if possible.
scaledPixelHeightHow tall is the camera in pixels (accounting for dynamic resolution scaling) (Read Only).
scaledPixelWidthHow wide is the camera in pixels (accounting for dynamic resolution scaling) (Read Only).
sceneIf not null, the camera will only render the contents of the specified Scene.
sensorSizeThe size of the camera sensor, expressed in millimeters.
stereoActiveEyeReturns the eye that is currently rendering. If called when stereo is not enabled it will return Camera.MonoOrStereoscopicEye.Mono. If called during a camera rendering callback such as OnRenderImage it will return the currently rendering eye. If called outside of a rendering callback and stereo is enabled, it will return the default eye which is Camera.MonoOrStereoscopicEye.Left.
stereoConvergenceDistance to a point where virtual eyes converge.
stereoEnabledStereoscopic rendering.
stereoSeparationThe distance between the virtual eyes. Use this to query or set the current eye separation. Note that most VR devices provide this value, in which case setting the value will have no effect.
stereoTargetEyeDefines which eye of a VR display the Camera renders into.
targetDisplaySet the target display for this Camera.
targetTextureDestination render texture.
transparencySortAxisAn axis that describes the direction along which the distances of objects are measured for the purpose of sorting.
transparencySortModeTransparent object sorting mode.
useJitteredProjectionMatrixForTransparentRenderingShould the jittered matrix be used for transparency rendering?
useOcclusionCullingWhether or not the Camera will use occlusion culling during rendering.
usePhysicalPropertiesEnable [UsePhysicalProperties] to use physical camera properties to compute the field of view and the frustum.
velocityGet the world-space speed of the camera (Read Only).
worldToCameraMatrixMatrix that transforms from world to camera space.

Funciones Públicas

AddCommandBufferAdd a command buffer to be executed at a specified place.
AddCommandBufferAsyncAdds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point.
CalculateFrustumCornersGiven viewport coordinates, calculates the view space vectors pointing to the four frustum corners at the specified camera depth.
CalculateObliqueMatrixCalculates and returns oblique near-plane projection matrix.
CopyFromMakes this camera's settings match other camera.
CopyStereoDeviceProjectionMatrixToNonJitteredSets the non-jittered projection matrix, sourced from the VR SDK.
GetCommandBuffersGet command buffers to be executed at a specified place.
GetGateFittedFieldOfView Retrieves the effective vertical field of view of the camera, including GateFit. Fitting the sensor gate and the resolution gate has an impact on the final field of view. If the sensor gate aspect ratio is the same as the resolution gate aspect ratio or if the camera is not in physical mode, then this method returns the same value as the fieldofview property.
GetGateFittedLensShift Retrieves the effective lens offset of the camera, including GateFit. Fitting the sensor gate and the resolution gate has an impact on the final obliqueness of the projection. If the sensor gate aspect ratio is the same as the resolution gate aspect ratio, then this method returns the same value as the lenshift property. If the camera is not in physical mode, then this methods returns Vector2.zero.
GetStereoNonJitteredProjectionMatrixGets the non-jittered projection matrix of a specific left or right stereoscopic eye.
GetStereoProjectionMatrixGets the projection matrix of a specific left or right stereoscopic eye.
GetStereoViewMatrixGets the left or right view matrix of a specific stereoscopic eye.
RemoveAllCommandBuffersRemove all command buffers set on this camera.
RemoveCommandBufferRemove command buffer from execution at a specified place.
RemoveCommandBuffersRemove command buffers from execution at a specified place.
RenderRenderizar la cámara manualmente.
RenderToCubemapRender into a static cubemap from this camera.
RenderWithShaderRender the camera with shader replacement.
ResetRevert all camera parameters to default.
ResetAspectRevert the aspect ratio to the screen's aspect ratio.
ResetCullingMatrixMake culling queries reflect the camera's built in parameters.
ResetProjectionMatrixMake the projection reflect normal camera's parameters.
ResetReplacementShaderRemove shader replacement from camera.
ResetStereoProjectionMatricesReset the camera to using the Unity computed projection matrices for all stereoscopic eyes.
ResetStereoViewMatricesReset the camera to using the Unity computed view matrices for all stereoscopic eyes.
ResetTransparencySortSettingsResets this Camera's transparency sort settings to the default. Default transparency settings are taken from GraphicsSettings instead of directly from this Camera.
ResetWorldToCameraMatrixMake the rendering position reflect the camera's position in the Scene.
ScreenPointToRayReturns a ray going from camera through a screen point.
ScreenToViewportPointTransforms position from screen space into viewport space.
ScreenToWorldPointTransforms a point from screen space into world space, where world space is defined as the coordinate system at the very top of your game's hierarchy.
SetReplacementShaderMake the camera render with shader replacement.
SetStereoProjectionMatrixSets a custom projection matrix for a specific stereoscopic eye.
SetStereoViewMatrixSets a custom view matrix for a specific stereoscopic eye.
SetTargetBuffersSets the Camera to render to the chosen buffers of one or more RenderTextures.
TryGetCullingParametersGet culling parameters for a camera.
ViewportPointToRayReturns a ray going from camera through a viewport point.
ViewportToScreenPointTransforms position from viewport space into screen space.
ViewportToWorldPointTransforms position from viewport space into world space.
WorldToScreenPointTransforms position from world space into screen space.
WorldToViewportPointTransforms position from world space into viewport space.

Funciones Estáticas

CalculateProjectionMatrixFromPhysicalProperties Calculates the projection matrix from focal length, sensor size, lens shift, near plane distance, far plane distance, and Gate fit parameters. To calculate the projection matrix without taking Gate fit into account, use Camera.GateFitMode.None . See Also: GateFitParameters
FieldOfViewToFocalLengthConverts field of view to focal length. Use either sensor height and vertical field of view or sensor width and horizontal field of view.
FocalLengthToFieldOfViewConverts focal length to field of view.
GetAllCamerasFills an array of Camera with the current cameras in the Scene, without allocating a new array.
HorizontalToVerticalFieldOfViewConverts the horizontal field of view (FOV) to the vertical FOV, based on the value of the aspect ratio parameter.
VerticalToHorizontalFieldOfViewConverts the vertical field of view (FOV) to the horizontal FOV, based on the value of the aspect ratio parameter.

Mensajes

OnPostRenderOnPostRender is called after a camera has finished rendering the Scene.
OnPreCullOnPreCull is called before a camera culls the Scene.
OnPreRenderOnPreRender is called before a camera starts rendering the Scene.
OnRenderImageOnRenderImage is called after all rendering is complete to render image.
OnRenderObjectOnRenderObject is called after camera has rendered the Scene.
OnWillRenderObjectOnPreRender se llama antes de que la cámara comience a renderizar la escena.

Delegados

CameraCallbackDelegate type for camera callbacks.

Miembros heredados

Variables

enabledEnabled Behaviours are Updated, disabled Behaviours are not.
isActiveAndEnabledHas the Behaviour had active and enabled called?
gameObjectEl game object que tiene este componente adjunto. Un componente siempre está adjunto a un game object.
tagEl tag de este game object.
transformThe Transform attached to this GameObject.
hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameEl nombre del objeto.

Funciones Públicas

BroadcastMessageLlama al método denominado methodName de todos los MonoBehaviour en este game objecto en cualquiera de sus hijos.
CompareTag¿Este game object está etiquetado con tag?
GetComponentDevuelve un componente de tipo type si el game object tiene a alguno adjuntado, o null si no lo tiene.
GetComponentInChildrenRetorna el componente de tipo type en el GameObject o cualquiera de sus hijos utilizando depth first search (busqueda de profundidad).
GetComponentInParentRetorna el componente de tipo type en el GameObject o cualquiera de sus padres.
GetComponentsRetorna todos los componentes de tipo type en el GameObject.
GetComponentsInChildrenRetorna todos los componentes de tipo type en el GameObject o cualquiera de sus hijo.
GetComponentsInParentRetorna todos los componentes de tipo type en el GameObject o cualquiera de sus padres.
SendMessageLlama al método denominado methodName en cada MonoBehaviour de este game object.
SendMessageUpwardsLlama al método denominado methodName en todos los MonoBehaviour de este juego y en todos los ancestros del behaviour.
TryGetComponentGets the component of the specified type, if it exists.
GetInstanceIDDevuelve el id de la instancia del objeto.
ToStringReturns the name of the object.

Funciones Estáticas

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeDevuelve el primer objeto activo cargado de tipo type.
FindObjectsOfTypeDevuelve una lista de todos los objetos activos cargados de tipo type.
InstantiateClona el objeto original y devuelve el clon.

Operadores

bool¿Existe el objeto?
operator !=Compare si dos objetos se refieren a un objeto diferente.
operator ==Compara dos referencias de objeto para ver si se refieren al mismo objeto.