纳金网

标题: FPS中遇到的一些类以及用法 [打印本页]

作者: 王者再临    时间: 2014-8-30 01:44
标题: FPS中遇到的一些类以及用法
OnDrawGizmos () : void
Implement this OnDrawGizmos if you want to draw gizmos that are also pickable and always drawn.
如果你想绘制可被点选的gizmos,执行这个函数。
This allows you to quickly pick important objects in your scene.
这允许你在场景中快速选择重要的物体。
Note that OnDrawGizmos will use a mouse position that is relative to the Scene View.
注意: OnDrawGizmos使用相对鼠标坐标。
/************************************************************/
Quaternion.eulerAngles
var eulerAngles : Vector3
Description描述
Returns the euler angle representation of the rotation.
返回表示旋转的欧拉角度。
A rotation that rotates euler.z degrees around the z axis, euler.x degrees around the x axis, and euler.y degrees around the y axis (in that order).
表示旋转的角度,绕z轴旋转euler.z度,绕x轴旋转euler.x度,绕y轴旋转euler.y度(这样的顺序)。
/************************************************************/
Transform.TransformDirection 变换方向
Transforms direction from local space to world space.
从自身坐标到世界坐标变换方向。
This operation is not affected by scale or position of the transform. The returned vector has the same length as direction.
这个操作不会受到变换的缩放和位置的影响。返回的向量与direction有同样的长度。
/************************************************************/
function LookAt (target : Transform, worldUp : Vector3 = Vector3.up) : void
Description描述
Rotates the transform so the forward vector points at /target/'s current position.
旋转物体,这样向前向量指向target的当前位置。简单说,
旋转物体使z轴指向目标物体。
Then it rotates the transform to point its up direction vector in the direction hinted at by the worldUp vector. If you leave out the worldUp parameter, the function will use the world y axis. worldUp is only a hint vector. The up vector of the rotation will only match the worldUp vector if the forward direction is perpendicular to worldUp
在由worldUp向量示意的方向的y轴旋转物体,如果你忽略worldUp参数,这个函数将使用世界的y轴。worldUp只是一个示意向量,如果向前方向是与worldUp垂直的,旋转的向上向量将仅匹配worldUp向量。
翻译的感觉很别扭,下面是我的经验总结:
当该物体设置了LookAt并指定了目标物体时,该物体的z轴将始终指向目标物体,在设置了worldUp轴向时,该物体在更接近指定的轴向是旋转便的灵活,注意worldUp指的是世界空间,不论你物体在什么位置,只要接近指定的轴方向,旋转会变的更灵活。
/************************************************************/
static function Raycast (origin : Vector3, direction : Vector3, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : bool
Parameters参数Returns
bool - True when the ray intersects any collider, otherwise false.
当光线投射与任何碰撞器交叉时为真,否则为假。
Description描述
Casts a ray against all colliders in the scene.
在场景中投下可与所有碰撞器碰撞的一条光线。
/************************************************************/
Quaternion.identity 同一性
static var identity : Quaternion
Description描述
The identity rotation (Read Only). This quaternion corresponds to "no rotation": the object
is perfectly aligned with the world or parent axes
同一性旋转(只读)。该四元数,相当于"无旋转":这个物体完全对齐于世界或父轴。



作者: hyui    时间: 2014-8-30 03:14
Thanks for share !




欢迎光临 纳金网 (http://course.narkii.com/club/) Powered by Discuz! X2.5