Time.deltaTime 增量时间

来源:互联网 发布:淘宝助理更新类目 编辑:程序博客网 时间:2024/06/12 05:08

static var deltaTime : float

Description描述

The time in seconds it took to complete the last frame (Read Only).

以秒计算,完成最后一帧的时间(只读)。

Use this function to make your game frame rate independent.

使用这个函数使和你的游戏帧速率无关。

放在Update()函数中的代码是以帧来执行的.如果我们需要物体的移动以秒来执行.我们需要将物体移动的值乘以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 per second instead of 10 meters per frame.

如果你加或减一个每帧改变的值,你应该与Time.deltaTime相乘。当你乘以Time.deltaTime实际表示:每秒移动物体10米,而不是每帧10米。

When called from inside MonoBehaviour's FixedUpdate, returns the fixed framerate delta time.

当从MonoBehaviour的FixedUpdate里调用时,返回固定帧速率增量时间(fixedDeltaTime)。

Note that you should not rely on Time.deltaTime from inside OnGUI since OnGUI can be called multiple times per frame and deltaTime would hold the same value each call, until next frame where it would be updated again.

请注意从OnGUI里你不应该依赖于Time.deltaTime,因为OnGUI可以在每帧被多次调用并且每个调用deltaTime将持有相同的值,直到下一帧再次更新。

  • C#
  • JavaScript
function Update () {        // Move the object 10 meters per second!        //每秒移动物体10米        var translation : float = Time.deltaTime * 10;        transform.Translate (0, 0, translation);}
0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 投诉不成立卖家怎么办 淘宝卖家被买家投诉卖假货怎么办 天猫三天未发货怎么办 天猫申请换货卖家不处理怎么办 天猫新疆不发货怎么办 天猫商城少发货怎么办 下单了卖家不发货怎么办 天猫超市漏发货怎么办 天猫购物几天不发货怎么办 天猫总是不发货怎么办 申请退款后卖家又发货了怎么办 天猫拍后申请退款卖家发货怎么办 淘宝上没下单却收到了货怎么办 被买家投诉三无产品怎么办 阿里巴巴卖家虚假发货怎么办 淘宝捡到便宜但是卖家不发货怎么办 被工商局查到三无产品怎么办 淘宝买到三无产品电器怎么办 天猫商城被投诉怎么办 床板有虫子咬人怎么办 微信充电话费充错怎么办 联通话费充多了怎么办 qq钱包充值要验证码怎么办 在微信qq币充错账号怎么办 微信qq币充错了怎么办 魅蓝e玩游戏卡怎么办 魅蓝5玩游戏卡怎么办 微信qb充错号了怎么办 支付宝qb充错号了怎么办 手机上q币充错了怎么办 q币数值充错了怎么办 微信充值商户电话是假了怎么办 微信冲话费冲错了怎么办 淘宝退款不退邮费怎么办 淘金币买的退款怎么办 淘宝退款不退运费怎么办 拼多多不退运费怎么办 开发商不退团购服务费怎么办 支付宝话费充错了怎么办 电视版本低不支持投屏怎么办 绝地求生刺激战场不支持机型怎么办