예제 #1
0
void dgDynamicBody::ApplyExtenalForces (dgFloat32 timestep, dgInt32 threadIndex)
{
	m_accel = dgVector (dgFloat32 (0.0f));
	m_alpha = dgVector (dgFloat32 (0.0f));
	if (m_applyExtForces) {
		m_applyExtForces(*this, timestep, threadIndex);
	}


#if 0
	#if 0
		static FILE* file = fopen ("replay.bin", "wb");
		if (file) {
			fwrite (&m_accel, sizeof (dgVector), 1, file);
			fwrite (&m_alpha, sizeof (dgVector), 1, file);
			fwrite (&m_veloc, sizeof (dgVector), 1, file);
			fwrite (&m_omega, sizeof (dgVector), 1, file);
			fflush(file);
		}
	#else 
		static FILE* file = fopen ("replay.bin", "rb");
		if (file) {
			fread (&m_accel, sizeof (dgVector), 1, file);
			fread (&m_alpha, sizeof (dgVector), 1, file);
			fread (&m_veloc, sizeof (dgVector), 1, file);
			fread (&m_omega, sizeof (dgVector), 1, file);
		}
	#endif
#endif

//_ASSERTE ((m_accel.m_y == -100.0f) || (m_accel.m_y == 0.0f)); 
}
예제 #2
0
void dgDynamicBody::ApplyExtenalForces (dgFloat32 timestep, dgInt32 threadIndex)
{
	m_accel = dgVector (dgFloat32 (0.0f));
	m_alpha = dgVector (dgFloat32 (0.0f));
	if (m_applyExtForces) {
		m_applyExtForces(*this, timestep, threadIndex);
	}

//_ASSERTE ((m_accel.m_y == -100.0f) || (m_accel.m_y == 0.0f)); 
}
예제 #3
0
void dgDynamicBody::ApplyExtenalForces (dgFloat32 timestep, dgInt32 threadIndex)
{
	m_externalForce = dgVector::m_zero;
	m_externalTorque = dgVector::m_zero;
	if (m_applyExtForces) {
		m_applyExtForces(*this, timestep, threadIndex);
	}
	
	m_gyroRotation = m_rotation;
	m_gyroTorque = dgVector::m_zero;

	m_externalForce += m_impulseForce;
	m_externalTorque += m_impulseTorque;
	m_impulseForce = dgVector::m_zero;
	m_impulseTorque = dgVector::m_zero;
}