zoukankan      html  css  js  c++  java
  • Transform.Translate 平移

    function Translate (translation : Vector3relativeTo : 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 : Vector3relativeTo : 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);
    }
  • 相关阅读:
    硬盘参数你都懂吗?(上)-从案例引发的讨论
    Python 面试题(下)
    Python 面试题(上)
    DNS 原理入门
    从硬盘设计思想到RAID改良之道
    (转)短信vs.推送通知vs.电子邮件:app什么时候该用哪种方式来通知用户?
    (转)移动端主动推送消息原理
    (转)OpenFire源码学习之十七:HTTP Service插件
    (转)openfire插件开发(二) 基于web的插件开发
    (转)openfire插件开发(一)
  • 原文地址:https://www.cnblogs.com/vincentDr/p/3678278.html
Copyright © 2011-2022 走看看