Version: 2017.3

Physics.SphereCastAll

Cambiar al Manual
public static RaycastHit[] SphereCastAll (Vector3 origin, float radius, Vector3 direction, float maxDistance= Mathf.Infinity, int layerMask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

Parámetros

origin El centro de la esfera al principio del barrido.
radius The radius of the sphere.
direction La dirección en el cual barre la esfera.
maxDistance La longitud máxima del barrido.
layerMask Un Layer mask que es utilizado para ignorar colliders de manera selectiva cuando se emita una esfera.
queryTriggerInteraction Especifica si esta consulta debería golpear Triggers.

Valor de retorno

RaycastHit[] Un arreglo de todos los colliders golpeados en el barrido.

Descripción

Como Physics.SphereCast, pero esta función retornará todos los hits (golpes) que el barrido de la esfera intersecte.

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.

Notes: For colliders that overlap the sphere at the start of the sweep, RaycastHit.normal is set opposite to the direction of the sweep, RaycastHit.distance is set to zero, and the zero vector gets returned in RaycastHit.point. You might want to check whether this is the case in your particular query and perform additional queries to refine the result. Passing a zero radius results in undefined output and doesn't always behave the same as Physics.Raycast.

See Also: Physics.SphereCast, Physics.CapsuleCast, Physics.Raycast, Rigidbody.SweepTest.


public static RaycastHit[] SphereCastAll (Ray ray, float radius, float maxDistance= Mathf.Infinity, int layerMask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

Parámetros

ray El punto inicial y dirección del rayo en la que se ejecuta el barrido de la esfera.
radius The radius of the sphere.
maxDistance La longitud máxima del barrido.
layerMask Un Layer mask que es utilizado para ignorar colliders de manera selectiva cuando se emita una esfera.
queryTriggerInteraction Especifica si esta consulta debería golpear Triggers.

Descripción

Como Physics.SphereCast, pero esta función retornará todos los hits (golpes) que el barrido de la esfera intersecte.