Why does a sphere cast hit have a different collision point than a sphere collider collision point when coming from the exact same position, distance, direction, etc?
I did look into collisions from the sphere collider has multiple collisions, it doesn’t. Normally such a small issue wouldn’t be a problem, but the amount it’s off stacks with each cast making it predicting a ball reflection increasingly off.
You could use one of the Debug.Draw methods to visualize those points in the editor and you might just figure out, what does not behave like you would expect. Have you set the right radius in your sphere cast? It’s easy to mix up radius and diameter
it seems that there is also a very small difference on the X axis.
I’ve double checked the radius and everywhere where it’s set, all are correct. As for using debug.Draw, I already tried (and still do that) otherwise I don’t even think I would have found this issue. But the amount the line renderer and spherecast is so tiny with the first bounce I can’t visually see any issues. I only noticed the issue because the sphere colliderer didn’t nicely follow the predicted line after a bounce over a long time (it becoming less accurate the longer it goes and more it reflects).
I’m guessing here, but it may be because the collision system in physics engines move the colliders around when a collision occurs (depenetration and such), but a sphere cast doesn’t. So the collision result is after contact resolution, but the sphere cast is just a math operation.
I don’t know of any way in that case, sorry.
Another possibility could have to do with the frame timing. Physics updates don’t happen at the same rate as Update ticks by default; physics might update 50 times a second but rendering happens at 60 fps, for example. If you are doing your sphere cast in an Update method instead of a FixedUpdate method, that could cause the sphere cast to be slightly out of sync with the collision. You could try moving the sphere cast into FixedUpdate if it isn’t already.
Sadly I already do it in fixed update. I’m thinking of just forcing it and see if that helps, until maybe a more ideal solution presents itself.
Hard forcing it by saving the locations of the spherecast hits and then moving it in that direction and forcing it into the spherecast location and going from there. I imagine the 0.05 difference max movement isn’t noticeable, especially with a particle effect to further mask it (which I already have). But that is rather far from ideal.