[ODE] dWorldSetAutoDisableFlag doesn't work?

Nguyen Binh ngbinh at glassegg.com
Tue May 25 11:05:45 MST 2004


Hi Mohsin,

MH> According to documentation dWorldSetAutoDisableFlag and all the other
MH> dWorldSetAutoDisable* functions set the defaults for any object created in
MH> the world. Apparently it means if I set the parameters for world, I don't
MH> have to individually set these parameters for each body. But it doesn't seem
MH> to work for me. As long as I specify these parameters for individual bodies
MH> only (and not for world) it works. But if I set the world parameters it
MH> doesn't work anymore even if I set the same parameters for individual bodies
MH> afterwards. Apparently creating a body gets the default parameters from the
MH> world but sets them in some other variables whereas setting these parameters
MH> to the body directly sets bit flags to another parameter. Has anyone else
MH> experienced it? I would have traced it more but it's pretty late and I'm
MH> tired. Or am I understanding the feature wrong? 

    I'd bet you are using test_crash.cpp. The problem is
    test_crash.cpp is older than "official" AutoDisable stuff.
    Look at the code :
----------------
                else
                {
                        dSpaceCollide (space,0,&nearCallback);
                        dWorldStep (world,0.05);
                        dJointGroupEmpty (contactgroup);
                }
                
                for (i = 0; i < wb; i++)
                {
                        b = dGeomGetBody(wall_boxes[i]);
                        if (dBodyIsEnabled(b)) 
                        {
                                bool disable = true;
                                const dReal *lvel = dBodyGetLinearVel(b);
                                dReal lspeed = lvel[0]*lvel[0]+lvel[1]*lvel[1]+lvel[2]*lvel[2];
                                if (lspeed > DISABLE_THRESHOLD)
                                        disable = false;
                                const dReal *avel = dBodyGetAngularVel(b);
                                dReal aspeed = avel[0]*avel[0]+avel[1]*avel[1]+avel[2]*avel[2];
                                if (aspeed > DISABLE_THRESHOLD)
                                        disable = false;
                                
                                if (disable)
                                        wb_stepsdis[i]++;
                                else
                                        wb_stepsdis[i] = 0;
                                
                                if (wb_stepsdis[i] > DISABLE_STEPS)
                                {
                                        dBodyDisable(b);
                                        dsSetColor(0.5,0.5,1);
                                }
                                else
                                        dsSetColor(1,1,1);

                        }
                        else
                                dsSetColor(0.4,0.4,0.4);
                        dVector3 ss;
                        dGeomBoxGetLengths (wall_boxes[i], ss);
                        dsDrawBox(dGeomGetPosition(wall_boxes[i]), dGeomGetRotation(wall_boxes[i]), ss);
                }
        }
----------------

You'll see that David (the original author of test_crash.cpp) had
tried to do auto disable his own.

Just comment out those lines and you'll see "official" ODE code comes
out.

-- 
Best regards,

---------------------------------------------------------------------
   Nguyen Binh
   Software Engineer
   Glass Egg Digital Media
   
   E.Town Building  
   7th Floor, 364 CongHoa Street
   Tan Binh District,
   HoChiMinh City,
   VietNam,

   Phone : +84 8 8109018
   Fax   : +84 8 8109013

     www.glassegg.com
---------------------------------------------------------------------



More information about the ODE mailing list