[ODE] Patch: SwapNormals in collision_trimesh_trimesh.cpp

Marco Grubert mgrubert at conitec.net
Thu Aug 26 17:28:10 MST 2004


Just noticed that an old bug has not been patched yet. Swapnormals in 
collision_trimesh_trimesh should be passing references and not values. Here 
we go :

i:\temp\ode\ode\src\collision_trimesh_trimesh.cpp
8/26/2004 17:17:23
-----------------------------------------------------
--105 SwapNormals(dVector3 *pen_v, dVector3 *col_v, dVector3* v1, dVector3* 
v2,
             dVector3 *pen_elt, dVector3 *elt_f1, dVector3 *elt_f2,
++105 SwapNormals(dVector3 *&pen_v, dVector3 *&col_v, dVector3* v1, 
dVector3* v2,
             dVector3 *&pen_elt, dVector3 *elt_f1, dVector3 *elt_f2,
-----------------------------------------------------


And in ODE.CPP line 963 function dBodySetAutoDisableFlag :

-----------------------------------------------------
void dBodySetAutoDisableFlag (dBodyID b, int do_auto_disable)
{
 dAASSERT(b);
 if (!do_auto_disable) b->flags &= ~dxBodyAutoDisable;
 else b->flags |= dxBodyAutoDisable;
}
-----------------------------------------------------

I would recommend replacing it with the following so that all counters are 
reset preventing bodies from freezing in the wrong spot if their counters 
had previous values :

-----------------------------------------------------
void dBodySetAutoDisableFlag (dBodyID b, int do_auto_disable)
{
 dAASSERT(b);
 if( !do_auto_disable)
 {
  b->flags &= ~dxBodyAutoDisable;
  // (mg) we should also reset the IsDisabled state to correspond to the 
DoDisabling flag
  b->flags &= ~dxBodyDisabled;
  b->adis.idle_steps = dWorldGetAutoDisableSteps(b->world);
  b->adis.idle_time = dWorldGetAutoDisableTime(b->world);
  // (mg) end
 } else {
  b->flags |= dxBodyAutoDisable;
 }
}
-----------------------------------------------------



More information about the ODE mailing list