How to have a dynamic body to act like a static

How to have a dynamic body to act like a static
0.0 0



I’m trying to implement a behavior where my player can push or pull a crate when he hit a certain keystroke.

my crate has a dynamic body, so when my player push it, it moves. even if the keystroke wasnt hit.

I tried changing the body type dynamically but that didn’t work

I tried putting a huge number for density or linearDamping but it still moves a bit.

any idea how that can be done ?


Hi, not sure how to do it with the current physics api, I’d have also tried to change the density of the body.
You could try to use Box2d which has kinematic bodies.
As far as I know chipmunk also has kinematic bodies but the cocos api doesn’t expose them so you could try to dig into the source code to find how to use them.


I just saw you’re using creater and not cocos-2dx, creator use box2d by default, you should be able to use a kinematic body which is what you want.


I think I will stick with Box2d, it looks like it is the future of the physics engine with Coco Creator.

yes I think body type Kinematic is what I need, I’ll try it and let you know.

Thanks a lot!


In the end, a Kinetic body wasn’t exactly what I was looking for.

The solution was pretty easy, I kept the body Dynamic and changed the gravityScale of the crate to 1000.

thanks for your help @zerodarkzone