Transform.eulerAngles 欧拉角
var eulerAngles : Vector3
Description描述
The rotation as Euler angles in degrees.
旋转作为欧拉角度。
The x, y, and z angles represent a rotation z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis (in that order).
x、y、z角代表绕z轴旋转z度,绕x轴旋转x度,绕y轴旋转y度(这个顺序)。
Only use this variable to read and set the angles to absolute values. Don't increment them, as it will fail when the angle exceeds 360 degrees. Use Transform.Rotateinstead.
仅使用者这个变量读取和设置角度到绝对值。不要递增它们,当超过角度360度,它将失败。使用Transform.Rotate替代。
// Print the rotation around the global X Axis
//打印绕世界x轴的旋转角度
print (transform.eulerAngles.x);
// Print the rotation around the global Y Axis
//打印绕世界y轴的旋转角度
print (transform.eulerAngles.y);
// Print the rotation around the global Z Axis
//打印绕世界z轴的旋转角度
print (transform.eulerAngles.z); // Assign an absolute rotation using eulerAngles
//指定一个绝对使用欧拉角的旋转角度
var yRotation : float = 5.0;
function Update () {
yRotation += Input.GetAxis("Horizontal");
transform.eulerAngles = Vector3(, yRotation, ); }
Do not set one of the eulerAngles axis separately (eg. eulerAngles.x = 10; ) since this will lead to drift and undesired rotations. When setting them to a new value set them all at once as shown above. Unity will convert the angles to and from the rotation stored in Transform.rotation
不要分别设置欧拉角其中一个轴(例如: eulerAngles.x = 10; ),因为这将导致偏移和不希望的旋转。当设置它们一个新的值时,要同时设置全部,如上所示。Unity会从Transform.rotation这个四元组结构中转换角度到欧拉角的表达方式,或者反过来。
Transform.eulerAngles 欧拉角的更多相关文章
- Unity3D 利用欧拉角实现实体的旋转
本文系作者原创,转载请注明出处 刚刚入门U3D,也是很多东西搞不懂,最先接触的就是自己尝试去获取键盘上的GetPress之类的事件了吧 官方的API DOC也是帮了不少忙,到处吸收了各位博主的文章也是 ...
- U3D Transform用法
最近在学习unity3d,下面对Transform类做一个小结 一.常用属性和方法 1.1 常用属性: 用代码展示一下上面的一些属性,值得注意的是myCube是mySphere的父物体 using U ...
- unity3d中Transform组件变量详解
Transform组件是每个游戏对象必须有的一个组建,因为你创建一个空物体,它也有该组建,因为unity3d是面向组建开发的一款游戏引擎.通过一张图片来看看它的属性 你可以在通过代码查看这些属性的区别 ...
- 【转】Unity3D Transform中有关旋转的属性和方法测试
Transform有关旋转个属性和方法测试 一,属性 1,var eulerAngles : Vector3 public float yRotation = 5.0F; void Update() ...
- Unity复杂的旋转-欧拉角和四元数
一.欧拉角欧拉角最容易表示,用三个变量X,Y,Z可以直观的表示绕着某个轴的旋转角度. 在Unity里就是Transform组件的Rotation里的X Y Z三个变量代表了欧拉角 二.四元数四元数相比 ...
- 【Unity编程】欧拉角与万向节死锁(图文版)
版权声明:本文为博主原创文章,欢迎转载.请保留博主链接:http://blog.csdn.net/andrewfan 万向节死锁(Gimbal Lock)问题 上文中曾经说过,欧拉旋转的顺规和轴向定义 ...
- Unity3d transform
using UnityEngine; using System.Collections; public class transform : MonoBehaviour { // Use this fo ...
- Unity 重要基础知识点
这是两个月前的学习记录,发出来了下,如果有误欢迎大家指出: 脚本生命周期 //每当脚本被加载时调用一次 // 1. 在Awake中做一些初始化操作 void Awake(){ //初始化publi ...
- unity3d 知识点随记
1.transform.translate是增加transform面板相应的数值x,y,z是以本地坐标系为方向:transform.transformdirection是以世界坐标系为方向,可以去测试 ...
随机推荐
- Linux wget 安装JDK失败
windows 下安装的话,查看网络,就会发现,是带cookie,回调参数Authparam 验证的
- python--jinja2
from jinja2 import Template # 创建一个Template模板去渲染它 s = "my name is {{mashiro}}" t = Template ...
- C/51单片机
1. 串口也可以有多根线的,但是各线之间没有协调同步发送,而是各自是独自发送的.并口是同步发送,同步一次8位同时成功同时失败,类比事务. 2. ASCII码的前32位是通讯预留的编码即使现 ...
- CSS控制图片显示区域
优化页面响应速度,减少页面向服务端请求图片次数,有时候可能会将多个小图合并到一张图中,用的时候通过css控制显示的区域,比如:上传一张人物图片到服务器检测人脸,最后在页面上列出所有识别出来的人脸,实现 ...
- MSSQL—字符串分离(Split函数)
前面提到了记录合并,有了合并需求肯定也会有分离需求,说到字符串分离,大家肯定会想到SPLIT函数,这个在.NET,Java和JS中都有函数,很可惜在SQL SERVER中没有,我们只能自己来写这么一个 ...
- Web开发之编码与解码、签名、加密与解密
在Web开发中,编码与解码.签名.加密与解密是非常常见的问题.本文不会介绍具体实例,而是介绍这些的原理.用途与区别.一.编码与解码 在Web开发中,需要通过URL的query参数来传递数 ...
- Buffer源码深入分析
博客园对MarkDown显示的层次感不是很好,大家可以看这里:Buffeer. 本机环境: Linux 4.4.0-21-generic #37-Ubuntu SMP Mon Apr 18 18:33 ...
- 两个imageView实现图片轮播
前言 在不少的项目中,都会用到图片轮播这个功能,现在网上关于图片轮播的轮子也层出不穷,千奇百怪,笔者根据自己的思路,用两个imageView也实现了图片轮播,这里给大家介绍笔者的主要思路以及大概步骤. ...
- JD2
Business Requirement Support l Develops and communicates plan to manage vendor review of requirement ...
- POJ 2886 Who Gets the Most Candies? (线段树)
[题目链接] http://poj.org/problem?id=2886 [题目大意] 一些人站成一个圈,每个人手上都有一个数字, 指定从一个人开始淘汰,每次一个人淘汰时,将手心里写着的数字x展示 ...