查看: 1201|回复: 2
打印 上一主题 下一主题

[其他] FPS中遇到的一些类以及用法

[复制链接]

2317

主题

54

听众

2万

积分

资深设计师

Rank: 7Rank: 7Rank: 7

纳金币
20645
精华
62

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

跳转到指定楼层
楼主
发表于 2014-8-30 01:44:34 |只看该作者 |倒序浏览
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参数
  • origin
    The starting point of the ray in world coordinates.
    在世界坐标,射线的起始点。
  • direction
    The direction of the ray.
    射线的方向。
  • distance
    The length of the ray
    射线的长度。
  • layerMask
    A Layer mask that is used to selectively ignore colliders when casting a ray.
    只选定Layermask层内的碰撞器,其它层内碰撞器忽略。

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
同一性旋转(只读)。该四元数,相当于"无旋转":这个物体完全对齐于世界或父轴。


分享到: QQ好友和群QQ好友和群 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
转播转播0 分享淘帖0 收藏收藏0 支持支持0 反对反对0
回复

使用道具 举报

hyui    

1

主题

2

听众

6671

积分

高级设计师

Rank: 6Rank: 6

纳金币
2715
精华
0

最佳新人 活跃会员 热心会员 灌水之王 突出贡献

沙发
发表于 2014-8-30 03:14:52 |只看该作者
Thanks for share !
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

手机版|纳金网 ( 闽ICP备2021016425号-2/3

GMT+8, 2024-9-24 11:28 , Processed in 0.081436 second(s), 31 queries .

Powered by Discuz!-创意设计 X2.5

© 2008-2019 Narkii Inc.

回顶部