Physics.SphereCastAll 所有球体投射

static function SphereCastAll (origin : Vector3, radius : float, direction : Vector3, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : RaycastHit[]

Parameters参数

Returns

RaycastHit[] - an array of all colliders hit in the sweep.

返回扫描碰到所有碰撞体的数组。

Description描述

Like Physics.SphereCast, but this function will return all hits the sphere sweep intersects.

Physics.SphereCast 不同的是这个函数返回所有交互的碰撞体信息。

Casts a sphere against all colliders in the scene and returns detailed information on each collider which was hit. This is useful when a Raycast does not give enough precision, because you want to find out if an object of a specific size, such as a character, will be able to move somewhere without colliding with anything on the way.

做一个球型物体的投射,对于场景中的所有物体。返回每一个碰撞体的信息。对球型物体做投射时,如果和碰撞体碰撞,raycasthit 结构返回碰撞信息。这可以用在光线投射无法满足要求时的情况下。例如要判断角色(有空间大小尺寸)是否和一个物体发生碰撞。

参见: Physics.SphereCast, Physics.CapsuleCast, Physics.Raycast, Rigidbody.SweepTest

• static function SphereCastAll (ray : Ray, radius : float, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : RaycastHit[]

Parameters参数

Returns

RaycastHit[] - an array of all colliders hit in the sweep. *listonly*

返回扫描碰到所有碰撞体的数组。

Description描述

 

Page last updated: 2011-4-9