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. 【DUBBO】 Dubbo原理解析-Dubbo内核实现之基于SPI思想Dubbo内核实现

    转载:http://blog.csdn.net/quhongwei_zhanqiu/article/details/41577235 SPI接口定义 定义了@SPI注解 public @interfa ...

  2. CF 1093E Intersection of Permutations——CDQ分治

    题目:http://codeforces.com/contest/1093/problem/E 只能想到转化成查询一个区间里值在一个范围里的数的个数…… 没有想到这样适合用主席树套树状数组维护.不过据 ...

  3. 语义分割【semantic-segmentation】资料备忘

    https://github.com/mrgloom/awesome-semantic-segmentation

  4. (转)Inno Setup入门(二十)——Inno Setup类参考(6)

    本文转载自:http://blog.csdn.net/yushanddddfenghailin/article/details/17251041 存储框 存储框也是典型的窗口可视化组件,同编辑框类似, ...

  5. java代码-----计算器,界面+功能+boolean

    总结:还是那个不懂代码放在哪里好?不知道怎么定义一些关键性变量.比如boolean 型的. package com.sads; import java.awt.BorderLayout; import ...

  6. 第六章 通过Service访问Pod(中)

    6.2 Cluster IP 底层实现 Cluster IP 是一个虚拟IP,是由K8s节点上的iptables规则管理的. 使用类似轮询的方法访问Pod. 6.3 DNS 访问Service 在Cl ...

  7. folly学习心得(转)

    原文地址:  https://www.cnblogs.com/Leo_wl/archive/2012/06/27/2566346.html   阅读目录 学习代码库的一般步骤 folly库的学习心得 ...

  8. cocos2d中的坐标系统

    cocos2d中Layer的默认锚点是left.buttom sprite的锚点设置 setAnchorPoint(cc.p(0.5,0.5)); 默认锚点:中心 setAnchorPoint(cc. ...

  9. HTML——标签

    列表标签: 1,无序列表<ul>,无序列表中的每一项是<li> <ul> <li>顾清秋</li> <li>顾小白</li ...

  10. linux中的常用压缩与解压缩命令

    linux中常用的压缩格式有   .zip   .gz   .bz2   .tar.gz   .tar.bz2 一..zip 1.命令格式 zip 压缩文件名 源文件名         (压缩文件到当 ...