赞
踩
原理就是相机设为透视并让场景中需要3D效果(远大近小)的物体朝向相机。
1.将相机的Projection设置为Perspective并将rotation的x设置为45度(可自定角度)。
2.将Edit->ProjectSetting->Graphics->CameraSetting->Transparency Sort Mode设置为Perspective。
3.为场景中需要立体效果的所有物体的父物体挂载脚本FacingCamera 。
代码如下:
public class FacingCamera : MonoBehaviour
{
void Update()
{
for(int i = 0;i < transform.childCount; i++)
{
transform.GetChild(i).rotation = Camera.main.transform.rotation;
}
}
}
最终效果:
参考视频
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。