What physics engine uses cocos2dx 4.0

Hi,
Since I have be reading old cocos2dx books, am bit confused with some of the terminology. When we do scene:: createWithPhysics() what physics engine is used? Is it box2d, is it chipmunk, or is it something new in cocos2dx 4.0?

Thanks

Should be Chipmunk2D

So when you do createWithPhysics it is calling chipmunk internally or what it is going there? How do you know what it is using?
Iā€™ve browsed through the forum and there are post recommending box2d. If that is the case, how do you set cocos to use box2d instead of chipmunk?

the ā€œinternal physics engineā€ of cocos2dx 4.0 using chipmunk2d.
That cannot been changed (its a hardcoded part)

I was a little confused like the original poster.

Checking the source on github, the readme says

Integrated with physics engines: Box2d and Chipmunk

Also, in the v4 changelog it says:

update Box2D to latest commit f655c603ba9d83

Looking at the latest source code, it seems you (still) just edit ccConfig.h

#define CC_ENABLE_CHIPMUNK_INTEGRATION 0
#define CC_ENABLE_BOX2D_INTEGRATION 1

BUT
It seems likely that Chipmunk will perform significally better, as noted in this slightly, old comparison

So stay with the default Chipmunk, unless you want to use some cool particle stuff like this tutorial Tutorial: Using Box2D Physics In Cocos Creator To Build Liquid Physics

1 Like

Correct! You can switch between Box2d and Chipmunk but DebugDraw modus is only supported with Chipmunk2D.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.