- Code: Select all
if (ndAbs(tireSpeed) > ndFloat32(0.9f))
{
// apply brush tire model only when center travels faster that 10 miles per hours
const ndVector contactVeloc0(tireBody->GetVelocityAtPoint(contactPoint.m_point) - tireBody->GetVelocity() + tireVeloc);
const ndVector contactVeloc1(otherBody->GetVelocityAtPoint(contactPoint.m_point));
const ndVector relVeloc(contactVeloc0 - contactVeloc1);
const ndFloat32 relSpeed = ndAbs(relVeloc.DotProduct(contactPoint.m_dir1).GetScalar());
const ndFloat32 longitudialSlip = relSpeed / tireSpeed;
// calculate side slip ratio
const ndFloat32 sideSpeed = ndAbs(relVeloc.DotProduct(contactPoint.m_dir0).GetScalar());
const ndFloat32 lateralSlip = sideSpeed / (relSpeed + ndFloat32(1.0f)); // Unhandled exception at 0x00007FF7E8DE8FC9 in Realtime.exe: 0xC0000090: Floating-point invalid operation (parameters: 0x0000000000000000, 0x0000000000009D31).
I just got this exception, but can't replicate in debug mode to see if relSpeed + 1 sums up to zero.
But i guess this can happen and you might want to handle this case.
It happens because i have replaced a floor box with a larger test terrain composed from my mesh segments.
Now the floor is lower, and the car falls from a height of maybe 15 meters down, hitting the terrain with large speed. The crash happens on collision.
But sometimes the app crashes immediately when the simulation starts, when the car is still in air, here:
- Code: Select all
inline void ndSkeletonContainer::ndNode::CalculateInertiaMatrix(ndSpatialMatrix* const bodyMassArray) const
{
ndSpatialMatrix& bodyMass = bodyMassArray[m_index];
bodyMass = ndSpatialMatrix(ndFloat32(0.0f)); // <- memory access violation from reading at 0
if (m_body->GetInvMass() != ndFloat32(0.0f))
{
//...
}
}
I can't make sense of this. I assume it's from accessing bodyMassArray, but i saw m_index is 0, and the first mass element of the mass array was 0 too.
So that's pretty fishy. Maybe some memory corruption on my side. Ignore it.
I will now offset the cars position so it rests on the floor on startup, to see if i can get a stable simulation.
I assume both problems will go away for me then, so i just wanted to report in case it rings some bells on you.
The car is pretty awesome, btw