Forum Libraries, Components, and Plugins

Anyone else having problems with Box2d and Cocossharp 1.7.1

Hi, I have two problems.

  1. Firstly creating a b2World hangs on Android with the following error:

04-08 09:38:22.263 E/EGL_emulation( 1744): tid 1769: eglMakeCurrent(981): error 0x3002 (EGL_BAD_ACCESS)
04-08 09:38:22.263 E/libEGL ( 1744): eglMakeCurrent:859 error 3002 (EGL_BAD_ACCESS)

It doesn't seem to matter where I put the line of code, Constructor or OnEnter or AddedToScene, all result in the game freezing.

  1. Secondly collision detection using a b2ContactListener works on the iOS Simulator but not on an actual iPhone 5 Device. I've got debug draw code and I can see the Fixtures are colliding. I get a call to my b2ContactListener on the Simulator and it works perfectly, but b2ContactListener doesn't get called when the same collision happens on the device and I can't understand why.

Any pointers or help or perhaps an updated Fruity Falls game that uses box2d would be great.


  • ProcogProcog GBMember ✭✭

    Ok, I just added a single line of code to the Fruity Falls source to create a Box2d world and it hangs on Android as well. Am I missing some magic with box2d or is it just broken? The same code works on Windows Phone and on iOS (albeit with the on device collision detection problem mentioned previously)

    Here's my change to Fruity Falls...

    _ Box2D.Dynamics.b2World b2World;_

        public GameScene(CCGameView gameView) : base(gameView)
            fruitList = new List<Fruit>();
            _b2World = new Box2D.Dynamics.b2World(new Box2D.Common.b2Vec2(0f, 9.8f));_
  • ProcogProcog GBMember ✭✭

    OK so I found the Android problem. The Cocossharp package 1.7.1 does not include a box2d dll for MonoAndroid10. As a workaround I downloaded CocosSharp.PCL.Shared into another project and then referenced the box2d dll downloaded by that package.

    If anyone at Xamarin is reading this then can you update the Cocossharp package to resolve this please and also possibly update your test cases :-).

    I still have the issue with collision detection not working on a physical iOS device.

  • rbmanian75rbmanian75 USMember ✭✭

    I am also having the same issue. Adding reference from pcl project does not work. world.createbody always returns null...

  • rbmanian75rbmanian75 USMember ✭✭

    I compiled it from the source and made it working. But i am getting very low FPS (2) in android devices.

Sign In or Register to comment.