摄像机围绕0.0.0点旋转并显示FPS值
2014-07-14 13:07
162 查看
将脚本绑定到摄像机上就OK!
转载自博客 http://blog.csdn.net/goodai007/article/details/8474134
using UnityEngine; using System.Collections; public class CameraFPS : MonoBehaviour { public float updateInterval = 0.5f; private float lastInterval; // Last interval end time private int frames = 0; // Frames over current interval private float fps; // Current FPS private float sum = 0.0f; private float num = 0.0f; // Use this for initialization void Start() { lastInterval = Time.realtimeSinceStartup; frames = 0; } void OnGUI() { GUILayout.Label("fps:" + fps.ToString("f0") + " " + (sum / num).ToString("f0")); } // Update is called once per frame void Update() { transform.RotateAround(Vector3.zero, Vector3.up, 100 * Time.deltaTime); ++frames; float timeNow = Time.realtimeSinceStartup; if (timeNow > lastInterval + updateInterval) { fps = frames / (timeNow - lastInterval); frames = 0; lastInterval = timeNow; sum += fps; num++; } } }
转载自博客 http://blog.csdn.net/goodai007/article/details/8474134
相关文章推荐
- 摄像机围绕0.0.0点旋转并显示FPS值
- Unity3D开发之控制摄像机围绕物体旋转 平移 缩放
- 摄像机围绕物体旋转观察
- Unity3D学习日记(五)实现围绕物品旋转的的摄像机控制
- 鼠标控制摄像机围绕物体旋转拍摄
- 如何让摄像机跟随你的角色,并且按鼠标右键围绕旋转
- unity 鼠标控制摄像机围绕物体旋转
- 【Unity 3D学习】获取鼠标滑动方向(上下左右)-控制摄像机围绕物体旋转
- Unity实现摄像机围绕物体旋转
- Unity3D【脚本】鼠标对摄像机的控制 - 点击鼠标,摄像机围绕圆心旋转(第三次修改)
- Unity3D【脚本】鼠标对摄像机的控制 - 点击鼠标,摄像机围绕圆心旋转
- 控制摄像机围绕目标旋转观察
- 摄像机围绕人物旋转
- css3旋转透明显示
- unity3d旋转摄像机脚本
- 轻松实现旋转显示文本
- 围绕旋转
- 自由视角摄像机,实现旋转,缩放
- Android 屏幕处于横屏状态 旋转180度界面切换显示
- Unity3D入门(五):鼠标控制旋转、摄像机缩放