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.

当从MonoBehaviourFixedUpdate里调用时,返回固定帧速率增量时间(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将持有相同的值,直到下一帧再次更新。

function Update () {
// Move the object 10 meters per second!
//每秒移动物体10米
var translation : float = Time.deltaTime * 10;
transform.Translate (0, 0, translation);
}

Time.deltaTime 增量时间的更多相关文章

  1. Unity插值函数Lerp()与增量时间Time.deltatime

    一.Unity插值函数Lerp() 通过官方文档简单了解插值函数(https://docs.unity3d.com/ScriptReference/index.html),可以看到插值函数有很多 Ma ...

  2. Time.fixedDeltaTime 固定增量时间

    static var fixedDeltaTime : float Description描述 The interval in seconds at which physics and other f ...

  3. [Unity2D]实现背景的移动

    在游戏中通常会实现的效果是玩家主角移动的时候,背景也可以跟着移动,要实现这种效果其实就是获取主角的位置,然后再改变摄像机的位置就可以了,这就需要通过脚本来实现.这个脚本添加到摄像机的GameObjec ...

  4. 【转】Unity3D的输入(Input)——键盘和鼠标

    http://blog.csdn.net/lingyun_blog/article/details/41451565 Unity3D使用input类控制用户的输入,输入包括了用户键盘,鼠标,触摸,重力 ...

  5. [Unity菜鸟] Time

    1. Time.deltaTime 增量时间 以秒计算,完成最后一帧的时间(秒)(只读) 帧数所用的时间不是你能控制的.每一帧都不一样,游戏一般都是每秒60帧,也就是updata方法调用60次(假如你 ...

  6. U3D学习06-数学基础

    1.fixed timestep 固定帧率, 2.time scale 快慢镜头,影响的是真实时间 3.time.deltatime增量时间,物体运动不受帧频率影响,每秒移动速度需要乘deltatim ...

  7. Unity事件处理机制与NGUI事件机制

    1 Unity原生 1.1 GUI void OnGUI(){ if(GUI.Button(Rect position, string text)){ //点击后立即执行 } 1.1 Input 每个 ...

  8. 【SIKIA计划】_10_Unity5.1UI系统-UGUI笔记

    Canvas——TextEventSystem 事件系统 0.滚动文本列表(隐藏背景)/Scroll/maskimage[Scroll Rect][Mask]——text(拉伸到显示全部)Scroll ...

  9. Unity初探—SpaceShoot

    Unity初探—SpaceShoot DestroyByBoundary脚本(C#) 在游戏中我们添加了一个Cube正方体,让他来作为游戏的边界.它是可以触发触发事件的(勾选Is Trigger),当 ...

随机推荐

  1. js 判断所有节假日

    // JavaScript Document calendar = new Date(); month = calendar.getMonth(); date = calendar.getDate() ...

  2. C#关键字base

    例子: public CustomStroke(SharpType type) :base() { this.type = type; } 这里的CustomStroke继承与基类Stroke类,用关 ...

  3. [官方教程] [ES4封装教程]1.使用 VMware Player 创建适合封装的虚拟机

    [转载处,http://bbs.itiankong.com/] 前言: 首先要明确的一点,系统封装操作的源计算机一般为虚拟计算机(简称虚拟机.VM等),这也是为什么我们要在封装教程的第一章就专门学习虚 ...

  4. 深度学习入门教程UFLDL学习实验笔记二:使用向量化对MNIST数据集做稀疏自编码

    今天来做UFLDL的第二个实验,向量化.我们都知道,在matlab里面基本上如果使用for循环,程序是会慢的一逼的(可以说基本就运行不下去)所以在这呢,我们需要对程序进行向量化的处理,所谓向量化就是将 ...

  5. GAE初探-一鼻子灰

    考虑到GAE可以一定条件下免费发布app,再加上之前有潜在客户需要用到GAE. 遂决定了解一番. 以比较熟悉的django作为切入点, 1. 首先安装 GAE-launcher,似乎没有太大问题 2. ...

  6. LInux 安全测试 2

    Centos/CentOS 6.4 linux内核2.6.3.2本地提权exp代码 jincon 发表于 2014-05-31 08:25:00 发表在: 代码审计 最近我接手的一台centos 服务 ...

  7. linux下复制一个文件的内容到另一个文件

    cat path/to/file/filename1 >> path/to/file/filename2 例如: cat id_rsa.pub >> ~/.ssh/author ...

  8. 【Django】如何按天 小时等查询统计?

    代码: from django.db import connection from django.db.models import Sum,Count #alarm_sum_group_items = ...

  9. mac os 显示文件列表命令 ls -a

    显示正常文件列表用ls就行了,但是要是想显示隐藏的文件,需要加-a

  10. 【解决】 新浪sae固定链接404 问题

    固定链接404 固定链接是一个很重要的内容,wordpress默认的链接很复杂,也不利于搜索引擎搜索.wordpress也提供修改固定链接的功能,在设置里面[固定链接]修改. 但是,使用新浪sae的小 ...