Unity 6.3
0 онлайн 83 гостей 3 в системе
Вход

Camera.orthographicSize

Declaration

public float orthographicSize;

Описание

Половина размера Camera в орфографическом режиме.

Свойство orthographicSize определяет объем просмотра orthographic Camera. Чтобы изменить orthographicSize, вы должны установить проекцию Camera на ортографическую.

Высота просмотра составляет (orthographicSize * 2). Unity рассчитывает ширину просмотра с помощью orthographicSize и камеры aspect.

Unity игнорирует orthographicSize, если камера не ортографическая. Используйте fieldOfView вместо этого.

using UnityEngine;

public class Example : MonoBehaviour { // Assign this Camera in the Inspector public Camera m_OrthographicCamera; // These are the positions and dimensions of the Camera view in the Game view float m_ViewPositionX, m_ViewPositionY, m_ViewWidth, m_ViewHeight;

void Start() { // This sets the Camera view rectangle to be in the bottom corner of the screen m_ViewPositionX = 0; m_ViewPositionY = 0;

// This sets the Camera view rectangle to be smaller so you can compare the orthographic view of this Camera with the perspective view of the Main Camera m_ViewWidth = 0.4f; m_ViewHeight = 0.4f;

// If a Camera has been assigned in the inspector, enable orthographic mode and change the size if (m_OrthographicCamera) { // This enables the orthographic mode m_OrthographicCamera.orthographic = true;

// Set the size of the viewing volume you'd like the orthographic Camera to pick up m_OrthographicCamera.orthographicSize = 5.0f;

// Set the orthographic Camera Viewport size and position m_OrthographicCamera.rect = new Rect(m_ViewPositionX, m_ViewPositionY, m_ViewWidth, m_ViewHeight); } } }