게임/Unity3D

[Unity3d] camera orthographic size

Binceline 2013. 1. 22. 15:51

Camera.orthographicSize 먼저 변경하고 thisCamera.projectionMatrix를 변경해야 한다.

 
-------------------------------

Orthographic volume

1

Is there a way to set the "width and height" of the orthographic viewing volume? According to the documentation, orthographicSize is half the vertical size of the view volume and the width depends on the aspect ratio and the orthographicSize.

I had thought that if I wanted a desired width I could do something like Camera.main.orthographicSize = DesiredWidth/Camera.main.aspect. This method gives me a view volume that is close to, but not quite, the actual size of a unit cube I scaled to my desired view volume size.

The scene will have N cameras in a grid, each camera being a player. The camera view volumes need to be flush against each other in a grid. Now I could certainly just tweak the positioning so the offsets are hardcoded but I want to be able to dynamically zoom the cameras requiring me to mess with the orthoSize;

more ▼

asked Oct 27 at 07:08 PM

Jerdak gravatar image

Dakota 
166  7  9  13


1 answer:sort voted first 

1

I guess the easiest way is to setup your own projection matrix. Since orthographic projection is very simple, you just need setup a matrix that fits your needs and assign it to Camera.projectionMatrix. There are even some great examples on the doc-page.

more ▼

answered Oct 27 at 10:05 PM

Bunny83 gravatar image

Bunny83 
36.9k  7  34  179



반응형