using UnityEngine;
using System.Collections; public class transform : MonoBehaviour { // Use this for initialization
void Start () {
//获取当前脚本所挂载的游戏对象身上的Transform
//控制游戏对象的位置、选择、缩放
Vector3 pos = transform.position;//世界坐标位置
print(pos); Vector3 local_pos = transform.localPosition;
print(local_pos); //一般不直接修改四元数
//transform.rotation;
//transform.localRotation; //localScale:控制游戏对象的缩放
Vector3 vScale = transform.localScale; //控制游戏对象间的父子关系
Transform parent = transform.parent; //当前游戏对象的根对象
Transform root = transform.root; //获取当前游戏对象的子对象Cube
Transform child_ = transform.Find("Cube");
Transform child = transform.FindChild("Cube");
} // Update is called once per frame
void Update () {
if(Input.GetKeyDown(KeyCode.P))
{
//transform.position = Vector3.zero;
//transform.localScale = new Vector3(1f, 2f, 1f); //改变当前游戏对象位置
//transform.Translate(new Vector3(1f, 0, 0)); //控制当前游戏对象旋转
//transform.Rotate(Vector3.up, 10f);//以Vector3.up位轴心旋转10度 transform.eulerAngles = new Vector3(, , );
}
}
}

Unity3d transform的更多相关文章

  1. Unity3d Transform.forward和Vector3.forward的区别!

    在Unity中有两个forward,一个是Transform.forward一个是Vector3.forward. 对于Vector3来说,它只是缩写.没有其它任何含义. Vector3.forwar ...

  2. 【转】Unity3D Transform中有关旋转的属性和方法测试

    Transform有关旋转个属性和方法测试 一,属性 1,var eulerAngles : Vector3 public float yRotation = 5.0F; void Update()  ...

  3. Unity3D RTS游戏中帧同步实现

    帧同步技术是早期RTS游戏常用的一种同步技术,本篇文章要给大家介绍的是RTX游戏中帧同步实现,帧同步是一种前后端数据同步的方式,一般应用于对实时性要求很高的网络游戏,想要了解更多帧同步的知识,继续往下 ...

  4. 【Unity3D游戏开发】GameObject.Find()、Transform.Find查找隐藏对象 (十)

    GameObjectFindTransformFind查找游戏对象 前置条件 相关API 1 GameObjectFind 2 TransformFind 3 其他查找 实际测试 即使隐藏root节点 ...

  5. Unity3D之UGUI学习笔记(二):Rect Transform与Anchor

    Rect Transform 我们都知道,Unity3D中所有的GameObject都必须要携带一个Transform组件,且该组件无法移除,那么作为UI显示的GameObject则不是携带Trans ...

  6. Unity3D 在Update中不要过多地修改Transform 信息

    前文说到碰撞检测时候,不要在Update内部尝试移动GameObject 来检查碰撞检测,这样是徒劳无功.但是 说到 因为你移动的过程中其实并没有将实际的移动位置更新到物理引擎,只是做了个缓存而已, ...

  7. Unity3d vector3.forward和transform.forward的区别!

    原文连接: http://blog.csdn.net/kaluluosi111/article/details/17206655 在unity3d中有2个forward,一个是vector3.forw ...

  8. unity3d中Transform组件变量详解

    Transform组件是每个游戏对象必须有的一个组建,因为你创建一个空物体,它也有该组建,因为unity3d是面向组建开发的一款游戏引擎.通过一张图片来看看它的属性 你可以在通过代码查看这些属性的区别 ...

  9. Unity3D性能优化小tips——把this.transform缓存缓存起来

    Unity3D开发时中有一个小tips,这在官方的文档里其实有提及的,但不那么显眼,这里小说一下: 在MonoBehaviour进行编程时,我们经常会用this.transform, this.gam ...

随机推荐

  1. C# MVC 返回html内容

    var ss = Server.MapPath(""); //C:\Users\Administrator\Desktop\Csharp测试程序\TestMVC\TestMVC s ...

  2. 使用JAVA写一个简单的日历

    JAVA写一个简单的日历import java.text.DateFormat;import java.text.ParseException;import java.text.SimpleDateF ...

  3. HTTP 返回码中 301 与 302 的区别

    转自:http://blog.csdn.net/qmhball/article/details/7838989 一.官方说法301,302 都是HTTP状态的编码,都代表着某个URL发生了转移,不同之 ...

  4. Vim配置持续记录

    1. 家目录创建.vimrc文件 set nu    # 设置行号 set tabstop=4 # tab制表符缩进 set autoindent # 自动缩进 set showmatch # 括号匹 ...

  5. Linux思维导图之计划任务

    查漏补缺,理解概念,及时总结,互相交流,欢迎拍砖. 用yum install -y vixie-cron这个命令进行安装计划任务服务,可以在安装之前使用crontab -e进行检测一下,服务器是否安装 ...

  6. 10.shard、replica机制及单node下创建index

    主要知识点     1.shard&replica机制梳理 2.单node环境下创建index的情况     1.shard&replica机制再次梳理     (1)index包含多 ...

  7. 1.IDEA的安装

    .1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16.

  8. foj 2173 floyd+矩阵快速幂

     Problem 2173 Nostop Accept: 52    Submit: 210 Time Limit: 3000 mSec    Memory Limit : 32768 KB  Pro ...

  9. mongodb--作为windows服务启动

    注意需要以管理员权限运行CMD

  10. Spring注解@Repository、@Service、@Controller、@Component

    继前几章所讲解的注解中: http://www.cnblogs.com/EasonJim/p/6892280.html http://www.cnblogs.com/EasonJim/p/689974 ...