Assert in 2.69

User avatar
mirat
Posts: 16
Joined: Thu May 29, 2008 10:47 am

Assert in 2.69

Post by mirat »

src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp

bullet 2.68

Code: Select all

void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
{
	assert(validContactDistance(newPoint));

	int insertIndex = getNumContacts();
	if (insertIndex == MANIFOLD_CACHE_SIZE)
	{
#if MANIFOLD_CACHE_SIZE >= 4
		//sort cache so best points come first, based on area
		insertIndex = sortCachedPoints(newPoint);
#else
		insertIndex = 0;
#endif

		
	} else
	{
		m_cachedPoints++;

		
	}
	replaceContactPoint(newPoint,insertIndex);
}
bullet 2.69

Code: Select all

void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
{
	assert(validContactDistance(newPoint));

	int insertIndex = getNumContacts();
	if (insertIndex == MANIFOLD_CACHE_SIZE)
	{
#if MANIFOLD_CACHE_SIZE >= 4
		//sort cache so best points come first, based on area
		insertIndex = sortCachedPoints(newPoint);
#else
		insertIndex = 0;
#endif

		
	} else
	{
		m_cachedPoints++;

		
	}
	btAssert(m_pointCache[insertIndex].m_userPersistentData==0);
	m_pointCache[insertIndex] = newPoint;
}
When the number of points exceeded the limit, old bullet just reused the worst points and replaced it. I ported my app to use a new bullet and I'm getting this assert when two cubes collides by their sides. What should I do?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Assert in 2.69

Post by Erwin Coumans »

This is probably an issue I introduced accidently, so it will need to be fixed.

Thanks a lot for reporting, we'll fix it for Bullet 2.70,
Erwin
Wavesonics
Posts: 71
Joined: Thu May 22, 2008 8:03 pm

Re: Assert in 2.69

Post by Wavesonics »

Yes, this is one of the problems I ran into with the contact destroyed callbacks, that kept firing off.

Good to hear it will be fixed.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Assert in 2.69

Post by Erwin Coumans »

Please add a 'clearUserCache' so the implementation becomes:

Code: Select all

void btPersistentManifold::AddManifoldPoint(const btManifoldPoint& newPoint)
{
	assert(validContactDistance(newPoint));

	int insertIndex = getNumContacts();
	if (insertIndex == MANIFOLD_CACHE_SIZE)
	{
#if MANIFOLD_CACHE_SIZE >= 4
		//sort cache so best points come first, based on area
		insertIndex = sortCachedPoints(newPoint);
#else
		insertIndex = 0;
#endif
		clearUserCache(m_pointCache[insertIndex]);
		
	} else
	{
		m_cachedPoints++;

		
	}
	btAssert(m_pointCache[insertIndex].m_userPersistentData==0);
	m_pointCache[insertIndex] = newPoint;
}
You can also use the latest Bullet subversion trunk from googlecode, the fix and some related fixes have been applied.

Can you report if this fixes the issue? Thanks,
Erwin
User avatar
mirat
Posts: 16
Joined: Thu May 29, 2008 10:47 am

Re: Assert in 2.69

Post by mirat »

It seems that adding clearUserCache fixes the problem, thanks.