Avoid one gameObject skin in another gameObject

Let say i have two gameObject, one is sphere another is cube. While sphere position is control by mouse cursor(sphere follow the move position). But my sphere will skin in the cube, when my cursor near to cube 1B.

I perfer the sphere will not skin in the cube.

Is Unity3D have any way to make the sphere look like in picutre 1A. The sphere just touch or not skin in the cube like.

I have try add collider and rigidbody, but it is still skin in.

Add forces (with the rigidbody) instead of manually changing its position which I assume you are doing.

i need the cube to be stay, no movement.
And the sphere also need follow the mouse cursor position.

If the cube needs to stay, set isKinematic to true (on the cube)

The other option is to reverse its movement when it detects a collision with the cube.

yes i have set the cube isKinematic, then the result just like 1B.

This mean there is no easy way the sphere will automatically stop when touched the cube?
It is require coding, can not just simply apply some physics components to make sphere automatically stop when touch the cube?

If you don’t use a rigidbody and its functions, there is no “easy” way.

By apply rigidbody, how i can make the sphere stop when collide the cube?