【发布时间】:2018-06-03 15:45:26
【问题描述】:
由于某种原因,cocos2d-x 中 PhysicsBody 的函数 setBatgoryBitmask() 无效:
OutputDebugStringA("Wall cat bitmask : ");
OutputDebugStringA(std::to_string(body->getCategoryBitmask()).c_str());
OutputDebugStringA("\n");
body->setCategoryBitmask(2);
OutputDebugStringA("Wall cat bitmask : ");
OutputDebugStringA(std::to_string(body->getCategoryBitmask()).c_str());
OutputDebugStringA("\n");
body->addShape(PhysicsShapeEdgeBox::create(Size(dest - or ), mat, borderW));
OutputDebugStringA("Wall cat bitmask : ");
OutputDebugStringA(std::to_string(body->getCategoryBitmask()).c_str());
OutputDebugStringA("\n");
结果:
Wall cat bitmask : -1
Wall cat bitmask : -1
Wall cat bitmask : -1
因此,我无法定义什么与什么发生冲突。 setCategoryBitmask 和 getCategoryBitmask 似乎都是简单的 setter 和 getter,但是我不知道这里发生了什么。
【问题讨论】: