SphereCastAll hit.point are allways zero
Asked Answered
H

1

0

Hey guys.
I tried using SphereCastAll and every time 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

Hootchykootchy answered 29/11, 2023 at 10:39 Comment(1)

Sorry for this, but I'm horrible at scripting, could you provide with a script or link ti script please if possible, thanks!

Nicolella
S
0

Physics.SphereCast

Note:

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.

Slush answered 29/11, 2023 at 21:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.