How to find collision btw sphere and cube without unity builtin collision functions ? I dont want to use OnCollisionEnter or etc.Any Algorithm or something else. can any one help me?

I want to collide sphere with cube but without any Unity functions.

Do you want to detect a collision or make tho objects collide?

you mean you want to code your own physics system?
or just worry about performance?

Luckily, since it is very simple geometry, it is fairly simple to check. The basics is you need to find the closest point to the cube on the surface of the sphere. This is basically getting the normalized direction vector from the sphere to the cube * the radius of the sphere (1/2 half of the diameter) then add the position of the sphere.

Then you can just check to see if that point is inside the cube.
To get the direction vector: Vector3 dir = sphere.transform.position - cube.transform.position;


The radius, if a perfect sphere and using unitys built in sphere object, is just the scale / 2(all components should be equal) so the closest point on the surface of the sphere would be
Vector3 closestPoint = dir * (sphere.transform.localScale.x / 2) + sphere.transform.position;
Then you can check to see if that point is within the bounds of the cube(google this exact thing to find the answer) Here is a good resource