CCD: updateCCD index out of bounds crash


I am currently working on an archery prototype. The arrows are a compound shape made of a sphere for the head and a box for the body. They have CCD enabled for obvious reasons (there won’t be many of them either). I am using the three points of CCD activation.




if (!PxFilterObjectIsKinematic(attributes0) || !PxFilterObjectIsKinematic(attributes1))
        pairFlags |= PxPairFlag::eDETECT_CCD_CONTACT;

Arrow Rigid Body

m_pRigidBody->setRigidBodyFlag(PxRigidBodyFlag::eENABLE_CCD, true);

After shooting a few arrows I am getting a crash in PxsCCD.cpp on line 1647 “mCCDIslandHistogram[p.mIslandId]”. The mIslandId is out of bounds as it is set to the “const PxU32 staticLabel = 0xFFFFffff;”. Looking at the logic before hand, it seems to assume this would never be the case.


const PxU32 staticLabel = 0xFFFFffff;
PxsCCDPair& p = *mCCDPtrPairs[j];
PxU32 id0 = p.mBa0 && !p.mBa0->isKinematic()? islandLabels[p.mBa0->mCCD->getIndex()] : staticLabel;
PxU32 id1 = p.mBa1 && !p.mBa1->isKinematic()? islandLabels[p.mBa1->mCCD->getIndex()] : staticLabel;
PX_ASSERT(id0 != 0xFFFF || id1 != 0xFFFF);

PX_ASSERT(id0 == staticLabel || id1 == staticLabel || (id0 == id1));

p.mIslandId = PxMin(id0, id1);
mCCDIslandHistogram[p.mIslandId] ++;
PX_ASSERT(p.mIslandId != staticLabel);

The first object on the CCD pair is a Capsule (only capsule in the scene is the character controller) with a valid rigid body. The second is a box with no rigid body.

Have I missed something that might be causing this? I haven’t been able to figure it out.
Also, should this be considered a bug to report? At the least, the PX_ASSERT needs to be moved up one line.

Grant Johnson

Are you creating/deleting these objects frequently, or is the crash happening with an arrow that isn’t being deleted?

None of the arrows are being deleted when the crash happens. They stay in the scene because they stick to objects. This is done by just switching the body to kinematic.

I have the exact same problem. Do you find any hint or solution ?
It happens only when 2 kinematic objects collide.
Thanks !