unity3D技术之KeepingTrackofTime记录时间

上传人:宝路 文档编号:2181207 上传时间:2017-07-21 格式:DOCX 页数:2 大小:121.25KB
返回 下载 相关 举报
unity3D技术之KeepingTrackofTime记录时间_第1页
第1页 / 共2页
unity3D技术之KeepingTrackofTime记录时间_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《unity3D技术之KeepingTrackofTime记录时间》由会员分享,可在线阅读,更多相关《unity3D技术之KeepingTrackofTime记录时间(2页珍藏版)》请在金锄头文库上搜索。

1、The Time class contains a very important class variable called deltaTime. This variable contains the amount of time since the last call to Update or FixedUpdate (depending on whether you are inside an Update or a FixedUpdate function).So the previous example, modified to make the object rotate with

2、a constant speed not dependent on the frame rate becomes: Time 类包含一个非常重要的变量叫 deltaTime.这个变量包含从上次调用 Update 或FixedUpdate 到现在的时间( 【狗刨学习网】根据你是放在 Update 函数还是 FixedUpdate函数中).( 另注: Update 每帧调用一次)依照上面的例子,使物体在一个均匀的速度下旋转,不依赖帧的频率,如下: C# JavaScript function Update() transform.Rotate(0, 5 * Time.deltaTime, 0);M

3、oving the object: 移动物体: C# JavaScript function Update() transform.Translate(0, 0, 2 * Time.deltaTime);If you add or subtract to a value every frame chances are you should multiply with Time.deltaTime. When you multiply with Time.deltaTime you essentially express: I want to move this object 10 meters

4、 per second instead of 10 meters per frame. This is not only good because your game will run the same independent of the frame rate but also because the units used for the motion are easy to understand. (10 meters per second) Another example, if you want to increase the range of a light over time. T

5、he following expresses, change the radius by 2 units per second. 如果你每帧添加或减少一个值,你需要乘以 Time.deltaTime .在你乘以 Time.deltaTime 的同时你必须明确:你是以每秒 10 米而不是每帧 10 米来移动物体.这样你的游戏就会以自己的节奏来运行而不是依赖帧的频率,因而也使游戏中的运动更容易掌握 .(每秒 10 米)另外一个例子,如果你想要每隔一段时间增加光照范围.下面的代码实现的是每秒增加半径2 个单位 . C# JavaScript function Update() light.range += 2.0 * Time.deltaTime;When dealing with rigidbodies through forces, you generally dont multiply by Time.deltaTime since the engine already takes care of that for you. 当涉及到作用于刚体的力时,通常不乘以 Time.deltaTime .因为引擎已经为你处理了.

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号