> I usually use classIndexes, but it needs a bit more than one line. Do we 
> have a simpler way now (checking class names takes too much time)?
You should try 1. dynamic_cast and 2. class indices. I am not sure which
one will be the winner:

FOREACH(const shared_ptr<Body>& b, *scene->bodies){
        if(!b) continue; // deleted bodies

        // first possibility
        // (not tested, but I think static indices should work just fine)
        if(b->shape->getClassIndexStatic()==Sphere::getClassIndexStatic()){ /* 
... */ }
        else if(b->shape->getClassIndexStatic()==Wall::getClassIndexState()) { 
/* ... */ }

        // second possibility
        if(dynamic_cast<Sphere>(b->shape->get())){ /* ... */ }
        else if(dynamic_cast<Wall>(b->shape->get())){ /* ... */ }
}

v



_______________________________________________
Mailing list: https://launchpad.net/~yade-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~yade-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to