- Home /
Spherecast. Want to determine how close to the center of the sphere the collision occurred.
I wanted to have player click towards and object and being able to detect the object and determine how close in a 2 dimensional sense the click had been to the actual object being clicked at. I'm able to use a SphereCast call to determine if the player was 'close' to the target within a given 3d radius, but have not been able to figure out how to determine just how far from that center point the collision was. I don't know if the player was spot on with their click or if they were on the outer edges of the sphere.
Is there a way to determine this information?
If the camera looks straight along an axis, you can just zero out that axis on the distance vector and get it's magnitude.
Your answer
![](https://koobas.hobune.stream/wayback/20220612124041im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Plese help to create custom top-down light? 0 Answers
Unity SphereCast - Getting the center of the last sphere before the hit 2 Answers
Detecting the location of a shadow that is being projected onto a plane 1 Answer
Raycast hitInfo position placement not relative to Pivot Point. 1 Answer
Raycast only works while moving 2 Answers