{"id":93,"date":"2020-06-04T04:32:12","date_gmt":"2020-06-04T04:32:12","guid":{"rendered":"https:\/\/lucyestela.com\/dev\/?p=93"},"modified":"2021-03-02T03:01:03","modified_gmt":"2021-03-02T03:01:03","slug":"camera","status":"publish","type":"post","link":"https:\/\/lucyestela.com\/dev\/unity\/camera\/","title":{"rendered":"Camera &#8211; Unity"},"content":{"rendered":"<div class=\"boldgrid-section\">\n<div class=\"container\">\n<div class=\"row\">\n<div class=\"col-md-12 col-xs-12 col-sm-12\">\n<p class=\"\"><strong>Camera.orthographicSize<\/strong><\/p>\n<p class=\"\">Did you know that the camera is half-size when in orthographic mode? Well I didn&#8217;t, but now I do.<\/p>\n<div class=\"subsection\">\n<p class=\"\">The orthographicSize property defines the viewing volume of an&nbsp;&nbsp;orthographic&nbsp; Camera. In order to edit this size, ensure the Camera is first set to orthographic either through script or in the Inspector. The orthographicSize is half the size of the vertical viewing volume. The horizontal size of the viewing volume depends on the aspect ratio.<\/p>\n<\/div>\n<p class=\"\">So if I wanted to create a bounding box around the orthographic camera view &#8211; for example in a game where I wanted to know if an object has left the gameplay area which is the whole screen &#8211; then I could use the following script.<\/p>\n<pre class=\"\"><span style=\"font-family: Menlo;\"><span style=\"color: #3363a4;\">Vector3<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">scaleDesiredOfColiderBox;<\/span><\/span>\r\n\r\n<span style=\"color: #222222;\">scaleDesiredOfColiderBox<\/span><span style=\"color: #222222;\">.<\/span><span style=\"color: #222222;\">z<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">=<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">10<\/span><span style=\"color: #222222;\">;<\/span>\r\n<span style=\"color: #222222;\">scaleDesiredOfColiderBox.<\/span><span style=\"color: #222222;\">y<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">=<\/span><span style=\"color: #222222;\"> Camera.main<\/span><span style=\"color: #222222;\">.<\/span><span style=\"color: #222222;\">orthographicSize<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">*<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #db7100;\">2<\/span><span style=\"color: #222222;\">;<\/span>\r\n<span style=\"color: #222222;\">scaleDesiredOfColiderBox.<\/span><span style=\"color: #222222;\">x<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">=<\/span><span style=\"color: #222222;\"> scaleDesiredOfColiderBox<\/span><span style=\"color: #222222;\">.<\/span><span style=\"color: #222222;\">y<\/span><span style=\"color: #222222;\">&nbsp;<\/span><span style=\"color: #222222;\">*<\/span><span style=\"color: #222222;\"> Camera.main<\/span><span style=\"color: #222222;\">.<\/span><span style=\"color: #222222;\">aspect<\/span><span style=\"color: #222222;\">;<\/span><\/pre>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Camera.orthographicSize Did you know that the camera is half-size when in orthographic mode? Well I didn&#8217;t, but now I do. The orthographicSize property defines the viewing volume of an&nbsp;&nbsp;orthographic&nbsp; Camera. In order to edit this size, ensure the Camera is first set to orthographic either through script or in the Inspector. The orthographicSize is half &#8230; <a title=\"Camera &#8211; Unity\" class=\"read-more\" href=\"https:\/\/lucyestela.com\/dev\/unity\/camera\/\" aria-label=\"More on Camera &#8211; Unity\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"bgseo_title":"","bgseo_description":"","bgseo_robots_index":"index","bgseo_robots_follow":"follow","footnotes":""},"categories":[58],"tags":[21,43,4],"class_list":["post-93","post","type-post","status-publish","format-standard","hentry","category-unity","tag-camera","tag-orthographicsize","tag-unity"],"_links":{"self":[{"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/posts\/93","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/comments?post=93"}],"version-history":[{"count":4,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/posts\/93\/revisions"}],"predecessor-version":[{"id":240,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/posts\/93\/revisions\/240"}],"wp:attachment":[{"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/media?parent=93"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/categories?post=93"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lucyestela.com\/dev\/wp-json\/wp\/v2\/tags?post=93"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}