small issue and deactivation times

vspyder
Posts: 3
Joined: Tue Oct 11, 2011 1:37 am

small issue and deactivation times

Post by vspyder »

In btCollisionObject.cpp In the function:

Code: Select all

const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* serializer) const
The following lines are duplicated:

dataOut->m_activationState1 = m_activationState1;
dataOut->m_activationState1 = m_activationState1;

This is the latest version of Bullet.

Now for what I think is a more serious issue. This has to do with the setting of deactivation times.

In btCollisionObject.cpp we have:

Code: Select all

	void	setDeactivationTime(btScalar time)
	{
		m_deactivationTime = time;
	}
However when I debug to see if the deactivation time happens after the threshold is reached as in the following code:

Code: Select all

	SIMD_FORCE_INLINE void	updateDeactivation(btScalar timeStep)
	{
		if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == DISABLE_DEACTIVATION))
			return;

		if ((getLinearVelocity().length2() < m_linearSleepingThreshold*m_linearSleepingThreshold) &&
			(getAngularVelocity().length2() < m_angularSleepingThreshold*m_angularSleepingThreshold))
		{
			m_deactivationTime += timeStep;
		} else
		{
			m_deactivationTime=btScalar(0.);
			setActivationState(0);
		}

	}
The value I set in m_deactivationTime is cleared to zero. Then I checked this routine:

Code: Select all

	SIMD_FORCE_INLINE bool	wantsSleeping()
	{

		if (getActivationState() == DISABLE_DEACTIVATION)
			return false;

		//disable deactivation
		if (gDisableDeactivation || (gDeactivationTime == btScalar(0.)))
			return false;

		if ( (getActivationState() == ISLAND_SLEEPING) || (getActivationState() == WANTS_DEACTIVATION))
			return true;

		if (m_deactivationTime> gDeactivationTime)
		{
			return true;
		}
		return false;
	}
m_deactivationTime is checked against the global variable gDeactivationTime which is hard coded to 2.0. So the setDeactivation time seems to control nothing. Is it no longer possible to set the deactivation time to something other than two or is this some sort of bug?

Thanks for any help anyone can give me