Hello,
I am running into some troubles with the Phys2d bitmask on Body’s. I would expect that having a collision group of 1 set on two Body’s would allow them to collide with each other. However I could not get this to work, so I dug around in the code and noticed this in CollisionSpace.java:
/**
* @see net.phys2d.raw.CollisionContext#resolve(net.phys2d.raw.BodyList, float)
*/
public void resolve(BodyList bodyList, float dt) {
for (int i = 0; i < bodyList.size(); ++i)
{
Body bi = bodyList.get(i);
if (bi.disabled()) {
continue;
}
for (int j = i+1; j < bodyList.size(); ++j)
{
Body bj = bodyList.get(j);
if (bj.disabled()) {
continue;
}
// should this be if ((bi.getBitmask() & bj.getBitmask()) == 0)?
if ((bi.getBitmask() & bj.getBitmask()) != 0) {
continue;
}
...
Has any one else encountered this problem? In order for collision groups to work they have to be non-matching bits? - that doesn’t make sense…
Thanks,
Tony