Transform.Rotate 旋转

function Rotate (eulerAngles : Vector3, relativeTo : Space = Space.Self) : void
Description描述
Applies a rotation of eulerAngles.z degrees around the z axis, eulerAngles.x degrees around the x axis, and eulerAngles.y degrees around the y axis (in that order).
应用一个欧拉角的旋转角度,eulerAngles.z度围绕z轴,eulerAngles.x度围绕x轴,eulerAngles.y度围绕y轴(这样的顺序)。
If relativeTo is left out or set to Space.Self the rotation is applied around 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 rotation is applied around the world x, y, z axes.
如果相对于留空或者设置为Space.Self 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于 Space.World 旋转角度被应用围绕世界的x、y、z轴。

using UnityEngine;
using System.Collections;
public class example : MonoBehaviour
{
        void Update()
       {
                transform.Rotate(Vector3.right * Time.deltaTime);
                transform.Rotate(Vector3.up * Time.deltaTime, Space.World);
        }
}

function Rotate (xAngle : float, yAngle : float, zAngle : float, relativeTo : Space = Space.Self) : void
Description描述
Applies a rotation of zAngle degrees around the z axis, xAngle degrees around the x axis, and yAngle degrees around the y axis (in that order).
应用一个旋转角度,zAngle度围绕z轴,xAngle度围绕x轴,yAngle度围绕y轴(这样的顺序)。
If relativeTo is left out or sot to Space.Self the rotation is applied around 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 rotation is applied around the world x, y, z axes.
如果相对于留空或者设置为Space.Self 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于 Space.World 旋转角度被应用围绕世界的x、y、z轴。

using UnityEngine;
using System.Collections;public class example : MonoBehaviour
{
        void Update()
       {
                transform.Rotate(Time.deltaTime, 0, 0);
                transform.Rotate(0, Time.deltaTime, 0, Space.World);
        }
}

function Rotate (axis : Vector3, angle : float, relativeTo : Space = Space.Self) : void
Description描述
Rotates the transform around axis by angle degrees.
按照angle度围绕axis轴旋转变换。
If relativeTo is left out or set to Space.Self the axis   parameter is 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 axis parameter is relative to the world x, y, z axes.
如果相对于留空或者设置为Space.Self 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y和z轴显示)如果相对于 Space.World 旋转角度被应用围绕世界的x、y、z轴。

using UnityEngine;
using System.Collections;
public class example : MonoBehaviour
{
        void Update()
       {
                transform.Rotate(Vector3.right, Time.deltaTime);
                transform.Rotate(Vector3.up, Time.deltaTime, Space.World);
        }
}

转载于:https://www.cnblogs.com/feiyanstudio/articles/7326703.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值