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;//即可解决问题. 但不 ...
随机推荐
- HDU1083_Courses_课程_C++
给你们人工翻译一下题目哈,刚好练一下英语 对于一个组中有 N 个学生和 P 种课程.每个学生能够参加0种,1种或者更多的课程.你的任务是找到一种可能的方案使恰好P个学生同时满足下列条件: ‧ 方案中的 ...
- sunos 修改shell为bash
root:x:::Super-User:/:/sbin/sh 改为 root:x:::Super-User:/:/usr/bin/bash 修改/增加 .profile 文件,在¥HOME路径下 ex ...
- 搭建github服务器
https://about.gitlab.com/downloads/#centos6
- ssh xshell 连接在vim中无法用 ctrl+insert 复制黏贴
在用户目录编辑.vimrc文件不存在则创建,vi的三种模式:命令模式,插入模式,可视模式,鼠标可以启动于各种模式中,所以配置文件中的set mouse=a启动了所有模式,这样就屏蔽了鼠标右健功能,se ...
- Linux查看进程堆栈信息命令
jps -lvm #查看进程IDjstack -l <进程ID> # 查看进程堆栈信息
- rabbitmq web管理页面无法访问
安装rabbitmq 之后可以通过默认的15672端口访问web界面进行管理,rabbitmq一些默认端口如下: 4369: epmd, a peer discovery service used b ...
- 计蒜客 28201.Choosing Ice Cream-gcd (BAPC 2014 Preliminary ACM-ICPC Asia Training League 暑假第一阶段第一场 A)
开始水一波博客 题目链接: A. Choosing Ice Cream 传送门 题意就是n个冰淇淋,骰子有k个面,问你是否能在公平的概率下转几次骰子能确定买哪个冰淇淋. 举个例子,假设我只有一个冰淇淋 ...
- CF978B File Name【数组操作/序列判断连续出现>=3次的‘x’个数】
CF978B File Name [分析]:设置计数器cnt,计数x的个数:遇到非x,若cnt>=3的话累加多出的个数,计数器清零:若最后cnt>=3说明没遇到非x无法清零,那后部分就都是 ...
- Xamarin XAML语言教程构建进度条ProgressBar
Xamarin XAML语言教程构建进度条ProgressBar Xamarin XAML语言教程构建进度条ProgressBar,ProgressBar被称为进度条,它类似于没有滑块的滑块控件.进度 ...
- HashSet、LinkedHashSet和TreeSet
关键技术: HashSet采用散列函数对元素进行排序,是专门为快速查询而设计的.存入HashSet的对象必须定义hashCode方法. TreeSet采用红黑树的数据结构进行排序元素,使用它可以从Se ...