I’m using the Blueprint below, but when the sphere collides with a wall it goes through and goes to the other side.
Do you get a Blocking Hit? I mean do you ever go through the Branch?
If not - Probably tour collisions are not set correctly for both objects.
If you do, make sure that Lastposition is not intersecting.
Lastly, check if it’s not the order of operations that fails you. I am not entirely sure but I depending on how the tick is set (before or after physics) you might get outdated (previous tick) hit information.
Try to set your tick before/during/after physics and if that fails try splitting your logic in two ticks: first - the move and second is the correction or try to set your tick during physics.
P.S. If collision is set correctly you shouldn’t have to write your logic to correct penetrations. If both objects are blocking each other they should never intersect and the physics engine should handle that. Also the hit result has a Location which is “the position where we can place the shape in the world where it will not penetrate” - I suspect that this is what you want.