Unity3D圣典3.3版本-中文版
文集大纲加载中……
本文档使用 MrDoc 发布
-
+
首页
Quaternion.operator * 运算符 乘法
# [Quaternion](Quaternion.html).operator * 运算符 乘法 static *operator ** (*lhs* : Quaternion, *rhs* : Quaternion) : Quaternion *Description* 描述 Combines rotations lhs and rhs. 组合旋转 lhs 和 rhs。 Rotating a point first with lhs and then with rhs is the same as rotating the point by the combined rotation. Note that rotations are not commutative: lhs * rhs does not equal to rhs * lhs. 旋转一个点,首先用 lhs,然后用 rhs 旋转,与使用组合旋转相同。注意旋转不可交换: lhs*rhs 不等于 rhs*lhs. * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public Transform extraRotation; public void Awake() { transform.rotation *= extraRotation.rotation; } } ``` ``` // Applies the rotation of // extraRotation to the current rotation //应用extraRotation的旋转给当前旋转 var extraRotation : Transform; transform.rotation *= extraRotation.rotation; ``` • static *operator ** (*rotation* : Quaternion, *point* : [Vector3](../Vector3/Vector3.html)) : [Vector3](../Vector3/Vector3.html) *Description* 描述 Rotates the point point with rotation. 用 rotation 旋转 point 点。 * [C#](#) * [JavaScript](#) ``` using UnityEngine; using System.Collections; public class example : MonoBehaviour { public Vector3 relativeDirection = Vector3.forward; void Update() { Vector3 absoluteDirection = transform.rotation * relativeDirection; transform.position += absoluteDirection * Time.deltaTime; } } ``` ``` // Moves the object along relativeDirection // Usually you would use transform.Move for this //沿着relativeDirection移动物体 //通常你应该使用transform.Move移动 var relativeDirection = Vector3.forward; function Update () { var absoluteDirection = transform.rotation * relativeDirection; transform.position += absoluteDirection * Time.deltaTime; } ```
da
2022年5月23日 14:41
转发文档
收藏文档
上一篇
下一篇
手机扫码
复制链接
手机扫一扫转发分享
复制链接
关于 MrDoc
觅思文档MrDoc
是
州的先生
开发并开源的在线文档系统,其适合作为个人和小型团队的云笔记、文档和知识库管理工具。
如果觅思文档给你或你的团队带来了帮助,欢迎对作者进行一些打赏捐助,这将有力支持作者持续投入精力更新和维护觅思文档,感谢你的捐助!
>>>捐助鸣谢列表
微信
支付宝
QQ
PayPal
Markdown文件
分享
链接
类型
密码
更新密码