How to stop the character's movement after collision?

08bbe01638eceec758d0f7d4dfd21192.png

So this is my 2D game setup and I followed this tutorial-> Unreal Engine 4 2D Game Creation with Paper2D Part 1 - Introduction and Importing Assets - YouTube
I want my gravity to be 4 directional so I used this method->
b441d3fcdc8f02fd0dafe0d371f91679.png

So when the gravity works in X-Axis(right direction), the pink box collides with the black plank and stops. But when the gravity works on Z-Axis(up direction), the pink box collides and stops for fraction of seconds and it crosses the plank, that is, it rolls around the black plank above and keeps on moving towards that direction. How do I keep it stationary after collision?
I’m a total noob so can’t find a way to do so.