Physics.SphereCaststatic function SphereCast (origin : Vector3, radius : float, direction : Vector3, out hitInfo : RaycastHit, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : booleanParameters
Returnsboolean - True when the capsule sweep intersects any collider, otherwise false. DescriptionCasts a sphere against all colliders in the scene and returns detailed information on what 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. Think of the sphere cast like a thick raycast. Note that the sphere cast does not work against colliders configured as triggers. See Also: Physics.SphereCastAll, Physics.CapsuleCast, Physics.Raycast, Rigidbody.SweepTest
JavaScript
function Update () { using UnityEngine; import UnityEngine static function SphereCast (ray : Ray, radius : float, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : booleanstatic function SphereCast (ray : Ray, radius : float, out hitInfo : RaycastHit, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : booleanParameters
Returnsboolean - True when the capsule sweep intersects any collider, otherwise false. DescriptionCasts a sphere against all colliders in the scene and returns detailed information on what 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. Think of the sphere cast like a thick raycast. Note that the sphere cast does not work against colliders configured as triggers. See Also: Physics.SphereCastAll, Physics.CapsuleCast, Physics.Raycast, Rigidbody.SweepTest |
