Unity2D 背景图铺满与Camera.Size的计算公式
在unity制作2D游戏的教程,背景图sprite铺满显示时Camaer的Size调到多少合适,作个笔记。
资源参数
background.png 2048x640,Sprite的像素单位:100
调节camera.size
当camera的size=5,背景的显示效果
Camera的Size=3.2的背景的显示效果
计算公式
计算公式为:Screen Height/2/Pixel To Units=Main Camera.Size
对于2048x640的背景图,像素为100单位的比例,Camera的Size=640/2/100=3.2
For example, consider a Sprite imported from a 500 pixels wide image. The following table shows the different widths your GameObject would have when rendering that Sprite at different scales along the x-axis, using different values for Pixels to Units:
background.png is 640 pixels tall, and the background Sprite has a Pixel to Unit ratio of 100, so the background
object in the Hierarchy will be 6.4
units tall. However, the orthographic camera’s Size property measures half the height of the screen, so it should be half the height of the background, in units, or 3.2
.
Unity2D 背景图铺满与Camera.Size的计算公式的更多相关文章
- html始终让元素居中显示,背景图铺满随便拖动不出界
首先.写两个class属性 body { margin: 0; padding: 0; height: 100%; width: 100%; background-image: url(../Cont ...
- background 背景图铺满界面
background <body background="/image/1.png" style=" background-repeat:no-repeat ; b ...
- ExtJS-Viewport背景图片铺满浏览器视图并自动伸缩
var viewport = Ext.create('Ext.container.Viewport', { style : 'background-image:url(login_bj.jpg);ba ...
- IE9以下通过css让html页面背景图片铺满整个屏幕
第一种方法不设为背景图片,通过css来控制样式,可兼容到IE6,代码如下: <!DOCTYPE html> <html lang="en"> <hea ...
- css 设置背景图片铺满固定不动
#page{ position: relative; width: 100%; height: 100%; background-image:url(../img/bg.JPG); backgroun ...
- css 背景图片铺满
body { width: 100%; height: 100%; background: url(img/loginbg.png); background-size: 100% 100%; back ...
- css 设置body背景图片铺满
background-image: url(../../../assets/images/workflow/work.png); background-repeat: no-repeat; backg ...
- [转]完美的背景图全屏css代码 – background-size:cover?
写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...
- css设置全屏背景图,background-size 属性
在写主题样式的时候经常会碰到用背景图铺满整个背景的需求,这里分享下使用方法 需要的效果 图片以背景的形式铺满整个屏幕,不留空白区域 保持图像的纵横比(图片不变形) 图片居中 不出现滚动条 多浏览器支持 ...
随机推荐
- HTML 块元素
分为3类 1. 结构块 只能包含块级元素.它们包含结构含义,但没有语义含义,也就是,不能说明内容是什么,只能说明其组织方式. <ol> <ul> <dl> < ...
- copy 和 strong(或retain)的区别
http://stackoverflow.com/questions/18526909/whether-i-should-use-propertynonatomic-copy-or-propertyn ...
- Oracle计算时间差函数
两个Date类型字段:START_DATE,END_DATE,计算这两个日期的时间差(分别以天,小时,分钟,秒,毫秒): 天: ROUND(TO_NUMBER(END_DATE - START_DAT ...
- Android Studio利用Gradle删除没有使用到的资源和代码文件
一.打包时忽略无用资源 我们在打包的时候默认会把没有用到的资源(比如图片)也打包成app,徒增了应用的大小.现在我们可以利用Gradle来优雅的去除没有用到的资源文件了! 就是在gradle中配置sh ...
- 如何避免Activity 被杀死
我们都知道,在android系统中,内存不足的时候,系统是可以杀死任何暂停.停止或者销毁的Activity.这就意味着基本上没有在前台的Activity都会面临被关闭的可能. Android系统之所以 ...
- IOS开发中返回值为null时的处理
在IOS开发中,如果得到了null返回值很容易造成程序崩溃,null和nil的判断方法不同. nil的判断方法: if(data==nil) { NSLog(@"data is n ...
- 使用hibernate时出现 org.hibernate.HibernateException: Unable to get the default Bean Validation factory
hibernate 在使用junit测试报错: org.hibernate.HibernateException: Unable to get the default Bean Validation ...
- iptables & selinux
iptables -F getenforce setenforce 0 可以临时关闭,但重启之后还是会变成原来的状态. vi /etc/sysconfig/selinux 把里边的一行改为 SELIN ...
- 搭建openvpn 未完成。。。
轻松构建自己的OpenVPN家庭服务器(VMware+Amahi) http://os.51cto.com/art/201107/277146_all.htm 这是教程 不用安装第一步的,直接把下载 ...
- 基于Ubuntu虚拟机安装edx-platform
基于Ubuntu虚拟机安装edx-platform 一. 前提准备 1. 虚拟机中安装Ubuntu12.04,然后再使用Vagrant方式搭建开发环境,请确保这个虚拟机可以使用2GB的内存,否则容 ...