Den
July 16, 2014, 11:43am
#1
Hello everyone,
I have tried to enable box2d and disable chimpmunk. On the CMakeLists.txt I changed:
option(USE_CHIPMUNK "Use chipmunk for physics library" OFF)
option(USE_BOX2D "Use box2d for physics library" ON)
But when parsing cmake I get:
Using chipmunk ...
And during compilcation “undefined reference” to box2d calls rises, as it was not linked.
I tried to setup flags by force, like this:
set(USE_BOX2D true)
set(USE_CHIPMUNK false)
But in that case I get “there is no such file or directory chipmunk.h”.
Can anyone give me a hint how I can enable and link box2d ?
1 Like
Den:
ne give me a hint how I
Here is a way to add box2d (on Visual Studio):
Open file CMakeLists.txt. At line 162 add "“box2d”
FILE -> Add -> Existing Project:
choose: …cocos2d\external\Box2D\proj.win32\Box2D.vcxproj
Right Click on Project -> Project Dependencies, tick Box2D
Right Click on Project -> References => Add New References, tick on Box2D -> ok
save solution (ctrl s)
check: open file proj.win32\YouProject.vcxproj, if it have “Box2D” then this is ok and you can now use box2d:
include “Box2D/Box2D.h”;
USING_NS_CC;
what you saying that if i want to use box2d its by default disabled ? …
why not to add into the cocos console option to choose between the 2
yup… thats a gud idea…
but i am sure there is a reason for the default integration of chipmunk.
But @Meir_yanovich has a valid approach i believe.
can anyone explain it to us. ?
Den
July 17, 2014, 9:16am
#5
I downloaded cocos2d-x v.3.1.1. At CMakeLists.txt I added:
set(USE_CHIPMUNK false)
set(USE_BOX2D true)
and also add “box2d” to
target_link_libraries(${APP_NAME}
spine
cocostudio
cocosbuilder
extensions
audio
cocos2d
box2d
)
Then everything works fine.
But with v.3.2 I still have problems.
Thanks @tieudaotu for your solution but I have Linux and no MSVS.
1 Like
can’t we just switch the OFF to ON for Box2d and the reverse for Chipmunk
in the CMakeLists.txt file ?
to use it… ?
also can we use both physics engine at the same time… ??
@slackmoehrle could you help us. ?
Den
July 17, 2014, 10:22am
#7
@pabitrapadhy
As I wrote before
option(USE_CHIPMUNK "Use chipmunk for physics library" OFF)
option(USE_BOX2D "Use box2d for physics library" ON)
has no effect.
You cannot use both physics engines at the same time.
Let me have someone look at this.
Woppix
July 18, 2014, 7:42pm
#11
Anyone figure this out? I’ve been struggling with it for a few days now as well.
I have someone looking at this to help.
Den
July 19, 2014, 10:22am
#13
I’m asking someone to answer this for us. I’ll post his reply.
boyu0
July 24, 2014, 2:16am
#16
If you need to disable chipmunk, you also need disable CC_USE_PHYSICS
in base/ccConfig.h, because our engine use chipmunk for physics integration.
I don’t know why “Using chipmunk …” still shown, I will check that.
boyu0
July 28, 2014, 10:38am
#17
I have tested this, It works for me.
You need to change line 37, 38 and 50, 51 in CMakeLists.txt, and disable CC_USE_PHYSICS in base/ccConfig.h.
But if you use lua, you can not disable chipmunk, it has some problem with lua-binding, we are working no this…
Harsh
November 4, 2014, 2:06pm
#18
In Xcode->cocos2d_libs.xcodeproj
add Below code in GCC_PREPROCESSOR_DEFINITION
COCOS2D_DEBUG=1 USE_FILE32API CC_ENABLE_CHIPMUNK_INTEGRATION=0
COCOS2D_DEBUG=1 USE_FILE32API CC_ENABLE_BOX2D_INTEGRATION=1
It is running well in my game…
woyaru
June 18, 2015, 6:32pm
#19
I would like to ask you about your last statement. What is the current status of the using Box2d in cocos2d-x with lua? It is possible to disable Chipmunk and enable Box2d?
efares
August 6, 2015, 3:54pm
#20
Does anyone have any links or tips on the differences between Box2d and Chipmunk? For a beginner, where do I start in terms of learning the differences between the two?
Maxxx
August 8, 2015, 8:44am
#21
gives a good summary off the differences