How to control velocity changing on bodies collision with cocosPhysics?

HI. I have game field with many squares (with static bodies) and hero sprite(with dynamic body) which controlled by a keyboard. Moves by invoke body_->setVelocity
When hero sprite touches square, he uncontrolled change his velocity. and start moving back from square.
But i need to stop moving after colliding with square.

How can i change square and hero PhysicsBodies, and make hero sprite stop when collide with barrier body ? (i’m looking for most easy way to do this)