Built in physics body overlapping each other

In cocos2dx c++ version, physics bodies are overlapping each other when I move the bodies using setVelocity. But this does not happen when I use applyForce, but I dont want my character to move like someone is pushing it. I want it to move like how objects behave when using MoveBy. Is it bug or am i doing something wrong. Pls help

if(find(heldKeys.begin(), heldKeys.end(), EventKeyboard::KeyCode::KEY_S) != heldKeys.end())
 {
     playerBody->setVelocity(Vec2(0,-speed * dt));
 }

this is my code and this happensScreen Shot 2020-06-30 at 1.02.36 AM

Are you using any masks?

nah i nust created physics world and set velocity to the physics body of sprite, nothing else. I think this is happening because im constantly updating velocity with my speed variable but i dont think physics engine should misbehave because of something like this. :frowning:
I give up on cocos2dx built in physics because it seems like it is not gonna work. So im using box2d now.

You need masks though. I use the built in physics for all 35 of my games.

I think you mis understood my situation and sorry for my misleading explanation also. Collision is working. But they are behaving like a jelly. It overlaps a little bit and stops. So physics is definetly working but its working as what I expected from collision between static body and dynamic body.