Transform & Physics

1、Space。Unity定义了Space枚举值,此值如下:

  

  通常通过Space.World、Space.Self来区别一个Vector是按世界坐标系作用还是按本地坐标系作用。

参考:file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/Space.html

2、通过Transform.Translate()来移动对象。

  

  

  

  

  其中relativeTo:Transform参数指定按某对象的局部坐标系来应用vector,如果relativeTo为空则应用世界坐标系。

参考:file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/Transform.Translate.html

3、Local坐标系与World坐标系vector的转换。以下方法把Local坐标系的vector转换为World坐标系:

  

  

  以下方法把World坐标系转换为Local坐标系:

  

  

4、Local坐标系与World坐标系point的转换。以下方法把Local转换为World:

  

  

  以下方法把World转换为Local:

  

  

5、Physics.CheckSphere,用于判断某区域内是否有任何的其它Collider。

    

  Physics.OverlapSphere,用于获取区域内所有的Collider。

  

参考:

1、file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/Transform.html

2、file:///D:/Program%20Files%20(x86)/Unity/Editor/Data/Documentation/Documentation/ScriptReference/Physics.OverlapSphere.html

  

Transform & Physics的更多相关文章

  1. 【Unity3D基础教程】给初学者看的Unity教程(一):GameObject,Compoent,Time,Input,Physics

    作者:王选易,出处:http://www.cnblogs.com/neverdie/  欢迎转载,也请保留这段声明.如果你喜欢这篇文章,请点推荐.谢谢! Unity3D重要模块的类图 最近刚刚完成了一 ...

  2. Unity3D_04_GameObject,Component,Time,Input,Physics

    Unity3D是一个Component-Based的游戏引擎,并且为GamePlay Programmer提供了很多游戏性层上的支持. 1.可以在图形界面上设计动画状态转换的Animator. 2.可 ...

  3. Unity入门一,什么是GameObject,MonoBehaviour

    Unity入门一,什么是GameObject,MonoBehaviour GameObject和Component Unity是一个Component-Based的引擎,所有物体都是GameObjec ...

  4. 使用Unity3d的Physics.Raycast()的用法做子弹射击

    Class Functions 1)static function Raycast (origin : Vector3, direction : Vector3, distance : float = ...

  5. 人物角色群体攻击判定(三)Physics.OverlapSphere(群体攻击)

    使用Physics.OverlapSphere来检测不方便调试, 其他都可以.   核心代码: //检测敌人 public void CheckEnemy() { Collider[] cols = ...

  6. [Unity Physics] Physics - Raycast

    Class Variables类变量 gravity The gravity applied to all rigid bodies in the scene.场景中应用到所有刚性物体的重力. min ...

  7. Animation Physics and The Realization Of Animation In Browsers

    Animation Physics Background With the development of computer science technology, people are facing ...

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

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

  9. Game Physics Cookbook (Gabor Szauer 著)

    Chapter1: Vectors Chapter2: Matrices Chapter3: Matrix Transformations Chapter4: 2D Primitive Shapes ...

随机推荐

  1. luarocks 安装

    1. linux 安装 wget https://luarocks.org/releases/luarocks-2.4.1.tar.gz tar zxpf luarocks-2.4.1.tar.gz ...

  2. 纯 as3 项目中引用 fl 包下的类

    如果安装了 Flash IDE, 将下面的文件添加到项目的 libs 中即可:D:\Program Files\Adobe\Adobe Flash CS6\Common\Configuration\A ...

  3. 连接linux

    mac下连接linux 1 iTerm2 方式一: 在iTerm2的命令行下,输入: //-p端口号(linux默认是22),用户名@linux的IPssh -p 22 username@ip//按e ...

  4. Apache + Tomcat + 连接器JK

    一 安装Apache 下载apache: https://www.apache.org/   ->  http://mirrors.cnnic.cn/apache/  -> http:// ...

  5. html基础1(环境准备、标签)

    学习目的 1,能改前端的模板 2,自己装修页面 3.前后端交互多个技术 4.能操作网页元素 5.能和前端开发人员沟通 开发工具: pycharm/webStorm EditPlus(适合初学) sub ...

  6. 基于Spring Boot和Spring Cloud实现微服务架构

    官网的技术导读真的描述的很详细,虽然对于我们看英文很费劲,但如果英文不是很差,请选择沉下心去读,你一定能收获好多.我的学习是先从Spring boot开始的,然后接触到微服务架构,当然,这一切最大的启 ...

  7. C程序花括号嵌套层次统计(新)

    [问题描述] 编写程序,统计给定的C源程序中花括号的最大嵌套层次,并输出花括号嵌套序列,该程序没有语法错误. 注意:1)源程序注释(/* … */)中的花括号应被忽略,不参与统计.2)源程序中的字符串 ...

  8. (转)Inno Setup入门(十)——操作注册表

    本文转载自:http://blog.csdn.net/yushanddddfenghailin/article/details/17250871 有些程序需要随系统启动,或者需要建立某些文件关联等问题 ...

  9. [置顶] apt-get update 更新失败----如何清除破损而且陈旧的PPA仓库 (W: Failed to fetch http://ppa.launchpad.net/jonathonf/pyt)

    我使用sudo apt-get update之后,更新失败,遇到如下错误. W: Failed to fetch http://ppa.launchpad.net/jonathonf/python-3 ...

  10. Linux下编写 makefile 详细教程

    原文地址: https://www.cnblogs.com/mfryf/p/3305778.html 近期在学习Linux下的C编程,买了一本叫<Linux环境下的C编程指南>读到make ...