unity正交相机宽度_Unity5.0_Camera.orthographicSize 正交大小_软件教程_资源库

本文介绍了在Unity5.0中如何调整Camera组件的orthographicSize属性,以改变正交相机的视野范围。通过设置Camera.orthographicSize,可以控制相机在正交模式下的垂直尺寸的一半,水平尺寸会根据视口的宽高比自动调整。示例代码展示了如何在C#和JavaScript中设置主相机的正交大小为5。
摘要由CSDN通过智能技术生成

摘要:Unity5.0_Camera.orthographicSize 正交大小_软件教程_资源库

Camera.orthographicSize 正交大小

var orthographicSize : float

Description描述

Camera's half-size when in orthographic mode.

在正交模式下相机的一半尺寸。

This is half of the vertical size of the viewing volume. Horizontal viewing  size varies depending on viewport's aspect ratio.  Orthographic size is ignored when camera is not orthographic (see orthographic).

这个为视体垂直大小的一半,水平视口到校取决于视口的长宽比,相机不是正交时,Orthographic size被忽略(参考 orthographic)

C#

JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {camera.orthographic = true;camera.orthographicSize = 5;}}

// Set the camera's ortho size to 5//设置相机的正交尺寸为5camera.orthographic = true;camera.orthographicSize = 5;

Using specifically the main camera:

使用专门的主相机:

C#

JavaScript

using UnityEngine;using System.Collections;public class example : MonoBehaviour {public void Awake() {Camera.main.orthographic = true;Camera.main.orthographicSize = 5;}}

// Set the main camera's ortho size to 5//设置主相机的正交尺寸为5Camera.main.orthographic = true;Camera.main.orthographicSize = 5;

ddf946631bdb98394aa2ce80cf334144.png

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值