cocos2dx v3.16のBox2DでEXC_BAD_ACCESS修正方法
開発のおはなしです。
cocos2dx v3.16のBox2DでEXC_BAD_ACCESSが発生したのでその修正方法メモ。
この関数でクラッシュしたので調べたら、
void b2Island::Solve(b2Profile* profile, const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep) ・・・
for (int32 j = 0; j < m_jointCount; ++j)
{
bool jointOkay = m_joints[i]->SolvePositionConstraints(solverData);
jointsOkay = jointsOkay && jointOkay;
}
このfor文でm_joints[i]をm_joints[j]に修正するといいです。