Transform.Translate 平移
function Translate (translation : Vector3, relativeTo : Space = Space.Self) : void
Description描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。
function Update() {
// Move the object forward along its z axis 1 unit/second.
//沿着z轴1单位/秒,向前移动物体
transform.Translate(Vector3.forward * Time.deltaTime);
// Move the object upward in world space 1 unit/second.
//在世界坐标沿着y轴1单位/秒,向上移动物体
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
}
• function Translate (x : float, y : float, z : float, relativeTo : Space = Space.Self) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
If relativeTo is left out or set to Space.Self the movement is applied relative to the transform's local axes. (the x, y and z axes shown when selecting the object inside the Scene View.) If relativeTo is Space.World the movement is applied relative to the world coordinate system.
如果relativeTo留空或者设置为Space.Self,移动被应用相对于变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于Space.World 移动被应用相对于世界坐标系统。
function Update() {
// Move the object forward along its z axis 1 unit/second.
//沿着z轴每秒1单位向前移动物体
transform.Translate(0, 0, Time.deltaTime);
// Move the object upward in world space 1 unit/second.
//在世界坐标每秒1单位向上移动物体
transform.Translate(0, Time.deltaTime, 0, Space.World);
}
• function Translate (translation : Vector3, relativeTo : Transform) : void
Description描述
Moves the transform in the direction and distance of translation.
移动transform在translation的方向和距离。
简单的说,向某方向移动物体多少距离。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo : Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
//相对于摄像机每秒1单位向右移动物体
transform.Translate(Vector3.right * Time.deltaTime, Camera.main.transform);
}
• function Translate (x : float, y : float, z : float, relativeTo : Transform) : void
Description描述
Moves the transform by x along the x axis, y along the y axis, and z along the z axis.
移动变换由x沿着x轴,y沿着y轴,z沿着z轴。
The movement is applied relative to /relativeTo/'s local coordinate system. If relativeTo is null, the movement is applied relative to the world coordinate system.
移动被应用相对于(relativeTo : Transform)的自身坐标系统。日光相对于为null,则移动被应用相对于世界坐标系统。
function Update() {
// Move the object to the right relative to the camera 1 unit/second.
//相对于摄像机每秒1单位向右移动物体
transform.Translate(Time.deltaTime, 0, 0, Camera.main.transform);
}
Transform.Translate 平移的更多相关文章
- CSS3中很容易混淆的transform,translate,transition。如何去区分,以及综合写法。
属性 含义 transition(过渡) 用于设置元素的样式过度,和animation有着类似的效果,但细节上有很大的不同 transform(变形) 用于元素进行旋转.缩放.移动或倾斜,和设 ...
- CSS3:transform translate transition 这些都是什么?
transform:一个属性名称,即CSS3 2D转换 属性. translate:一个属性函数,用法是translate(dx,dy) div { transform: translate(50px ...
- 父节点使用css的transform: translate(0, 0)时position:fixed在chrome浏览器中无效
今天在做移动端的页面,无意间发现了一个Chrome浏览器下的一个bug,在使用CSS3的transform: translate(0, 0)属性对节点A进行位置转化,此时A节点下面有一个字节点B,节点 ...
- jquery 设置 transform/translate 获取 transform/translate 的值
//获取 transform 值 var reg=/matrix.(((-)?([0-9]+.)?\d+([, ]+)?){6})./g; var str= progressUI.css(" ...
- transform:translate(-50%,-50%)实现水平垂直居中
.content { padding:10px; background:green; color:#fff; position:absolute; top:50%; ...
- transform: translate(-50%, -50%) 实现块元素百分比下居中
<!doctype html> <html> <head> <meta charset="utf-8"> <title> ...
- Unity使用transform.Translate()移动子物体时遇到的小问题
Unity使用transform.Translate()移动子物体时遇到的小问题 情况大概是这样:父物体A下有子物体B,希望使B在本地坐标系下移动1单位. B物体挂脚本代码如下: transform. ...
- transform translate transition 的区别
transform是变形,下面有translate transform: rotate旋转/scale缩放/skew扭曲/translate移动/matrix矩阵变形transform连写:rotat ...
- CSS - Transform(Translate) abnormal shadow in firefox
问题:当在Firefox中实现动画translate时,会出现虚影的状况: 经查找相关的解决方法,父容器添加样式:outline: 1px solid transparent;//即可解决问题. 但不 ...
随机推荐
- ZOJ 3822 Domination (三维概率DP)
E - Domination Time Limit:8000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu Submi ...
- 解决_CRT_SECURE_NO_WARNINGS 警告
问题:我们在程序中使用fopen等CRT函数,就会出现一些警告信息,很烦人,如下: 1>e:/project/htt/ishow/functions.cpp(156) : warning C49 ...
- gluPerspective(解释得很好)
http://www.cppblog.com/COOOOOOOOL/archive/2009/12/28/104255.html 函数原型gluPerspective(GLdouble fovy,GL ...
- VS2013 生成sqlite3动态连接库及sqlite3.dll的调用
一,生成sqlite3动态连接库1,去sqlite官网上下载最近的sqlite源码包,解压后得到四个文件:shell.c,sqlite3.c,sqlite3.h,sqlite3ext.h此处还需要sq ...
- UVALIVE 2927 "Shortest" pair of paths
裸的费用流.一开始因为这句话还觉得要拆点 样例行不通不知道这句话干啥用的.Further, the company cannot place the two chemicals in same dep ...
- 在Ubuntu/Centos使用 Let's Encrypt 证书部署 HTTPS的方法
certbot地址 apache服务器(ubuntu环境): 1.获取软件包: $ sudo apt-get update $ sudo apt-get install software-proper ...
- VS2017源代码版本管理
VS2017源代码版本管理有两种方式:Git(代码提交到服务器)和Team Foundation Server(代码提交到局域网) 一.Git版本管理(上传到码云服务器https://gitee.co ...
- python查询mangodb
from bson.objectid import ObjectId import pymongo #查询代码 #连接本机mongodb conn=pymongo.Connection() #指定 ...
- [BZOJ4568][SCOI2016]幸运数字(倍增LCA,点分治+线性基)
4568: [Scoi2016]幸运数字 Time Limit: 60 Sec Memory Limit: 256 MBSubmit: 2131 Solved: 865[Submit][Statu ...
- SQL表操作
//创建一个名为TEST1的表空间 CREATE SMALLFILE TABLESPACE "TEST1" DATAFILE 'G:\ORACLE_11G\ORADATA\ORCL ...