Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Transform.Rotate 旋转
# [Transform](Transform.html).Rotate 旋转 function *Rotate* (*eulerAngles* : [Vector3](../Vector3/Vector3.html), *relativeTo* : [Space](../Enumerations/Space/Space.html) = [Space.Self](../Enumerations/Space/Space.Self.html)) : 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](../Enumerations/Space/Space.Self.html) 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](../Enumerations/Space/Space.Self.html) the rotation is applied around the world x, y, z axes. 如果相对于留空或者设置为 [Space.Self](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y 和 z 轴显示)如果相对于 [Space.World](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕世界的 x、y、z 轴。 * [C#](#) * [JavaScript](#) ``` 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 Update() { // Slowly rotate the object around its X axis at 1 degree/second. //沿着x轴每秒1度慢慢的旋转物体 transform.Rotate(Vector3.right * Time.deltaTime); // ... at the same time as spinning relative to the global // Y axis at the same speed. //相对于世界坐标沿着y轴每秒1度慢慢的旋转物体 transform.Rotate(Vector3.up * Time.deltaTime, Space.World); } ``` • function *Rotate* (*xAngle* : float, *yAngle* : float, *zAngle* : float, *relativeTo* : [Space](../Enumerations/Space/Space.html) = [Space.Self](../Enumerations/Space/Space.Self.html)) : 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](../Enumerations/Space/Space.Self.html) 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](../Enumerations/Space/Space.Self.html) the rotation is applied around the world x, y, z axes. 如果相对于留空或者设置为 [Space.Self](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y 和 z 轴显示)如果相对于 [Space.World](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕世界的 x、y、z 轴。 * [C#](#) * [JavaScript](#) ``` 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 Update() { // Slowly rotate the object around its X axis at 1 degree/second. //围绕x轴每秒1度,慢慢的旋转物体 transform.Rotate(Time.deltaTime, 0, 0); // ... at the same time as spinning it relative to the global // Y axis at the same speed. //相对于世界坐标,围绕y轴每秒1度,慢慢的旋转物体 transform.Rotate(0, Time.deltaTime, 0, Space.World); } ``` • function *Rotate* (*axis* : [Vector3](../Vector3/Vector3.html), *angle* : float, *relativeTo* : [Space](../Enumerations/Space/Space.html) = [Space.Self](../Enumerations/Space/Space.Self.html)) : void *Description* 描述 Rotates the transform around axis by angle degrees. 按照 angle 度围绕 axis 轴旋转变换。 If relativeTo is left out or set to [Space.Self](../Enumerations/Space/Space.Self.html) 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](../Enumerations/Space/Space.Self.html) the axis parameter is relative to the world x, y, z axes. 如果相对于留空或者设置为 [Space.Self](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕变换的自身轴。(当在场景视图选择物体时,x、y 和 z 轴显示)如果相对于 [Space.World](../Enumerations/Space/Space.Self.html) 旋转角度被应用围绕世界的 x、y、z 轴。 * [C#](#) * [JavaScript](#) ``` 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 Update() { // Slowly rotate the object around its X axis at 1 degree/second. //围绕x轴每秒1度,慢慢的旋转物体 transform.Rotate(Vector3.right, Time.deltaTime); // ... at the same time as spinning it relative to the global // Y axis at the same speed. //相对于世界坐标,围绕y轴每秒1度,慢慢的旋转物体 transform.Rotate(Vector3.up, Time.deltaTime, Space.World); } ```
da
2022年5月23日 14:51
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码