Question by
etaxi341 · Apr 30, 2016 at 06:32 PM ·
physicsraycastspherecasthit.pointspherecastall
SphereCastAll hit.point are allways zero
Hey guys. I tried using SphereCastAll and everytime I want to get the hit.point of these Casts it returns a Vector of zero
float attractDistance = 10f;
Ray ray = new Ray(transform.position, Vector3.forward);
RaycastHit[] possibleAttractors = Physics.SphereCastAll(ray, attractDistance, 0.0f);
foreach (RaycastHit hit in possibleAttractors)
{
print(hit.point); //Returns (0.0, 0.0, 0.0)
}
Thanks
Comment
Answer by andrew-lukasik · Jun 15, 2018 at 03:44 PM
Notes: SphereCast will not detect colliders for which the sphere overlaps the collider. Passing a zero radius results in undefined output and doesn't always behave the same as Physics.Raycast.