Cocos2d-x Physics Library bugs

Cocos2d-x C++ Physics
  • invaderwiz
    Likes 0

    Problem Description

    Just creating a new project to exercise new knowledge of the integrated physics engine in cocos. And today not being near my phone and being lazy, decided to compile the project in win32 and came across some problems that did not appear until now. Bodies began to go through each other and weird movement from bodies after collisions. Then tried it on my phone to see if it was anything I did but everything worked fine as it supposed to. The problem only seem to persist within win32. I was wondering if i’m missing any line of code that is exclusive to win32 or cocos2d-x have compatibility issues?


  • Sonar Systems admin
    Likes 0

    Does it work at all as in is the collision detection just poor?


    This reply has been verified.
  • invaderwiz
    Likes 0

    I’ve went throughout the code several times. I have managed to fix the problems i was having but now new problems arise. I have a zero gravity world with bodies of zero friction also, to maintain constant velocity with a ball body and everything’s elastic collision. But occasionally encounter one of these two problems:

    1. The ball hits the edge box at an angle but after collision proceeds to move parallel to the edge box while also losing velocity
    2. The ball sometimes passes through the edge box.

    I’m using Cocos2d-x v3.8.1 with VS2015. Could it be an incompatibility issue?

  • Sonar Systems admin
    Likes 0

    After collision you need to update the velocity so it moves at the same speed again otherwise it loses speed.

  • invaderwiz
    Likes 0

    But theoretically I don’t have to…..

    Anyways, should i implement in onContactSeperate or onContactPostSolve? Which would be more efficient.

  • Sonar Systems admin
    Likes 0

    onContactSeperate

  • invaderwiz
    Likes 1

    Thanks alot.


    This reply has been verified.
  • Sonar Systems admin
    Likes 0

    Your welcome :D

Login to reply