Bugfix for #26795 and #26917, Fix a bug that cause the radar sensor to break

Never memset(&ob, 0,sizeof(class)) when there is a constructor, it overrides all memory.
The problem was that the memset(0) was setting the scaling to (0,0,0), the height of the cone became 'infinity' 
so GJK would iterate 'MAX_ITER' without converging due to this #NAN value
This commit is contained in:
Erwin Coumans
2011-04-20 04:55:58 +00:00
parent 37fcffd0ac
commit b5a2d7f15e
2 changed files with 38 additions and 2 deletions

View File

@@ -592,6 +592,9 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep,float
float subStep = timeStep / float(m_numTimeSubSteps);
i = m_dynamicsWorld->stepSimulation(interval,25,subStep);//perform always a full simulation step
//uncomment next line to see where Bullet spend its time (printf in console)
//CProfileManager::dumpAll();
processFhSprings(curTime,i*subStep);
for (it=m_controllers.begin(); it!=m_controllers.end(); it++)
@@ -2759,7 +2762,8 @@ int CcdPhysicsEnvironment::createConstraint(class PHY_IPhysicsController* ctrl
PHY_IPhysicsController* CcdPhysicsEnvironment::CreateConeController(float coneradius,float coneheight)
{
CcdConstructionInfo cinfo;
memset(&cinfo, 0, sizeof(cinfo)); /* avoid uninitialized values */
//don't memset cinfo: this is C++ and values should be set in the constructor!
// we don't need a CcdShapeConstructionInfo for this shape:
// it is simple enough for the standard copy constructor (see CcdPhysicsController::GetReplica)
cinfo.m_collisionShape = new btConeShape(coneradius,coneheight);